// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/match/shu-genomediff.c
// Function: gt_genomediff_calculate_div_from_avg
int gt_genomediff_calculate_div_from_avg(double **avgshu,
                                         const GtGenomediffArguments *arguments,
                                         GtShuUnitFileInfo *unit_info,
                                         GtLogger *logger,
                                         GtTimer *timer,
                                         GtError *err)
{
  int had_err = 0;
  const GtAlphabet *alphabet;
  double *gc_content = NULL;
  GtUword i_idx, j_idx;
  GtUword *genome_lengths = NULL;

  genome_lengths = genomediff_calculate_genome_lengths(unit_info);

  /*get alphabet and check if alphabet is dna, which is presumed for
    gc-calculation*/
  alphabet = gt_encseq_alphabet(unit_info->encseq);
  if (!gt_alphabet_is_dna(alphabet)) {
    gt_error_set(err,"error: sequences need to be dna to calculate gc!");
    had_err = -1;
  }

  if (!had_err && timer != NULL)
    gt_timer_show_progress(timer, "calculate gc", stdout);
  if (!had_err) {
    gc_content = genomediff_calculate_gc(genome_lengths, unit_info, err);
    if (gc_content == NULL)
      had_err = -1;
  }

    /* calculation of divergence */
  if (!had_err) {
    genomediff_calculate_div(unit_info, avgshu, gc_content, genome_lengths,
                             arguments, timer);

    if (gt_logger_enabled(logger)) {
      gt_logger_log(logger, "table of divergences");
      genomediff_print_table(avgshu, unit_info);
    }
  }

  if (!had_err && timer != NULL)
    gt_timer_show_progress(timer, "calculate kr", stdout);

  if (!had_err) {
    gt_logger_log(logger, "# Table of Kr");
    printf(""GT_WU"\n", unit_info->num_of_genomes);
    for (i_idx = 0; i_idx < unit_info->num_of_genomes; i_idx++) {
      printf("%s\t", gt_str_array_get(unit_info->genome_names, i_idx));
      for (j_idx = 0; j_idx < unit_info->num_of_genomes; j_idx++) {
        if ( i_idx == j_idx )
          printf("%.6f\t",0.0);
        else
          printf("%f\t", gt_calculateKr(avgshu[i_idx][j_idx]));
      }
      printf("\n");
    }
  }
  gt_free(gc_content);
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %r12
movq %r8, %r13
movq %rcx, 0x10(%rsp)
movq %rdx, %rbx
movq %rsi, 0x8(%rsp)
movq %rdi, %r14
movq %rdx, %rdi
callq 0x2072d3
movq %rax, %rbp
movq 0x28(%rbx), %rdi
callq 0xf02da
movq %rax, %rdi
callq 0xd3c75
movl %eax, %r15d
testb %al, %al
jne 0x207129
leaq 0x1bdf7d(%rip), %rsi    # 0x3c509c
movq %r12, %rdi
xorl %eax, %eax
callq 0x1019cf
testq %r13, %r13
sete %al
movl %r15d, %ecx
xorb $0x1, %cl
orb %al, %cl
jne 0x207152
movq 0x2bcda8(%rip), %rax    # 0x4c3ee8
movq (%rax), %rdx
leaq 0x1bdf83(%rip), %rsi    # 0x3c50cd
movq %r13, %rdi
callq 0x1229c8
movl $0xffffffff, 0x4(%rsp)  # imm = 0xFFFFFFFF
xorl %r12d, %r12d
testb %r15b, %r15b
je 0x207185
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x20741c
testq %rax, %rax
je 0x207182
movq %rax, %r15
movb $0x1, %r12b
movl $0x0, 0x4(%rsp)
jmp 0x207188
xorl %r12d, %r12d
xorl %r15d, %r15d
testb %r12b, %r12b
je 0x2071d2
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %rbp, %rcx
movq 0x8(%rsp), %r8
movq %r13, %r9
callq 0x2075e7
movq 0x10(%rsp), %rdi
callq 0x108f3c
testb %al, %al
je 0x2071d2
leaq 0x1bdf1f(%rip), %rsi    # 0x3c50da
movq 0x10(%rsp), %rdi
xorl %eax, %eax
callq 0x10906e
movq %r14, %rdi
movq %rbx, %rsi
callq 0x207788
movq %r15, 0x8(%rsp)
testq %r13, %r13
sete %al
movl %r12d, %ecx
xorb $0x1, %cl
orb %al, %cl
jne 0x207200
movq 0x2bccfa(%rip), %rax    # 0x4c3ee8
movq (%rax), %rdx
leaq 0x1bdef7(%rip), %rsi    # 0x3c50ef
movq %r13, %rdi
callq 0x1229c8
testb %r12b, %r12b
je 0x2072aa
leaq 0x1bdeec(%rip), %rsi    # 0x3c50fc
movq 0x10(%rsp), %rdi
xorl %eax, %eax
callq 0x10906e
movq (%rbx), %rsi
leaq 0x15283d(%rip), %rdi    # 0x359a63
xorl %eax, %eax
callq 0x17070
cmpq $0x0, (%rbx)
je 0x2072aa
leaq 0x1bded0(%rip), %r13    # 0x3c510a
leaq 0x1bdecf(%rip), %rbp    # 0x3c5110
xorl %r15d, %r15d
movq 0x10(%rbx), %rdi
movq %r15, %rsi
callq 0x121cfa
leaq 0x157a79(%rip), %rdi    # 0x35ecd0
movq %rax, %rsi
xorl %eax, %eax
callq 0x17070
cmpq $0x0, (%rbx)
je 0x207298
xorl %r12d, %r12d
cmpq %r12, %r15
jne 0x207277
xorps %xmm0, %xmm0
movq %r13, %rdi
jmp 0x207289
movq (%r14,%r15,8), %rax
movsd (%rax,%r12,8), %xmm0
callq 0x336320
movq %rbp, %rdi
movb $0x1, %al
callq 0x17070
incq %r12
cmpq (%rbx), %r12
jb 0x20726a
movl $0xa, %edi
callq 0x17a20
incq %r15
cmpq (%rbx), %r15
jb 0x207244
leaq 0x1bdd40(%rip), %rsi    # 0x3c4ff1
movq 0x8(%rsp), %rdi
movl $0x1ae, %edx            # imm = 0x1AE
callq 0x109670
movl 0x4(%rsp), %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq