// File: /workspace/github_c_makefile_star2_O3/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 0xf6567
movb %al, 0x7(%rsp)
movq (%rbx), %rdi
leaq 0x1bdd90(%rip), %rdx    # 0x3bb981
movl $0x8, %esi
movl $0x41, %ecx
callq 0x10436a
movq %rax, %r14
cmpq $0x0, 0x8(%rbx)
je 0x1fdcb6
xorl %r15d, %r15d
leaq -0xeaa90(%rip), %r13    # 0x113188
xorl %ebp, %ebp
movq 0x28(%rbx), %rdi
movq %r15, %rsi
callq 0xf63fb
movq %rax, %rdi
leaq 0x1bdd51(%rip), %rsi    # 0x3bb981
movl $0x44, %edx
movq %r13, %rcx
xorl %r8d, %r8d
callq 0x1132ac
movq %rax, %r12
movq 0x28(%rbx), %rdi
movq %r15, %rsi
callq 0xf6489
movq 0x8(%rbx), %rcx
movq 0x28(%rbx), %rdi
decq %rcx
cmpq %rcx, %r15
jne 0x1fdc79
callq 0xe7bac
movq %rbp, %rcx
notq %rcx
cmpb $0x0, 0x7(%rsp)
je 0x1fdc74
shrq %rax
addq %rcx, %rax
jmp 0x1fdc8f
leaq (%r12,%rax), %rsi
decq %rsi
callq 0xeb655
leaq 0x1(%rax), %rcx
subq %rbp, %rax
movq %rcx, %rbp
movq 0x20(%rbx), %rcx
subq %rax, %r12
testq %rcx, %rcx
je 0x1fdca5
movq (%rcx,%r15,8), %rax
addq %r12, (%r14,%rax,8)
jmp 0x1fdca9
movq %r12, (%r14,%r15,8)
incq %r15
cmpq 0x8(%rbx), %r15
jb 0x1fdc1a
cmpb $0x0, 0x7(%rsp)
je 0x1fdcd1
cmpq $0x0, (%rbx)
je 0x1fdcd1
xorl %eax, %eax
shlq (%r14,%rax,8)
incq %rax
cmpq (%rbx), %rax
jb 0x1fdcc5
callq 0x103d66
testb %al, %al
je 0x1fdd03
cmpq $0x0, (%rbx)
je 0x1fdd03
leaq 0x1bddfd(%rip), %r15    # 0x3bbae4
xorl %r12d, %r12d
movq (%r14,%r12,8), %rdx
movq %r15, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x103d72
incq %r12
cmpq (%rbx), %r12
jb 0x1fdcea
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq