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

  gt_assert(shulensums != NULL);
  gt_assert(unit_info != NULL);

  genome_lengths =
    genomediff_calculate_genome_lengths(unit_info);

  if (timer != NULL)
    gt_timer_show_progress(timer, "calculate avg shulen", stdout);

  gt_array2dim_calloc(div,
                      unit_info->num_of_genomes,
                      unit_info->num_of_genomes);

  for (i_idx = 0; i_idx < unit_info->num_of_genomes; i_idx++) {
    GtUword length_i;
    length_i = genome_lengths[i_idx];

    for (j_idx = 0; j_idx < unit_info->num_of_genomes; j_idx++) {
      div[i_idx][j_idx] = pcktable ?
                            ((double) shulensums[i_idx][j_idx]) / length_i :
                            ((double) shulensums[j_idx][i_idx]) / length_i;
    }
  }
  if (gt_logger_enabled(logger)) {
    gt_logger_log(logger, "table of avg shulens");
    genomediff_print_table(div, 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, div, gc_content, genome_lengths,
                             arguments, timer);

    if (gt_logger_enabled(logger)) {
      gt_logger_log(logger, "table of divergences");
      genomediff_print_table(div, 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(div[i_idx][j_idx]));
      }
      printf("\n");
    }
  }

  gt_free(genome_lengths);
  gt_free(gc_content);
  if (div != NULL)
    gt_array2dim_delete(div);
  return had_err;
}

// Assembly:
subq $0x88, %rsp
movb %cl, %al
movq 0x90(%rsp), %rcx
movq %rdi, 0x80(%rsp)
movq %rsi, 0x78(%rsp)
movq %rdx, 0x70(%rsp)
andb $0x1, %al
movb %al, 0x6f(%rsp)
movq %r8, 0x60(%rsp)
movq %r9, 0x58(%rsp)
movl $0x0, 0x54(%rsp)
movq $0x0, 0x48(%rsp)
movq $0x0, 0x40(%rsp)
movq $0x0, 0x38(%rsp)
cmpq $0x0, 0x80(%rsp)
jne 0x2ed7f9
movq 0x34e7d8(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x228841(%rip), %rsi    # 0x516013
leaq 0x2a1273(%rip), %rdx    # 0x58ea4c
leaq 0x2a1311(%rip), %rcx    # 0x58eaf1
leaq 0x2a11e7(%rip), %r8     # 0x58e9ce
movl $0x1c1, %r9d            # imm = 0x1C1
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2ed7fb
jmp 0x2ed7fd
cmpq $0x0, 0x70(%rsp)
jne 0x2ed83d
movq 0x34e794(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2287fd(%rip), %rsi    # 0x516013
leaq 0x230d1e(%rip), %rdx    # 0x51e53b
leaq 0x2a12cd(%rip), %rcx    # 0x58eaf1
leaq 0x2a11a3(%rip), %r8     # 0x58e9ce
movl $0x1c2, %r9d            # imm = 0x1C2
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2ed83f
movq 0x70(%rsp), %rdi
callq 0x2ecac0
movq %rax, 0x38(%rsp)
cmpq $0x0, 0x58(%rsp)
je 0x2ed871
movq 0x58(%rsp), %rdi
movq 0x34e6d6(%rip), %rax    # 0x63bf38
movq (%rax), %rdx
leaq 0x2a129b(%rip), %rsi    # 0x58eb07
callq 0x121930
movq 0x70(%rsp), %rax
movq (%rax), %rdi
shlq $0x3, %rdi
leaq 0x2a114a(%rip), %rsi    # 0x58e9ce
movl $0x1cc, %edx            # imm = 0x1CC
callq 0xe80f0
movq %rax, 0x48(%rsp)
movq 0x70(%rsp), %rax
movq (%rax), %rdi
movq 0x70(%rsp), %rax
imulq (%rax), %rdi
movl $0x8, %esi
leaq 0x2a111e(%rip), %rdx    # 0x58e9ce
movl $0x1cc, %ecx            # imm = 0x1CC
callq 0xe83c0
movq %rax, %rcx
movq 0x48(%rsp), %rax
movq %rcx, (%rax)
movq $0x1, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq 0x70(%rsp), %rcx
cmpq (%rcx), %rax
jae 0x2ed91c
movq 0x48(%rsp), %rax
movq 0x18(%rsp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rdx
movq 0x70(%rsp), %rax
movq (%rax), %rax
shlq $0x3, %rax
addq %rax, %rdx
movq 0x48(%rsp), %rax
movq 0x18(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x18(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x18(%rsp)
jmp 0x2ed8ce
movq $0x0, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq 0x70(%rsp), %rcx
cmpq (%rcx), %rax
jae 0x2eda76
movq 0x38(%rsp), %rax
movq 0x30(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x10(%rsp)
movq $0x0, 0x28(%rsp)
movq 0x28(%rsp), %rax
movq 0x70(%rsp), %rcx
cmpq (%rcx), %rax
jae 0x2eda61
testb $0x1, 0x6f(%rsp)
je 0x2ed9d0
movq 0x80(%rsp), %rax
movq 0x30(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x28(%rsp), %rcx
movq (%rax,%rcx,8), %xmm0
movaps 0x22afa0(%rip), %xmm3   # 0x518930
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x22afa4(%rip), %xmm2   # 0x518940
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq 0x10(%rsp), %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
jmp 0x2eda30
movq 0x80(%rsp), %rax
movq 0x28(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x30(%rsp), %rcx
movq (%rax,%rcx,8), %xmm0
movaps 0x22af3e(%rip), %xmm3   # 0x518930
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x22af42(%rip), %xmm2   # 0x518940
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq 0x10(%rsp), %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x8(%rsp), %xmm0
movq 0x48(%rsp), %rax
movq 0x30(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x28(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq 0x28(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x28(%rsp)
jmp 0x2ed954
jmp 0x2eda63
movq 0x30(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x30(%rsp)
jmp 0x2ed925
movq 0x60(%rsp), %rdi
callq 0xe7980
testb $0x1, %al
jne 0x2eda86
jmp 0x2edaa8
movq 0x60(%rsp), %rdi
leaq 0x2a108a(%rip), %rsi    # 0x58eb1c
movb $0x0, %al
callq 0xe7cd0
movq 0x48(%rsp), %rdi
movq 0x70(%rsp), %rsi
callq 0x2ed670
movq 0x70(%rsp), %rax
movq 0x28(%rax), %rdi
callq 0xb0f00
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rdi
callq 0x7f400
testb $0x1, %al
jne 0x2edae7
movq 0x90(%rsp), %rdi
leaq 0x2a0fa1(%rip), %rsi    # 0x58ea79
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x54(%rsp) # imm = 0xFFFFFFFF
cmpl $0x0, 0x54(%rsp)
jne 0x2edb11
cmpq $0x0, 0x58(%rsp)
je 0x2edb11
movq 0x58(%rsp), %rdi
movq 0x34e436(%rip), %rax    # 0x63bf38
movq (%rax), %rdx
leaq 0x2a0f9e(%rip), %rsi    # 0x58eaaa
callq 0x121930
cmpl $0x0, 0x54(%rsp)
jne 0x2edb46
movq 0x38(%rsp), %rdi
movq 0x70(%rsp), %rsi
movq 0x90(%rsp), %rdx
callq 0x2ecd30
movq %rax, 0x40(%rsp)
cmpq $0x0, 0x40(%rsp)
jne 0x2edb44
movl $0xffffffff, 0x54(%rsp) # imm = 0xFFFFFFFF
jmp 0x2edb46
cmpl $0x0, 0x54(%rsp)
jne 0x2edba4
movq 0x70(%rsp), %rdi
movq 0x48(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq 0x38(%rsp), %rcx
movq 0x78(%rsp), %r8
movq 0x58(%rsp), %r9
callq 0x2ed360
movq 0x60(%rsp), %rdi
callq 0xe7980
testb $0x1, %al
jne 0x2edb80
jmp 0x2edba2
movq 0x60(%rsp), %rdi
leaq 0x2a0f2b(%rip), %rsi    # 0x58eab7
movb $0x0, %al
callq 0xe7cd0
movq 0x48(%rsp), %rdi
movq 0x70(%rsp), %rsi
callq 0x2ed670
jmp 0x2edba4
cmpl $0x0, 0x54(%rsp)
jne 0x2edbce
cmpq $0x0, 0x58(%rsp)
je 0x2edbce
movq 0x58(%rsp), %rdi
movq 0x34e379(%rip), %rax    # 0x63bf38
movq (%rax), %rdx
leaq 0x2a0f03(%rip), %rsi    # 0x58eacc
callq 0x121930
cmpl $0x0, 0x54(%rsp)
jne 0x2edcd9
movq 0x60(%rsp), %rdi
leaq 0x2a0ef4(%rip), %rsi    # 0x58ead9
movb $0x0, %al
callq 0xe7cd0
movq 0x70(%rsp), %rax
movq (%rax), %rsi
leaq 0x233eab(%rip), %rdi    # 0x521aa6
movb $0x0, %al
callq 0x19070
movq $0x0, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq 0x70(%rsp), %rcx
cmpq (%rcx), %rax
jae 0x2edcd7
movq 0x70(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x30(%rsp), %rsi
callq 0x11f8c0
movq %rax, %rsi
leaq 0x239125(%rip), %rdi    # 0x526d60
movb $0x0, %al
callq 0x19070
movq $0x0, 0x28(%rsp)
movq 0x28(%rsp), %rax
movq 0x70(%rsp), %rcx
cmpq (%rcx), %rax
jae 0x2edcb6
movq 0x30(%rsp), %rax
cmpq 0x28(%rsp), %rax
jne 0x2edc79
leaq 0x2a0e7a(%rip), %rdi    # 0x58eae7
xorps %xmm0, %xmm0
movb $0x1, %al
callq 0x19070
jmp 0x2edca4
movq 0x48(%rsp), %rax
movq 0x30(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x28(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
callq 0x4e74a0
leaq 0x2a0e50(%rip), %rdi    # 0x58eaed
movb $0x1, %al
callq 0x19070
jmp 0x2edca6
movq 0x28(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x28(%rsp)
jmp 0x2edc4b
leaq 0x2a55b6(%rip), %rdi    # 0x593273
movb $0x0, %al
callq 0x19070
movq 0x30(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x30(%rsp)
jmp 0x2edc0b
jmp 0x2edcd9
movq 0x38(%rsp), %rdi
leaq 0x2a0ce9(%rip), %rsi    # 0x58e9ce
movl $0x20a, %edx            # imm = 0x20A
callq 0xe88c0
movq 0x40(%rsp), %rdi
leaq 0x2a0cd3(%rip), %rsi    # 0x58e9ce
movl $0x20b, %edx            # imm = 0x20B
callq 0xe88c0
cmpq $0x0, 0x48(%rsp)
je 0x2edd26
movq 0x48(%rsp), %rax
movq (%rax), %rdi
leaq 0x2a0cb2(%rip), %rsi    # 0x58e9ce
movl $0x20d, %edx            # imm = 0x20D
callq 0xe88c0
movq 0x48(%rsp), %rdi
leaq 0x2a0c9c(%rip), %rsi    # 0x58e9ce
movl $0x20d, %edx            # imm = 0x20D
callq 0xe88c0
movl 0x54(%rsp), %eax
addq $0x88, %rsp
retq
nopl (%rax,%rax)