// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/match/shu-genomediff.c
// Function: genomediff_calculate_genome_lengths
static GtUword*
genomediff_calculate_genome_lengths(GtShuUnitFileInfo *unit_info)
{
  bool mirrored = gt_encseq_is_mirrored(unit_info->encseq);
  GtUword eff_file_length,
                filestart,
                sep_per_file = 0,
                seqs_passed = 0,
                seqs_upto_fileend,
                i_idx;
  GtUword *genome_lengths = gt_calloc((size_t) unit_info->num_of_genomes,
                                           sizeof (*genome_lengths));
  for (i_idx = 0UL; i_idx < unit_info->num_of_files; i_idx++) {
    eff_file_length = gt_safe_cast2ulong_64((uint64_t)
        gt_encseq_effective_filelength(unit_info->encseq, i_idx));
    filestart = gt_encseq_filestartpos(unit_info->encseq, i_idx);
    if (i_idx == unit_info->num_of_files - 1) {
      if (mirrored) {
        sep_per_file = GT_DIV2(gt_encseq_num_of_sequences(unit_info->encseq))
                       - seqs_passed - 1;
      }
      else {
        sep_per_file = gt_encseq_num_of_sequences(unit_info->encseq)
                       - seqs_passed - 1;
      }
    }
    else {
      seqs_upto_fileend = gt_encseq_seqnum(unit_info->encseq,
                                           filestart +
                                           eff_file_length - 1)
                          + 1;

      sep_per_file = seqs_upto_fileend - seqs_passed - 1;
      seqs_passed = seqs_upto_fileend;
    }
    if (unit_info->map_files != NULL) {
      genome_lengths[unit_info->map_files[i_idx]] +=
        eff_file_length - sep_per_file;
    }
    else {
      genome_lengths[i_idx] = eff_file_length - sep_per_file;
    }
  }
  if (mirrored) {
    for (i_idx = 0UL; i_idx < unit_info->num_of_genomes; i_idx++) {
      genome_lengths[i_idx] += genome_lengths[i_idx];
    }
  }
  if (gt_log_enabled()) {
    for  (i_idx = 0UL; i_idx < unit_info->num_of_genomes; i_idx++) {
      gt_log_log("file/genome "GT_WU" has length "GT_WU"",
          i_idx, genome_lengths[i_idx]);
    }
  }
  return genome_lengths;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x28(%rdi), %rdi
callq 0xfac80
movb %al, 0x7(%rsp)
movq (%rbx), %rdi
leaq 0x1bdcf9(%rip), %rdx    # 0x3c4ff1
movl $0x8, %esi
movl $0x41, %ecx
callq 0x1093ef
movq %rax, %r14
cmpq $0x0, 0x8(%rbx)
je 0x2073bd
xorl %r15d, %r15d
leaq -0xeeafb(%rip), %r13    # 0x118824
xorl %ebp, %ebp
movq 0x28(%rbx), %rdi
movq %r15, %rsi
callq 0xfab0d
movq %rax, %rdi
leaq 0x1bdcba(%rip), %rsi    # 0x3c4ff1
movl $0x44, %edx
movq %r13, %rcx
xorl %r8d, %r8d
callq 0x118948
movq %rax, %r12
movq 0x28(%rbx), %rdi
movq %r15, %rsi
callq 0xfaba2
movq 0x8(%rbx), %rcx
movq 0x28(%rbx), %rdi
decq %rcx
cmpq %rcx, %r15
jne 0x207380
callq 0xec1e8
movq %rbp, %rcx
notq %rcx
cmpb $0x0, 0x7(%rsp)
je 0x20737b
shrq %rax
addq %rcx, %rax
jmp 0x207396
leaq (%r12,%rax), %rsi
decq %rsi
callq 0xefc48
leaq 0x1(%rax), %rcx
subq %rbp, %rax
movq %rcx, %rbp
movq 0x20(%rbx), %rcx
subq %rax, %r12
testq %rcx, %rcx
je 0x2073ac
movq (%rcx,%r15,8), %rax
addq %r12, (%r14,%rax,8)
jmp 0x2073b0
movq %r12, (%r14,%r15,8)
incq %r15
cmpq 0x8(%rbx), %r15
jb 0x207321
cmpb $0x0, 0x7(%rsp)
je 0x2073d8
cmpq $0x0, (%rbx)
je 0x2073d8
xorl %eax, %eax
shlq (%r14,%rax,8)
incq %rax
cmpq (%rbx), %rax
jb 0x2073cc
callq 0x108df6
testb %al, %al
je 0x20740a
cmpq $0x0, (%rbx)
je 0x20740a
leaq 0x1bdd66(%rip), %r15    # 0x3c5154
xorl %r12d, %r12d
movq (%r14,%r12,8), %rdx
movq %r15, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x108e02
incq %r12
cmpq (%rbx), %r12
jb 0x2073f1
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq