afl-fuzz.c
static void calculate_case_score(struct queue_entry* q, struct hash_map* hash_map_index){
  q->score = 0.0;
  q->mem_num = hash_map_index->mem_num;
  q->bug_num = hash_map_index->bug_num;
  q->func_num = hash_map_index->func_num;
  q->global_num = hash_map_index->global_num;
  q->untouch_num = hash_map_index->untouch_num;
  q->global_assign_num = hash_map_index->global_assign_num;
  q->bit_num = hash_map_index->bit_num;
  q->loop_num = hash_map_index->loop_num;
  q->cmp_const_num = hash_map_index->cmp_const_num;

  for(u32 i_lh = 0; i_lh < TOP_NUM; i_lh++){
    if(good_top[i_lh] > 0){
      switch (i_lh) {
        case 0: q->score += (double)((double)( exec_us_min) + 0.00000000001)/((double)(q->exec_us) + 0.00000000001); break;
        case 1: q->score += (double)((double)( q->exec_us) + 0.00000000001)/((double)(exec_us_max) + 0.00000000001); break;
        case 2: q->score += (double)((double)( q->len) + 0.00000000001)/((double)(len_max) + 0.00000000001); break;
        case 3: q->score += (double)((double)( len_min) + 0.00000000001)/((double)(q->len) + 0.00000000001); break;
        case 4: q->score += (double)((double)( q->bit_num) + 0.00000000001)/((double)(bit_num_max) + 0.00000000001); break;
        case 5: q->score += (double)((double)( q->interesting) + 0.00000000001)/((double)(interesting_max) + 0.00000000001); break;
        case 6: q->score += (double)((double)( q->cmp_const_num) + 0.00000000001)/((double)(cmp_const_num_max) + 0.00000000001); break;
        case 7: q->score += (double)((double)( q->untouch_num) + 0.00000000001)/((double)(untouch_num_max) + 0.00000000001); break;
        case 8: q->score += (double)((double)( q->mem_num) + 0.00000000001)/((double)(mem_num_max) + 0.00000000001); break;
        case 9: q->score += (double)((double)( q->depth) + 0.00000000001)/((double)(depth_max) + 0.00000000001); break;
        case 10: q->score += (double)((double)( q->func_num) + 0.00000000001)/((double)(func_num_max) + 0.00000000001); break;
        case 11: q->score += (double)((double)( q->loop_num) + 0.00000000001)/((double)(loop_num_max) + 0.00000000001); break;
        case 12: q->score += (double)((double)( q->global_num) + 0.00000000001)/((double)(global_num_max) + 0.00000000001); break;
        case 13: q->score += (double)((double)( q->global_assign_num) + 0.00000000001)/((double)(global_assign_num_max) + 0.00000000001); break;
        case 14: q->score += (double)((double)( q->bug_num) + 0.00000000001)/((double)(bug_num_max) + 0.00000000001); break;
        case 15: q->score += (double)((double)( q->edge_change_efficiency) + 0.00000000001)/((double)(edge_change_efficiency_max) + 0.00000000001); break;
        case 16: q->score += (double)((double)( exec_num_min) + 0.00000000001)/((double)(q->exec_num) + 0.00000000001); break;
        default: break;
      }
    }
  } 
}
/* Calculate score for each case. Created by LH. */
Calculate score for each case. Created by LH.
Calculate score for each case . Created by LH .
static void calculate_case_score(struct queue_entry* q, struct hash_map* hash_map_index){
  q->score = 0.0;
  q->mem_num = hash_map_index->mem_num;
  q->bug_num = hash_map_index->bug_num;
  q->func_num = hash_map_index->func_num;
  q->global_num = hash_map_index->global_num;
  q->untouch_num = hash_map_index->untouch_num;
  q->global_assign_num = hash_map_index->global_assign_num;
  q->bit_num = hash_map_index->bit_num;
  q->loop_num = hash_map_index->loop_num;
  q->cmp_const_num = hash_map_index->cmp_const_num;
  for(u32 i_lh = 0; i_lh < TOP_NUM; i_lh++){
    if(good_top[i_lh] > 0){
      switch (i_lh) {
        case 0: q->score += (double)((double)( exec_us_min) + 0.00000000001)/((double)(q->exec_us) + 0.00000000001); break;
        case 1: q->score += (double)((double)( q->exec_us) + 0.00000000001)/((double)(exec_us_max) + 0.00000000001); break;
        case 2: q->score += (double)((double)( q->len) + 0.00000000001)/((double)(len_max) + 0.00000000001); break;
        case 3: q->score += (double)((double)( len_min) + 0.00000000001)/((double)(q->len) + 0.00000000001); break;
        case 4: q->score += (double)((double)( q->bit_num) + 0.00000000001)/((double)(bit_num_max) + 0.00000000001); break;
        case 5: q->score += (double)((double)( q->interesting) + 0.00000000001)/((double)(interesting_max) + 0.00000000001); break;
        case 6: q->score += (double)((double)( q->cmp_const_num) + 0.00000000001)/((double)(cmp_const_num_max) + 0.00000000001); break;
        case 7: q->score += (double)((double)( q->untouch_num) + 0.00000000001)/((double)(untouch_num_max) + 0.00000000001); break;
        case 8: q->score += (double)((double)( q->mem_num) + 0.00000000001)/((double)(mem_num_max) + 0.00000000001); break;
        case 9: q->score += (double)((double)( q->depth) + 0.00000000001)/((double)(depth_max) + 0.00000000001); break;
        case 10: q->score += (double)((double)( q->func_num) + 0.00000000001)/((double)(func_num_max) + 0.00000000001); break;
        case 11: q->score += (double)((double)( q->loop_num) + 0.00000000001)/((double)(loop_num_max) + 0.00000000001); break;
        case 12: q->score += (double)((double)( q->global_num) + 0.00000000001)/((double)(global_num_max) + 0.00000000001); break;
        case 13: q->score += (double)((double)( q->global_assign_num) + 0.00000000001)/((double)(global_assign_num_max) + 0.00000000001); break;
        case 14: q->score += (double)((double)( q->bug_num) + 0.00000000001)/((double)(bug_num_max) + 0.00000000001); break;
        case 15: q->score += (double)((double)( q->edge_change_efficiency) + 0.00000000001)/((double)(edge_change_efficiency_max) + 0.00000000001); break;
        case 16: q->score += (double)((double)( exec_num_min) + 0.00000000001)/((double)(q->exec_num) + 0.00000000001); break;
        default: break;
      }
    }
  } 
}
static void calculate_case_score ( struct queue_entry * q , struct hash_map * hash_map_index ) { q -> score = 0.0 ; q -> mem_num = hash_map_index -> mem_num ; q -> bug_num = hash_map_index -> bug_num ; q -> func_num = hash_map_index -> func_num ; q -> global_num = hash_map_index -> global_num ; q -> untouch_num = hash_map_index -> untouch_num ; q -> global_assign_num = hash_map_index -> global_assign_num ; q -> bit_num = hash_map_index -> bit_num ; q -> loop_num = hash_map_index -> loop_num ; q -> cmp_const_num = hash_map_index -> cmp_const_num ; for ( u32 i_lh = 0 ; i_lh < TOP_NUM ; i_lh ++ ) { if ( good_top [ i_lh ] > 0 ) { switch ( i_lh ) { case 0 : q -> score += ( double ) ( ( double ) ( exec_us_min ) + 0.00000000001 ) / ( ( double ) ( q -> exec_us ) + 0.00000000001 ) ; break ; case 1 : q -> score += ( double ) ( ( double ) ( q -> exec_us ) + 0.00000000001 ) / ( ( double ) ( exec_us_max ) + 0.00000000001 ) ; break ; case 2 : q -> score += ( double ) ( ( double ) ( q -> len ) + 0.00000000001 ) / ( ( double ) ( len_max ) + 0.00000000001 ) ; break ; case 3 : q -> score += ( double ) ( ( double ) ( len_min ) + 0.00000000001 ) / ( ( double ) ( q -> len ) + 0.00000000001 ) ; break ; case 4 : q -> score += ( double ) ( ( double ) ( q -> bit_num ) + 0.00000000001 ) / ( ( double ) ( bit_num_max ) + 0.00000000001 ) ; break ; case 5 : q -> score += ( double ) ( ( double ) ( q -> interesting ) + 0.00000000001 ) / ( ( double ) ( interesting_max ) + 0.00000000001 ) ; break ; case 6 : q -> score += ( double ) ( ( double ) ( q -> cmp_const_num ) + 0.00000000001 ) / ( ( double ) ( cmp_const_num_max ) + 0.00000000001 ) ; break ; case 7 : q -> score += ( double ) ( ( double ) ( q -> untouch_num ) + 0.00000000001 ) / ( ( double ) ( untouch_num_max ) + 0.00000000001 ) ; break ; case 8 : q -> score += ( double ) ( ( double ) ( q -> mem_num ) + 0.00000000001 ) / ( ( double ) ( mem_num_max ) + 0.00000000001 ) ; break ; case 9 : q -> score += ( double ) ( ( double ) ( q -> depth ) + 0.00000000001 ) / ( ( double ) ( depth_max ) + 0.00000000001 ) ; break ; case 10 : q -> score += ( double ) ( ( double ) ( q -> func_num ) + 0.00000000001 ) / ( ( double ) ( func_num_max ) + 0.00000000001 ) ; break ; case 11 : q -> score += ( double ) ( ( double ) ( q -> loop_num ) + 0.00000000001 ) / ( ( double ) ( loop_num_max ) + 0.00000000001 ) ; break ; case 12 : q -> score += ( double ) ( ( double ) ( q -> global_num ) + 0.00000000001 ) / ( ( double ) ( global_num_max ) + 0.00000000001 ) ; break ; case 13 : q -> score += ( double ) ( ( double ) ( q -> global_assign_num ) + 0.00000000001 ) / ( ( double ) ( global_assign_num_max ) + 0.00000000001 ) ; break ; case 14 : q -> score += ( double ) ( ( double ) ( q -> bug_num ) + 0.00000000001 ) / ( ( double ) ( bug_num_max ) + 0.00000000001 ) ; break ; case 15 : q -> score += ( double ) ( ( double ) ( q -> edge_change_efficiency ) + 0.00000000001 ) / ( ( double ) ( edge_change_efficiency_max ) + 0.00000000001 ) ; break ; case 16 : q -> score += ( double ) ( ( double ) ( exec_num_min ) + 0.00000000001 ) / ( ( double ) ( q -> exec_num ) + 0.00000000001 ) ; break ; default : break ; } } } }
Calculate score for each case.
Calculate score for each case .