// File: /workspace/github_c_makefile_star2_O2/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, %r13
movq %r8, %r12
movq %rcx, 0x10(%rsp)
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq %rdx, %rdi
callq 0x1b1434
movq %rax, %rbp
movq 0x28(%rbx), %rdi
callq 0x754dd
movq %rax, %rdi
callq 0x5741b
testb %al, %al
je 0x1b13e5
testq %r12, %r12
je 0x1b12d5
movq 0x286bed(%rip), %rax    # 0x437eb0
movq (%rax), %rdx
leaq 0x1aabe2(%rip), %rsi    # 0x35beaf
movq %r12, %rdi
callq 0xaf86f
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x1b156b
testq %rax, %rax
je 0x1b1408
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, 0x8(%rsp)
movq %rax, %rdx
movq %rbp, %rcx
movq %r15, %r8
movq %r12, %r9
callq 0x1b17ce
movq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x92c18
testb %al, %al
je 0x1b1332
leaq 0x1aab9f(%rip), %rsi    # 0x35bebc
movq %r15, %rdi
xorl %eax, %eax
callq 0x92e71
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1b196c
testq %r12, %r12
je 0x1b1350
movq 0x286b72(%rip), %rax    # 0x437eb0
movq (%rax), %rdx
leaq 0x1aab89(%rip), %rsi    # 0x35bed1
movq %r12, %rdi
callq 0xaf86f
leaq 0x1aab87(%rip), %rsi    # 0x35bede
movq %r15, %rdi
xorl %eax, %eax
callq 0x92e71
movq (%rbx), %rsi
leaq 0x13f6d0(%rip), %rdi    # 0x2f0a3b
xorl %eax, %eax
callq 0x17070
leaq 0x1aab73(%rip), %rbp    # 0x35beec
leaq 0x1aab72(%rip), %r12    # 0x35bef2
xorl %r13d, %r13d
cmpq (%rbx), %r13
jae 0x1b13fe
movq 0x10(%rbx), %rdi
movq %r13, %rsi
callq 0xae386
leaq 0x144919(%rip), %rdi    # 0x2f5cb4
movq %rax, %rsi
xorl %eax, %eax
callq 0x17070
xorl %r15d, %r15d
cmpq (%rbx), %r15
jae 0x1b13d8
cmpq %r15, %r13
jne 0x1b13ba
xorps %xmm0, %xmm0
movq %rbp, %rdi
jmp 0x1b13cc
movq (%r14,%r13,8), %rax
movsd (%rax,%r15,8), %xmm0
callq 0x2cd0eb
movq %r12, %rdi
movb $0x1, %al
callq 0x17070
incq %r15
jmp 0x1b13a8
pushq $0xa
popq %rdi
callq 0x179c0
incq %r13
jmp 0x1b1383
leaq 0x1aaa92(%rip), %rsi    # 0x35be7e
xorl %ebx, %ebx
movq %r13, %rdi
xorl %eax, %eax
callq 0x89dbb
pushq $-0x1
popq %r14
jmp 0x1b140e
movq 0x8(%rsp), %rbx
xorl %r14d, %r14d
jmp 0x1b140e
pushq $-0x1
popq %r14
xorl %ebx, %ebx
leaq 0x1aa9be(%rip), %rsi    # 0x35bdd3
movq %rbx, %rdi
movl $0x1ae, %edx            # imm = 0x1AE
callq 0x936f9
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq