// File: /workspace/github_c_makefile_star2_O0/yhg926[P]public_kssd/command_composite.c
// Function: get_species_abundance
int get_species_abundance (composite_opt_t * composite_opt) {
 if ( composite_opt->refdir[0] == '\0' || composite_opt->qrydir[0] == '\0' || strcmp (composite_opt->refdir, composite_opt->qrydir) == 0 )
  err(errno, "get_species_abundance(): refdir or qrydir is not initialized\n" );
 const char *ref_dstat_fpath = test_get_fullpath(composite_opt->refdir,co_dstat);
 if (ref_dstat_fpath == NULL) err(errno,"cannot find %s under %s ",co_dstat, ref_dstat_fpath);
  const char *qry_dstat_fpath = test_get_fullpath(composite_opt->qrydir,co_dstat);
 if (qry_dstat_fpath == NULL) err(errno,"cannot find %s under %s ",co_dstat, qry_dstat_fpath);
 FILE *ref_dstat_fp, *qry_dstat_fp ;
 if( (ref_dstat_fp = fopen(ref_dstat_fpath,"rb")) == NULL ) err(errno, "get_species_abundance():%s",ref_dstat_fpath);
 if( (qry_dstat_fp = fopen(qry_dstat_fpath,"rb")) == NULL ) err(errno, "get_species_abundance():%s",qry_dstat_fpath);
 co_dstat_t ref_dstat, qry_dstat ;
 fread( &ref_dstat, sizeof(co_dstat_t),1,ref_dstat_fp);
 fread( &qry_dstat, sizeof(co_dstat_t),1,qry_dstat_fp);
 if(!qry_dstat.koc) err(errno, "get_species_abundance(): query has not abundance");
 if(qry_dstat.shuf_id != ref_dstat.shuf_id)
  printf("get_species_abundance(): qry shuf_id %u not match ref shuf_id: %u\n",qry_dstat.shuf_id, ref_dstat.shuf_id);
 ctx_obj_ct_t* tmp_ct_list = malloc(sizeof(ctx_obj_ct_t) * ref_dstat.infile_num);
  fread(tmp_ct_list,sizeof(ctx_obj_ct_t),ref_dstat.infile_num,ref_dstat_fp);
 char (*refname)[PATHLEN] = malloc(PATHLEN * ref_dstat.infile_num);
  fread(refname,PATHLEN,ref_dstat.infile_num,ref_dstat_fp);
  fread(tmp_ct_list,sizeof(ctx_obj_ct_t),qry_dstat.infile_num,qry_dstat_fp);
  free(tmp_ct_list);
  char (*qryname)[PATHLEN] = malloc(PATHLEN * qry_dstat.infile_num);
  fread(qryname,PATHLEN,qry_dstat.infile_num, qry_dstat_fp);
 char tmpfname[PATHLEN];
 struct stat tmpstat;
 FILE *tmpfp;
#define REALLOC_US 8
 ref_abund = (int **)malloc(ref_dstat.infile_num* sizeof(int *));
 for (int i = 0; i < ref_dstat.infile_num; i++) ref_abund[i] = (int *)malloc(REALLOC_US *sizeof(int));
 binVec_t* binVec = malloc(ref_dstat.infile_num* sizeof(binVec_t));
 for(int qn = 0; qn < qry_dstat.infile_num; qn++) {
  for (int i = 0; i < ref_dstat.infile_num; i++) ref_abund[i][0] = 0 ;
  for(int c = 0; c < ref_dstat.comp_num; c++){
   sprintf(tmpfname,"%s/%s.%d",composite_opt->refdir,skch_prefix,c);
   if( (tmpfp = fopen(tmpfname,"rb"))==NULL) err(errno,"get_species_abundance():%s",tmpfname);
   stat(tmpfname, &tmpstat);
   unsigned int *ref_combco = malloc(tmpstat.st_size);
   fread(ref_combco, tmpstat.st_size, 1, tmpfp);
   fclose(tmpfp);
   sprintf(tmpfname,"%s/%s.%d",composite_opt->refdir,idx_prefix,c);
   if( (tmpfp = fopen(tmpfname,"rb"))==NULL) err(errno,"get_species_abundance():%s",tmpfname);
   stat(tmpfname, &tmpstat);
   size_t *ref_index_combco = malloc(tmpstat.st_size);
   fread(ref_index_combco,tmpstat.st_size, 1, tmpfp);
   fclose(tmpfp);
   sprintf(tmpfname,"%s/%s.%d",composite_opt->qrydir,skch_prefix,c);
   if( (tmpfp = fopen(tmpfname,"rb"))==NULL) err(errno,"get_species_abundance():%s",tmpfname);
   stat(tmpfname, &tmpstat);
   unsigned int *qry_combco = malloc(tmpstat.st_size);
   fread(qry_combco, tmpstat.st_size, 1, tmpfp);
   fclose(tmpfp);
     sprintf(tmpfname,"%s/%s.%d",composite_opt->qrydir,idx_prefix,c);
     if( (tmpfp = fopen(tmpfname,"rb"))==NULL) err(errno,"get_species_abundance():%s",tmpfname);
     stat(tmpfname, &tmpstat);
     size_t *qry_index_combco = malloc(tmpstat.st_size);
     fread(qry_index_combco,tmpstat.st_size, 1, tmpfp);
     fclose(tmpfp);
   sprintf(tmpfname,"%s/%s.%d.a",composite_opt->qrydir,skch_prefix,c);
   if( (tmpfp = fopen(tmpfname,"rb"))==NULL) err(errno,"get_species_abundance():%s",tmpfname);
   stat(tmpfname, &tmpstat);
   unsigned short* qry_abund = malloc(tmpstat.st_size);
   fread(qry_abund, tmpstat.st_size, 1, tmpfp);
   fclose(tmpfp);
   int hash_sz = nextPrime( (int)((double)(qry_index_combco[qn+1] - qry_index_combco[qn]) / LD_FCTR) );
   size_t *km2abund_idx = calloc( hash_sz, sizeof(size_t) ) ;
   for (size_t idx = qry_index_combco[qn] ; idx < qry_index_combco[qn+1]; idx++){
    for(int i = 0; i< hash_sz; i++){
     unsigned int tmphv = HASH(qry_combco[idx],i, hash_sz);
     if(km2abund_idx[tmphv] == 0) {
      km2abund_idx[tmphv] = idx + 1;
      break;
     }
    }
   }
#pragma omp parallel for num_threads(composite_opt->p) schedule(guided)
   for(int rn = 0; rn < ref_dstat.infile_num; rn++) {
    for( size_t ri = ref_index_combco[rn]; ri < ref_index_combco[rn+1]; ri++){
     for (int i = 0; i< hash_sz; i++) {
      unsigned int hv = HASH(ref_combco[ri],i, hash_sz);
      if(km2abund_idx[hv] == 0) break;
      else if( qry_combco[km2abund_idx[hv] - 1] == ref_combco[ri] ){
       ref_abund[rn][0]++;
       ref_abund[rn][ref_abund[rn][0]] = qry_abund[km2abund_idx[hv] - 1];
       if (ref_abund[rn][0] % REALLOC_US == REALLOC_US - 1) {
              int newsize = ( (ref_abund[rn][0] / REALLOC_US) + 2 ) * REALLOC_US ;
              ref_abund[rn] = (int*)realloc( ref_abund[rn] , newsize * sizeof(int) );
       }
       break;
      }
     }
    }
   }
   free(km2abund_idx);
   free(ref_combco);
   free(ref_index_combco);
    free(qry_combco);
     free(qry_index_combco);
   free(qry_abund);
  }
#ifndef MIN_KM_S
#define MIN_KM_S 6
#endif
#define ST_PCTL (0.98)
#define ED_PCTL (0.99)
  int *sort_ref = malloc(ref_dstat.infile_num* sizeof(int));
   for(int i = 0; i< ref_dstat.infile_num; i++) sort_ref[i] = i;
  qsort(sort_ref, ref_dstat.infile_num, sizeof(sort_ref[0]), comparator_idx);
  if(composite_opt->b){
   if(strlen(composite_opt->outdir) < 3)
    sprintf(tmpfname,"%s/%s",composite_opt->refdir,binVec_dirname);
   else strcpy(tmpfname,composite_opt->outdir);
   mkdir(tmpfname,0777);
   sprintf(tmpfname,"%s/%s.%s",tmpfname,basename(qryname[qn]),binVec_suffix);
   if( (tmpfp = fopen(tmpfname,"wb"))==NULL) err(errno,"get_species_abundance():%s",tmpfname);
  }
  int num_pass = 0;
  float binVecsum = 0;
  for ( int i = 0; i< ref_dstat.infile_num; i++ ){
   int kmer_num = ref_abund[sort_ref[i]][0];
   if (kmer_num < MIN_KM_S) break;
   qsort(ref_abund[sort_ref[i]] + 1, kmer_num, sizeof(int),comparator);
   int sum = 0;
   for(int n = 1; n <= kmer_num; n++) sum += ref_abund[sort_ref[i]][n];
   int median_idx = kmer_num /2;
   int pct09_idx = kmer_num * ST_PCTL ;
   int lastsum = 0; int lastn = 0;
      for(int n = pct09_idx ; n <= kmer_num*ED_PCTL; n++) {
    lastsum += ref_abund[sort_ref[i]][n];
    lastn++;
   }
   if(composite_opt->b){
    if (ref_abund[sort_ref[i]][median_idx] > 1 && kmer_num > MIN_KM_S + 1){
     binVec[num_pass].ref_idx = sort_ref[i];
     binVec[num_pass].pct = (float)lastsum/lastn;
     binVecsum += binVec[num_pass].pct;
     num_pass++;
    }
   }
   else{
    printf("%s\t%s\t%d\t%f\t%f\t%d\t%d\n",qryname[qn],refname[sort_ref[i]], kmer_num, (float)sum/kmer_num,(float)lastsum/lastn,ref_abund[sort_ref[i]][median_idx], ref_abund[sort_ref[i]][kmer_num]);
   }
  }
  if(composite_opt->b){
   for(int i = 0; i< num_pass;i++){
    binVec[i].pct = ( binVec[i].pct - 1)*100/(binVecsum - num_pass) ;
   }
   fwrite(binVec,sizeof(binVec_t),num_pass,tmpfp);
   fclose(tmpfp);
  }
  free(sort_ref);
 }
 for (int i = 0; i < ref_dstat.infile_num; i++) free(ref_abund[i]);
  free(ref_abund) ;
 free(binVec);
 free(refname);
 free(qryname);
 return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x300, %rsp            # imm = 0x300
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movsbl 0x14(%rax), %eax
cmpl $0x0, %eax
je 0x4fd9
movq -0x8(%rbp), %rax
movsbl 0x114(%rax), %eax
cmpl $0x0, %eax
je 0x4fd9
movq -0x8(%rbp), %rdi
addq $0x14, %rdi
movq -0x8(%rbp), %rsi
addq $0x114, %rsi            # imm = 0x114
callq 0x3280
cmpl $0x0, %eax
jne 0x4fee
callq 0x3050
movl (%rax), %edi
leaq 0x173c2(%rip), %rsi     # 0x1c3a9
movb $0x0, %al
callq 0x3300
movq -0x8(%rbp), %rdi
addq $0x14, %rdi
leaq 0x176f3(%rip), %rsi     # 0x1c6f0
callq 0x8250
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x502d
callq 0x3050
movl (%rax), %edi
movq -0x10(%rbp), %rcx
leaq 0x17360(%rip), %rsi     # 0x1c37f
leaq 0x176ca(%rip), %rdx     # 0x1c6f0
movb $0x0, %al
callq 0x3300
movq -0x8(%rbp), %rdi
addq $0x114, %rdi            # imm = 0x114
leaq 0x176b1(%rip), %rsi     # 0x1c6f0
callq 0x8250
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x506f
callq 0x3050
movl (%rax), %edi
movq -0x18(%rbp), %rcx
leaq 0x1731e(%rip), %rsi     # 0x1c37f
leaq 0x17688(%rip), %rdx     # 0x1c6f0
movb $0x0, %al
callq 0x3300
movq -0x10(%rbp), %rdi
leaq 0x16fdd(%rip), %rsi     # 0x1c057
callq 0x3370
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0x50a2
callq 0x3050
movl (%rax), %edi
movq -0x10(%rbp), %rdx
leaq 0x1734c(%rip), %rsi     # 0x1c3e7
movb $0x0, %al
callq 0x3300
movq -0x18(%rbp), %rdi
leaq 0x16faa(%rip), %rsi     # 0x1c057
callq 0x3370
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x50d5
callq 0x3050
movl (%rax), %edi
movq -0x18(%rbp), %rdx
leaq 0x17319(%rip), %rsi     # 0x1c3e7
movb $0x0, %al
callq 0x3300
movq -0x20(%rbp), %rcx
leaq -0x48(%rbp), %rdi
movl $0x20, %esi
movl $0x1, %edx
callq 0x30a0
movq -0x28(%rbp), %rcx
leaq -0x68(%rbp), %rdi
movl $0x20, %esi
movl $0x1, %edx
callq 0x30a0
testb $0x1, -0x64(%rbp)
jne 0x511e
callq 0x3050
movl (%rax), %edi
leaq 0x172eb(%rip), %rsi     # 0x1c402
movb $0x0, %al
callq 0x3300
movl -0x68(%rbp), %eax
cmpl -0x48(%rbp), %eax
je 0x513a
movl -0x68(%rbp), %esi
movl -0x48(%rbp), %edx
leaq 0x17300(%rip), %rdi     # 0x1c433
movb $0x0, %al
callq 0x3150
movslq -0x34(%rbp), %rdi
shlq $0x2, %rdi
callq 0x3310
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
movslq -0x34(%rbp), %rdx
movq -0x20(%rbp), %rcx
movl $0x4, %esi
callq 0x30a0
movl -0x34(%rbp), %eax
shll $0x8, %eax
movslq %eax, %rdi
callq 0x3310
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rdi
movslq -0x34(%rbp), %rdx
movq -0x20(%rbp), %rcx
movl $0x100, %esi            # imm = 0x100
callq 0x30a0
movq -0x70(%rbp), %rdi
movslq -0x54(%rbp), %rdx
movq -0x28(%rbp), %rcx
movl $0x4, %esi
callq 0x30a0
movq -0x70(%rbp), %rdi
callq 0x3040
movl -0x54(%rbp), %eax
shll $0x8, %eax
movslq %eax, %rdi
callq 0x3310
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rdi
movslq -0x54(%rbp), %rdx
movq -0x28(%rbp), %rcx
movl $0x100, %esi            # imm = 0x100
callq 0x30a0
movslq -0x34(%rbp), %rdi
shlq $0x3, %rdi
callq 0x3310
movq %rax, 0x1f2dc(%rip)     # 0x244c0
movl $0x0, -0x21c(%rbp)
movl -0x21c(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x5229
movl $0x20, %edi
callq 0x3310
movq %rax, %rdx
movq 0x1f2b3(%rip), %rax     # 0x244c0
movslq -0x21c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x21c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x21c(%rbp)
jmp 0x51ee
movslq -0x34(%rbp), %rdi
shlq $0x3, %rdi
callq 0x3310
movq %rax, -0x228(%rbp)
movl $0x0, -0x22c(%rbp)
movl -0x22c(%rbp), %eax
cmpl -0x54(%rbp), %eax
jge 0x6037
movl $0x0, -0x230(%rbp)
movl -0x230(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x5294
movq 0x1f24e(%rip), %rax     # 0x244c0
movslq -0x230(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl $0x0, (%rax)
movl -0x230(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x230(%rbp)
jmp 0x5260
movl $0x0, -0x234(%rbp)
movl -0x234(%rbp), %eax
cmpl -0x38(%rbp), %eax
jge 0x5a83
leaq -0x180(%rbp), %rdi
movq -0x8(%rbp), %rdx
addq $0x14, %rdx
movl -0x234(%rbp), %r8d
leaq 0x16d84(%rip), %rsi     # 0x1c04e
leaq 0x19188(%rip), %rcx     # 0x1e459
movb $0x0, %al
callq 0x3400
leaq -0x180(%rbp), %rdi
leaq 0x16d71(%rip), %rsi     # 0x1c057
callq 0x3370
movq %rax, -0x218(%rbp)
cmpq $0x0, %rax
jne 0x5314
callq 0x3050
movl (%rax), %edi
leaq -0x180(%rbp), %rdx
leaq 0x170da(%rip), %rsi     # 0x1c3e7
movb $0x0, %al
callq 0x3300
leaq -0x180(%rbp), %rdi
leaq -0x210(%rbp), %rsi
callq 0x32b0
movq -0x1e0(%rbp), %rdi
callq 0x3310
movq %rax, -0x240(%rbp)
movq -0x240(%rbp), %rdi
movq -0x1e0(%rbp), %rsi
movq -0x218(%rbp), %rcx
movl $0x1, %edx
callq 0x30a0
movq -0x218(%rbp), %rdi
callq 0x30e0
leaq -0x180(%rbp), %rdi
movq -0x8(%rbp), %rdx
addq $0x14, %rdx
movl -0x234(%rbp), %r8d
leaq 0x16ccc(%rip), %rsi     # 0x1c04e
leaq 0x190d7(%rip), %rcx     # 0x1e460
movb $0x0, %al
callq 0x3400
leaq -0x180(%rbp), %rdi
leaq 0x16cb9(%rip), %rsi     # 0x1c057
callq 0x3370
movq %rax, -0x218(%rbp)
cmpq $0x0, %rax
jne 0x53cc
callq 0x3050
movl (%rax), %edi
leaq -0x180(%rbp), %rdx
leaq 0x17022(%rip), %rsi     # 0x1c3e7
movb $0x0, %al
callq 0x3300
leaq -0x180(%rbp), %rdi
leaq -0x210(%rbp), %rsi
callq 0x32b0
movq -0x1e0(%rbp), %rdi
callq 0x3310
movq %rax, -0x248(%rbp)
movq -0x248(%rbp), %rdi
movq -0x1e0(%rbp), %rsi
movq -0x218(%rbp), %rcx
movl $0x1, %edx
callq 0x30a0
movq -0x218(%rbp), %rdi
callq 0x30e0
leaq -0x180(%rbp), %rdi
movq -0x8(%rbp), %rdx
addq $0x114, %rdx            # imm = 0x114
movl -0x234(%rbp), %r8d
leaq 0x16c11(%rip), %rsi     # 0x1c04e
leaq 0x19015(%rip), %rcx     # 0x1e459
movb $0x0, %al
callq 0x3400
leaq -0x180(%rbp), %rdi
leaq 0x16bfe(%rip), %rsi     # 0x1c057
callq 0x3370
movq %rax, -0x218(%rbp)
cmpq $0x0, %rax
jne 0x5487
callq 0x3050
movl (%rax), %edi
leaq -0x180(%rbp), %rdx
leaq 0x16f67(%rip), %rsi     # 0x1c3e7
movb $0x0, %al
callq 0x3300
leaq -0x180(%rbp), %rdi
leaq -0x210(%rbp), %rsi
callq 0x32b0
movq -0x1e0(%rbp), %rdi
callq 0x3310
movq %rax, -0x250(%rbp)
movq -0x250(%rbp), %rdi
movq -0x1e0(%rbp), %rsi
movq -0x218(%rbp), %rcx
movl $0x1, %edx
callq 0x30a0
movq -0x218(%rbp), %rdi
callq 0x30e0
leaq -0x180(%rbp), %rdi
movq -0x8(%rbp), %rdx
addq $0x114, %rdx            # imm = 0x114
movl -0x234(%rbp), %r8d
leaq 0x16b56(%rip), %rsi     # 0x1c04e
leaq 0x18f61(%rip), %rcx     # 0x1e460
movb $0x0, %al
callq 0x3400
leaq -0x180(%rbp), %rdi
leaq 0x16b43(%rip), %rsi     # 0x1c057
callq 0x3370
movq %rax, -0x218(%rbp)
cmpq $0x0, %rax
jne 0x5542
callq 0x3050
movl (%rax), %edi
leaq -0x180(%rbp), %rdx
leaq 0x16eac(%rip), %rsi     # 0x1c3e7
movb $0x0, %al
callq 0x3300
leaq -0x180(%rbp), %rdi
leaq -0x210(%rbp), %rsi
callq 0x32b0
movq -0x1e0(%rbp), %rdi
callq 0x3310
movq %rax, -0x258(%rbp)
movq -0x258(%rbp), %rdi
movq -0x1e0(%rbp), %rsi
movq -0x218(%rbp), %rcx
movl $0x1, %edx
callq 0x30a0
movq -0x218(%rbp), %rdi
callq 0x30e0
leaq -0x180(%rbp), %rdi
movq -0x8(%rbp), %rdx
addq $0x114, %rdx            # imm = 0x114
movl -0x234(%rbp), %r8d
leaq 0x16ec3(%rip), %rsi     # 0x1c476
leaq 0x18e9f(%rip), %rcx     # 0x1e459
movb $0x0, %al
callq 0x3400
leaq -0x180(%rbp), %rdi
leaq 0x16a88(%rip), %rsi     # 0x1c057
callq 0x3370
movq %rax, -0x218(%rbp)
cmpq $0x0, %rax
jne 0x55fd
callq 0x3050
movl (%rax), %edi
leaq -0x180(%rbp), %rdx
leaq 0x16df1(%rip), %rsi     # 0x1c3e7
movb $0x0, %al
callq 0x3300
leaq -0x180(%rbp), %rdi
leaq -0x210(%rbp), %rsi
callq 0x32b0
movq -0x1e0(%rbp), %rdi
callq 0x3310
movq %rax, -0x260(%rbp)
movq -0x260(%rbp), %rdi
movq -0x1e0(%rbp), %rsi
movq -0x218(%rbp), %rcx
movl $0x1, %edx
callq 0x30a0
movq -0x218(%rbp), %rdi
callq 0x30e0
movq -0x258(%rbp), %rax
movslq -0x22c(%rbp), %rdx
movq (%rax,%rdx,8), %rcx
movq 0x8(%rax,%rdx,8), %rax
subq %rcx, %rax
movq %rax, %xmm0
movaps 0x169ac(%rip), %xmm1    # 0x1c020
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x169b0(%rip), %xmm1    # 0x1c030
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0x16b41(%rip), %xmm1    # 0x1c1d8
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %edi
callq 0x17c70
movl %eax, -0x264(%rbp)
movslq -0x264(%rbp), %rdi
movl $0x8, %esi
callq 0x3270
movq %rax, -0x270(%rbp)
movq -0x258(%rbp), %rax
movslq -0x22c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x278(%rbp)
movq -0x278(%rbp), %rax
movq -0x258(%rbp), %rcx
movl -0x22c(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
cmpq (%rcx,%rdx,8), %rax
jae 0x57db
movl $0x0, -0x27c(%rbp)
movl -0x27c(%rbp), %eax
cmpl -0x264(%rbp), %eax
jge 0x57c2
movq -0x250(%rbp), %rax
movq -0x278(%rbp), %rcx
movl (%rax,%rcx,4), %eax
xorl %edx, %edx
divl -0x264(%rbp)
movl %edx, -0x2e4(%rbp)
movl -0x27c(%rbp), %ecx
movq -0x250(%rbp), %rax
movq -0x278(%rbp), %rdx
movl (%rax,%rdx,4), %eax
movl -0x264(%rbp), %esi
subl $0x1, %esi
xorl %edx, %edx
divl %esi
movl -0x2e4(%rbp), %eax
addl $0x1, %edx
imull %edx, %ecx
addl %ecx, %eax
xorl %edx, %edx
divl -0x264(%rbp)
movl %edx, -0x280(%rbp)
movq -0x270(%rbp), %rax
movl -0x280(%rbp), %ecx
cmpq $0x0, (%rax,%rcx,8)
jne 0x57ac
movq -0x278(%rbp), %rdx
addq $0x1, %rdx
movq -0x270(%rbp), %rax
movl -0x280(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
jmp 0x57c2
jmp 0x57ae
movl -0x27c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x27c(%rbp)
jmp 0x5709
jmp 0x57c4
movq -0x278(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x278(%rbp)
jmp 0x56db
movl $0x0, -0x284(%rbp)
movl -0x284(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x5a27
movq -0x248(%rbp), %rax
movslq -0x284(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x290(%rbp)
movq -0x290(%rbp), %rax
movq -0x248(%rbp), %rcx
movl -0x284(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
cmpq (%rcx,%rdx,8), %rax
jae 0x5a11
movl $0x0, -0x294(%rbp)
movl -0x294(%rbp), %eax
cmpl -0x264(%rbp), %eax
jge 0x59f8
movq -0x240(%rbp), %rax
movq -0x290(%rbp), %rcx
movl (%rax,%rcx,4), %eax
xorl %edx, %edx
divl -0x264(%rbp)
movl %edx, -0x2e8(%rbp)
movl -0x294(%rbp), %ecx
movq -0x240(%rbp), %rax
movq -0x290(%rbp), %rdx
movl (%rax,%rdx,4), %eax
movl -0x264(%rbp), %esi
subl $0x1, %esi
xorl %edx, %edx
divl %esi
movl -0x2e8(%rbp), %eax
addl $0x1, %edx
imull %edx, %ecx
addl %ecx, %eax
xorl %edx, %edx
divl -0x264(%rbp)
movl %edx, -0x298(%rbp)
movq -0x270(%rbp), %rax
movl -0x298(%rbp), %ecx
cmpq $0x0, (%rax,%rcx,8)
jne 0x58c5
jmp 0x59f8
movq -0x250(%rbp), %rax
movq -0x270(%rbp), %rcx
movl -0x298(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
subq $0x1, %rcx
movl (%rax,%rcx,4), %eax
movq -0x240(%rbp), %rcx
movq -0x290(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0x59e0
movq 0x1ebbe(%rip), %rax     # 0x244c0
movslq -0x284(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq -0x260(%rbp), %rax
movq -0x270(%rbp), %rcx
movl -0x298(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
subq $0x1, %rcx
movzwl (%rax,%rcx,2), %edx
movq 0x1eb85(%rip), %rax     # 0x244c0
movslq -0x284(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x1eb73(%rip), %rcx     # 0x244c0
movslq -0x284(%rbp), %rsi
movq (%rcx,%rsi,8), %rcx
movslq (%rcx), %rcx
movl %edx, (%rax,%rcx,4)
movq 0x1eb5b(%rip), %rax     # 0x244c0
movslq -0x284(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %eax
movl $0x8, %ecx
cltd
idivl %ecx
cmpl $0x7, %edx
jne 0x59de
movq 0x1eb3a(%rip), %rax     # 0x244c0
movslq -0x284(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %eax
movl $0x8, %ecx
cltd
idivl %ecx
addl $0x2, %eax
shll $0x3, %eax
movl %eax, -0x29c(%rbp)
movq 0x1eb12(%rip), %rax     # 0x244c0
movslq -0x284(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movslq -0x29c(%rbp), %rsi
shlq $0x2, %rsi
callq 0x3320
movq %rax, %rdx
movq 0x1eaed(%rip), %rax     # 0x244c0
movslq -0x284(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x59f8
jmp 0x59e2
jmp 0x59e4
movl -0x294(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x294(%rbp)
jmp 0x583b
jmp 0x59fa
movq -0x290(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x290(%rbp)
jmp 0x580d
jmp 0x5a13
movl -0x284(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x284(%rbp)
jmp 0x57e5
movq -0x270(%rbp), %rdi
callq 0x3040
movq -0x240(%rbp), %rdi
callq 0x3040
movq -0x248(%rbp), %rdi
callq 0x3040
movq -0x250(%rbp), %rdi
callq 0x3040
movq -0x258(%rbp), %rdi
callq 0x3040
movq -0x260(%rbp), %rdi
callq 0x3040
movl -0x234(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x234(%rbp)
jmp 0x529e
movslq -0x34(%rbp), %rdi
shlq $0x2, %rdi
callq 0x3310
movq %rax, -0x2a8(%rbp)
movl $0x0, -0x2ac(%rbp)
movl -0x2ac(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x5ad4
movl -0x2ac(%rbp), %edx
movq -0x2a8(%rbp), %rax
movslq -0x2ac(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x2ac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2ac(%rbp)
jmp 0x5aa1
movq -0x2a8(%rbp), %rdi
movslq -0x34(%rbp), %rsi
movl $0x4, %edx
leaq 0x1b45(%rip), %rcx      # 0x7630
callq 0x3090
movq -0x8(%rbp), %rax
cmpl $0x0, (%rax)
je 0x5bf8
movq -0x8(%rbp), %rdi
addq $0x214, %rdi            # imm = 0x214
callq 0x3110
cmpq $0x3, %rax
jae 0x5b39
leaq -0x180(%rbp), %rdi
movq -0x8(%rbp), %rdx
addq $0x14, %rdx
leaq 0x16802(%rip), %rsi     # 0x1c32b
leaq 0x166e2(%rip), %rcx     # 0x1c212
movb $0x0, %al
callq 0x3400
jmp 0x5b50
leaq -0x180(%rbp), %rdi
movq -0x8(%rbp), %rsi
addq $0x214, %rsi            # imm = 0x214
callq 0x3070
leaq -0x180(%rbp), %rdi
movl $0x1ff, %esi            # imm = 0x1FF
callq 0x3080
leaq -0x180(%rbp), %rax
movq %rax, -0x2f8(%rbp)
leaq -0x180(%rbp), %rax
movq %rax, -0x2f0(%rbp)
movq -0x80(%rbp), %rdi
movslq -0x22c(%rbp), %rax
shlq $0x8, %rax
addq %rax, %rdi
callq 0x32d0
movq -0x2f8(%rbp), %rdi
movq -0x2f0(%rbp), %rdx
movq %rax, %rcx
leaq 0x16763(%rip), %rsi     # 0x1c30f
leaq 0x1664d(%rip), %r8      # 0x1c200
movb $0x0, %al
callq 0x3400
leaq -0x180(%rbp), %rdi
leaq 0x16492(%rip), %rsi     # 0x1c05a
callq 0x3370
movq %rax, -0x218(%rbp)
cmpq $0x0, %rax
jne 0x5bf6
callq 0x3050
movl (%rax), %edi
leaq -0x180(%rbp), %rdx
leaq 0x167f8(%rip), %rsi     # 0x1c3e7
movb $0x0, %al
callq 0x3300
jmp 0x5bf8
movl $0x0, -0x2b0(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x2b4(%rbp)
movl $0x0, -0x2b8(%rbp)
movl -0x2b8(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x5f5e
movq 0x1e893(%rip), %rax     # 0x244c0
movq -0x2a8(%rbp), %rcx
movslq -0x2b8(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movq (%rax,%rcx,8), %rax
movl (%rax), %eax
movl %eax, -0x2bc(%rbp)
cmpl $0x6, -0x2bc(%rbp)
jge 0x5c59
jmp 0x5f5e
movq 0x1e860(%rip), %rax     # 0x244c0
movq -0x2a8(%rbp), %rcx
movslq -0x2b8(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movq (%rax,%rcx,8), %rdi
addq $0x4, %rdi
movslq -0x2bc(%rbp), %rsi
movl $0x4, %edx
leaq 0x19e3(%rip), %rcx      # 0x7670
callq 0x3090
movl $0x0, -0x2c0(%rbp)
movl $0x1, -0x2c4(%rbp)
movl -0x2c4(%rbp), %eax
cmpl -0x2bc(%rbp), %eax
jg 0x5cf8
movq 0x1e805(%rip), %rax     # 0x244c0
movq -0x2a8(%rbp), %rcx
movslq -0x2b8(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2c4(%rbp), %rcx
movl (%rax,%rcx,4), %eax
addl -0x2c0(%rbp), %eax
movl %eax, -0x2c0(%rbp)
movl -0x2c4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c4(%rbp)
jmp 0x5ca6
movl -0x2bc(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x2c8(%rbp)
cvtsi2sdl -0x2bc(%rbp), %xmm0
movsd 0x164ac(%rip), %xmm1    # 0x1c1c8
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x2cc(%rbp)
movl $0x0, -0x2d0(%rbp)
movl $0x0, -0x2d4(%rbp)
movl -0x2cc(%rbp), %eax
movl %eax, -0x2d8(%rbp)
cvtsi2sdl -0x2d8(%rbp), %xmm1
cvtsi2sdl -0x2bc(%rbp), %xmm0
movsd 0x1646e(%rip), %xmm2    # 0x1c1d0
mulsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jb 0x5dbf
movq 0x1e74d(%rip), %rax     # 0x244c0
movq -0x2a8(%rbp), %rcx
movslq -0x2b8(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2d8(%rbp), %rcx
movl (%rax,%rcx,4), %eax
addl -0x2d0(%rbp), %eax
movl %eax, -0x2d0(%rbp)
movl -0x2d4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2d4(%rbp)
movl -0x2d8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2d8(%rbp)
jmp 0x5d4a
movq -0x8(%rbp), %rax
cmpl $0x0, (%rax)
je 0x5e85
movq 0x1e6ed(%rip), %rax     # 0x244c0
movq -0x2a8(%rbp), %rcx
movslq -0x2b8(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x2c8(%rbp), %rcx
cmpl $0x1, (%rax,%rcx,4)
jle 0x5e80
cmpl $0x7, -0x2bc(%rbp)
jle 0x5e80
movq -0x2a8(%rbp), %rax
movslq -0x2b8(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x228(%rbp), %rax
movslq -0x2b0(%rbp), %rcx
movl %edx, (%rax,%rcx,8)
cvtsi2ssl -0x2d0(%rbp), %xmm0
cvtsi2ssl -0x2d4(%rbp), %xmm1
divss %xmm1, %xmm0
movq -0x228(%rbp), %rax
movslq -0x2b0(%rbp), %rcx
movss %xmm0, 0x4(%rax,%rcx,8)
movq -0x228(%rbp), %rax
movslq -0x2b0(%rbp), %rcx
movss 0x4(%rax,%rcx,8), %xmm0
addss -0x2b4(%rbp), %xmm0
movss %xmm0, -0x2b4(%rbp)
movl -0x2b0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2b0(%rbp)
jmp 0x5f48
movq -0x80(%rbp), %rsi
movslq -0x22c(%rbp), %rax
shlq $0x8, %rax
addq %rax, %rsi
movq -0x78(%rbp), %rdx
movq -0x2a8(%rbp), %rax
movslq -0x2b8(%rbp), %rcx
movslq (%rax,%rcx,4), %rax
shlq $0x8, %rax
addq %rax, %rdx
movl -0x2bc(%rbp), %ecx
cvtsi2ssl -0x2c0(%rbp), %xmm0
cvtsi2ssl -0x2bc(%rbp), %xmm1
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
cvtsi2ssl -0x2d0(%rbp), %xmm1
cvtsi2ssl -0x2d4(%rbp), %xmm2
divss %xmm2, %xmm1
cvtss2sd %xmm1, %xmm1
movq 0x1e5cf(%rip), %rax     # 0x244c0
movq -0x2a8(%rbp), %rdi
movslq -0x2b8(%rbp), %r8
movslq (%rdi,%r8,4), %rdi
movq (%rax,%rdi,8), %rax
movslq -0x2c8(%rbp), %rdi
movl (%rax,%rdi,4), %r8d
movq 0x1e5a7(%rip), %rax     # 0x244c0
movq -0x2a8(%rbp), %rdi
movslq -0x2b8(%rbp), %r9
movslq (%rdi,%r9,4), %rdi
movq (%rax,%rdi,8), %rax
movslq -0x2bc(%rbp), %rdi
movl (%rax,%rdi,4), %r9d
leaq 0x16540(%rip), %rdi     # 0x1c481
movb $0x2, %al
callq 0x3150
jmp 0x5f4a
movl -0x2b8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2b8(%rbp)
jmp 0x5c17
movq -0x8(%rbp), %rax
cmpl $0x0, (%rax)
je 0x6017
movl $0x0, -0x2dc(%rbp)
movl -0x2dc(%rbp), %eax
cmpl -0x2b0(%rbp), %eax
jge 0x5fec
movq -0x228(%rbp), %rax
movslq -0x2dc(%rbp), %rcx
movss 0x4(%rax,%rcx,8), %xmm0
movss 0x16245(%rip), %xmm1    # 0x1c1e4
subss %xmm1, %xmm0
movss 0x16235(%rip), %xmm1    # 0x1c1e0
mulss %xmm1, %xmm0
movss -0x2b4(%rbp), %xmm1
cvtsi2ssl -0x2b0(%rbp), %xmm2
subss %xmm2, %xmm1
divss %xmm1, %xmm0
movq -0x228(%rbp), %rax
movslq -0x2dc(%rbp), %rcx
movss %xmm0, 0x4(%rax,%rcx,8)
movl -0x2dc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2dc(%rbp)
jmp 0x5f75
movq -0x228(%rbp), %rdi
movslq -0x2b0(%rbp), %rdx
movq -0x218(%rbp), %rcx
movl $0x8, %esi
callq 0x3420
movq -0x218(%rbp), %rdi
callq 0x30e0
movq -0x2a8(%rbp), %rdi
callq 0x3040
movl -0x22c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x22c(%rbp)
jmp 0x5247
movl $0x0, -0x2e0(%rbp)
movl -0x2e0(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x6074
movq 0x1e46d(%rip), %rax     # 0x244c0
movslq -0x2e0(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3040
movl -0x2e0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2e0(%rbp)
jmp 0x6041
movq 0x1e445(%rip), %rdi     # 0x244c0
callq 0x3040
movq -0x228(%rbp), %rdi
callq 0x3040
movq -0x78(%rbp), %rdi
callq 0x3040
movq -0x80(%rbp), %rdi
callq 0x3040
movl $0x1, %eax
addq $0x300, %rsp            # imm = 0x300
popq %rbp
retq
nopl (%rax)