// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/match/shu-genomediff.c
// Function: genomediff_calculate_gc
static double *genomediff_calculate_gc(GtUword *genome_lengths,
                                       GtShuUnitFileInfo *unit_info,
                                       GT_UNUSED GtError *err)
{
  GtUword file_idx = 0UL,
                genome_idx,
                idx,
                *seq_gc_content = NULL,
                num_of_seq,
                *genome_gc_content;
  double *gc_content;

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

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

  /*count gc, do not calculate ratio*/
  seq_gc_content = gt_encseq_gc_count(unit_info->encseq);

  if (seq_gc_content == NULL)
    return NULL;

  gc_content = gt_calloc((size_t)unit_info->num_of_genomes,
                         sizeof (*gc_content));
  genome_gc_content = gt_calloc((size_t)unit_info->num_of_genomes,
                                sizeof (*genome_gc_content));
  num_of_seq = gt_encseq_num_of_sequences(unit_info->encseq);

  for (idx = 0; idx < num_of_seq; idx++) {
    file_idx = gt_encseq_filenum(unit_info->encseq,
                                 gt_encseq_seqstartpos(unit_info->encseq, idx));
    if (unit_info->map_files != NULL)
      genome_idx = unit_info->map_files[file_idx];
    else
      genome_idx = file_idx;
    #ifndef S_SPLINT_S
    gt_safe_add(genome_gc_content[genome_idx],
                genome_gc_content[genome_idx],
                seq_gc_content[idx]);
    #endif
  }
  for (idx = 0; idx < unit_info->num_of_genomes; idx++) {
    gt_log_log("file/genome "GT_WU" has gc "GT_WU"",
               idx, genome_gc_content[idx]);
  }

  for (idx = 0; idx < unit_info->num_of_genomes; idx++) {
    gt_assert(genome_gc_content[idx] <= genome_lengths[idx]);
    gc_content[idx] = (double) genome_gc_content[idx] /
                      (double) genome_lengths[idx];
  }
  gt_free(seq_gc_content);
  gt_free(genome_gc_content);
  return gc_content;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %rdi, %rdi
je 0x2075dd
movq %rsi, %r13
testq %rsi, %rsi
je 0x2075e2
movq %rdi, %rbx
movq 0x28(%r13), %rdi
callq 0x206a58
testq %rax, %rax
je 0x2075be
movq %rax, %r15
movq %rbx, 0x10(%rsp)
movq (%r13), %rdi
leaq 0x1bdb8a(%rip), %rbx    # 0x3c4ff1
movl $0x8, %esi
movq %rbx, %rdx
movl $0x88, %ecx
callq 0x1093ef
movq %rax, 0x8(%rsp)
movq (%r13), %rdi
movl $0x8, %esi
movq %rbx, %rdx
movl $0x8a, %ecx
callq 0x1093ef
movq %rax, %r12
movq 0x28(%r13), %rdi
callq 0xec1e8
testq %rax, %rax
je 0x2074f0
movq %rax, %rbp
xorl %ebx, %ebx
movq 0x28(%r13), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0xefce0
movq %r14, %rdi
movq %rax, %rsi
callq 0xfab4f
movq 0x20(%r13), %rcx
testq %rcx, %rcx
je 0x2074d1
movq (%rcx,%rax,8), %rax
movq (%r15,%rbx,8), %rcx
testq %rcx, %rcx
je 0x2074e8
addq (%r12,%rax,8), %rcx
jb 0x2075d8
movq %rcx, (%r12,%rax,8)
incq %rbx
cmpq %rbx, %rbp
jne 0x2074aa
movq (%r13), %rax
testq %rax, %rax
je 0x20751f
leaq 0x1bdca2(%rip), %rbx    # 0x3c51a2
xorl %ebp, %ebp
movq (%r12,%rbp,8), %rdx
movq %rbx, %rdi
movq %rbp, %rsi
xorl %eax, %eax
callq 0x108e02
incq %rbp
movq (%r13), %rax
cmpq %rax, %rbp
jb 0x207502
testq %rax, %rax
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %r14
je 0x207595
xorl %ecx, %ecx
movq 0x1493a8(%rip), %xmm0   # 0x3508e0
movapd 0x1493b0(%rip), %xmm1   # 0x3508f0
movq (%r12,%rcx,8), %rsi
movq (%rdi,%rcx,8), %rdx
cmpq %rdx, %rsi
ja 0x2075d3
movq %rsi, %xmm2
punpckldq %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
subpd %xmm1, %xmm2
movapd %xmm2, %xmm3
unpckhpd %xmm2, %xmm3            # xmm3 = xmm3[1],xmm2[1]
addsd %xmm2, %xmm3
movq %rdx, %xmm2
punpckldq %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
subpd %xmm1, %xmm2
movapd %xmm2, %xmm4
unpckhpd %xmm2, %xmm4            # xmm4 = xmm4[1],xmm2[1]
addsd %xmm2, %xmm4
divsd %xmm4, %xmm3
movsd %xmm3, (%r14,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x207540
leaq 0x1bda55(%rip), %rbx    # 0x3c4ff1
movq %r15, %rdi
movq %rbx, %rsi
movl $0xa4, %edx
callq 0x109670
movq %r12, %rdi
movq %rbx, %rsi
movl $0xa5, %edx
callq 0x109670
jmp 0x2075c1
xorl %r14d, %r14d
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x80963
callq 0x80936
callq 0x809d3
callq 0x8099c