// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/shu-genomediff.c
// Function: genomediff_calculate_div
static void genomediff_calculate_div(GtShuUnitFileInfo *unit_info,
                                     double **div, double *gc_content,
                                     GtUword *genome_lengths,
                                     const GtGenomediffArguments *arguments,
                                     GtTimer *timer)
{
  double query_gc,
         query_shulen,
         *ln_n_fac;
  GtUword subject_len,
                i_idx, j_idx,
                subject, query;

  if (timer != NULL)
    gt_timer_show_progress(timer, "pre calculate ln_n_fac", stdout);

  ln_n_fac = gt_get_ln_n_fac(arguments->max_ln_n_fac);
  if (timer != NULL)
    gt_timer_show_progress(timer, "calculate divergence", stdout);
  for (i_idx = 0; i_idx < unit_info->num_of_genomes; i_idx++) {
    for (j_idx = i_idx+1; j_idx < unit_info->num_of_genomes; j_idx++) {
      /* query is the one with smaller avg shulen */
      if (gt_double_smaller_double(div[i_idx][j_idx], div[j_idx][i_idx])) {
        subject = j_idx;
        query = i_idx;
      }
      else if (gt_double_smaller_double(div[j_idx][i_idx], div[i_idx][j_idx])) {
          subject = i_idx;
          query = j_idx;
      }
      /* if avg shulen is equal, choose query with gc content farther from .5 */
      else {
        if (gt_double_smaller_double(fabs(gc_content[i_idx]-0.5),
                                     fabs(gc_content[j_idx]-0.5))) {
          subject = i_idx;
          query = j_idx;
        }
        else {
          subject = j_idx;
          query = i_idx;
        }
      }
      query_gc = gc_content[query];
      query_shulen = div[query][subject];
      subject_len = genome_lengths[subject];

      div[i_idx][j_idx] = gt_divergence(arguments->divergence_rel_err,
                                        arguments->divergence_abs_err,
                                        arguments->divergence_m,
                                        arguments->divergence_threshold,
                                        query_shulen,
                                        subject_len,
                                        query_gc,
                                        ln_n_fac,
                                        arguments->max_ln_n_fac);
      div[j_idx][i_idx] = div[i_idx][j_idx];
    }
  }
  gt_free(ln_n_fac);
}

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x70(%rsp)
movq %rsi, 0x68(%rsp)
movq %rdx, 0x60(%rsp)
movq %rcx, 0x58(%rsp)
movq %r8, 0x50(%rsp)
movq %r9, 0x48(%rsp)
cmpq $0x0, 0x48(%rsp)
je 0x2ed3a5
movq 0x48(%rsp), %rdi
movq 0x34eba2(%rip), %rax    # 0x63bf38
movq (%rax), %rdx
leaq 0x2a1828(%rip), %rsi    # 0x58ebc8
callq 0x121930
movq 0x50(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x4e73e0
movq %rax, 0x30(%rsp)
cmpq $0x0, 0x48(%rsp)
je 0x2ed3db
movq 0x48(%rsp), %rdi
movq 0x34eb6c(%rip), %rax    # 0x63bf38
movq (%rax), %rdx
leaq 0x2a1809(%rip), %rsi    # 0x58ebdf
callq 0x121930
movq $0x0, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq 0x70(%rsp), %rcx
cmpq (%rcx), %rax
jae 0x2ed647
movq 0x20(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq 0x70(%rsp), %rcx
cmpq (%rcx), %rax
jae 0x2ed632
movq 0x68(%rsp), %rax
movq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x18(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x68(%rsp), %rax
movq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x20(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
callq 0xec2f0
testb $0x1, %al
jne 0x2ed453
jmp 0x2ed46c
movq 0x18(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x8(%rsp)
jmp 0x2ed545
movq 0x68(%rsp), %rax
movq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x20(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x68(%rsp), %rax
movq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x18(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
callq 0xec2f0
testb $0x1, %al
jne 0x2ed4a7
jmp 0x2ed4c0
movq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
jmp 0x2ed543
movq 0x60(%rsp), %rax
movq 0x20(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd 0x239a31(%rip), %xmm1   # 0x526f08
subsd %xmm1, %xmm0
movaps 0x24ff6e(%rip), %xmm1   # 0x53d450
pand %xmm1, %xmm0
movq 0x60(%rsp), %rax
movq 0x18(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
movsd 0x239a0b(%rip), %xmm2   # 0x526f08
subsd %xmm2, %xmm1
movaps 0x24ff48(%rip), %xmm2   # 0x53d450
pand %xmm2, %xmm1
callq 0xec2f0
testb $0x1, %al
jne 0x2ed517
jmp 0x2ed52d
movq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
jmp 0x2ed541
movq 0x18(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x8(%rsp)
jmp 0x2ed543
jmp 0x2ed545
movq 0x60(%rsp), %rax
movq 0x8(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x40(%rsp)
movq 0x68(%rsp), %rax
movq 0x8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x10(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x38(%rsp)
movq 0x58(%rsp), %rax
movq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x28(%rsp)
movq 0x50(%rsp), %rax
movsd 0x28(%rax), %xmm0
movq 0x50(%rsp), %rax
movsd 0x18(%rax), %xmm1
movq 0x50(%rsp), %rax
movsd 0x20(%rax), %xmm2
movq 0x50(%rsp), %rax
movsd 0x30(%rax), %xmm3
movsd 0x38(%rsp), %xmm4
movq 0x28(%rsp), %rdi
movsd 0x40(%rsp), %xmm5
movq 0x30(%rsp), %rsi
movq 0x50(%rsp), %rax
movq 0x10(%rax), %rdx
callq 0x4e6fa0
movq 0x68(%rsp), %rax
movq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x18(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq 0x68(%rsp), %rax
movq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x18(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x68(%rsp), %rax
movq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x20(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq 0x18(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x18(%rsp)
jmp 0x2ed405
jmp 0x2ed634
movq 0x20(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x20(%rsp)
jmp 0x2ed3e4
movq 0x30(%rsp), %rdi
leaq 0x2a137b(%rip), %rsi    # 0x58e9ce
movl $0xe3, %edx
callq 0xe88c0
addq $0x78, %rsp
retq
nopw %cs:(%rax,%rax)