// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movq 0x40(%rsp), %rax
movq 0x28(%rax), %rdi
callq 0xc2ec0
andb $0x1, %al
movb %al, 0x3f(%rsp)
movq $0x0, 0x20(%rsp)
movq $0x0, 0x18(%rsp)
movq 0x40(%rsp), %rax
movq (%rax), %rdi
movl $0x8, %esi
leaq 0x2a1ecb(%rip), %rdx    # 0x58e9ce
movl $0x41, %ecx
callq 0xe83c0
movq %rax, (%rsp)
movq $0x0, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq 0x40(%rsp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x2ecc7f
movq 0x40(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0x8(%rsp), %rsi
callq 0xc29f0
movq %rax, %rdi
leaq 0x2a1e83(%rip), %rsi    # 0x58e9ce
movl $0x44, %edx
leaq -0x1e3087(%rip), %rcx   # 0x109ad0
xorl %eax, %eax
movl %eax, %r8d
callq 0x109ea0
movq %rax, 0x30(%rsp)
movq 0x40(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0x8(%rsp), %rsi
callq 0xc2c20
movq %rax, 0x28(%rsp)
movq 0x8(%rsp), %rax
movq 0x40(%rsp), %rcx
movq 0x8(%rcx), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jne 0x2ecbdb
testb $0x1, 0x3f(%rsp)
je 0x2ecbbd
movq 0x40(%rsp), %rax
movq 0x28(%rax), %rdi
callq 0xa9d50
shrq %rax
subq 0x18(%rsp), %rax
subq $0x1, %rax
movq %rax, 0x20(%rsp)
jmp 0x2ecbd9
movq 0x40(%rsp), %rax
movq 0x28(%rax), %rdi
callq 0xa9d50
subq 0x18(%rsp), %rax
subq $0x1, %rax
movq %rax, 0x20(%rsp)
jmp 0x2ecc1d
movq 0x40(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0x28(%rsp), %rsi
addq 0x30(%rsp), %rsi
subq $0x1, %rsi
callq 0xb03a0
addq $0x1, %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
subq 0x18(%rsp), %rax
subq $0x1, %rax
movq %rax, 0x20(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x40(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0x2ecc53
movq 0x30(%rsp), %rdx
subq 0x20(%rsp), %rdx
movq (%rsp), %rax
movq 0x40(%rsp), %rcx
movq 0x20(%rcx), %rcx
movq 0x8(%rsp), %rsi
movq (%rcx,%rsi,8), %rcx
addq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x2ecc6a
movq 0x30(%rsp), %rdx
subq 0x20(%rsp), %rdx
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x2ecc6c
movq 0x8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x8(%rsp)
jmp 0x2ecb1a
testb $0x1, 0x3f(%rsp)
je 0x2eccce
movq $0x0, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq 0x40(%rsp), %rcx
cmpq (%rcx), %rax
jae 0x2ecccc
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
movq (%rax,%rcx,8), %rdx
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
addq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movq 0x8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x8(%rsp)
jmp 0x2ecc8f
jmp 0x2eccce
callq 0xe7720
testb $0x1, %al
jne 0x2eccd9
jmp 0x2ecd23
movq $0x0, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq 0x40(%rsp), %rcx
cmpq (%rcx), %rax
jae 0x2ecd21
movq 0x8(%rsp), %rsi
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x2a1e27(%rip), %rdi    # 0x58eb31
movb $0x0, %al
callq 0xe7740
movq 0x8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x8(%rsp)
jmp 0x2ecce2
jmp 0x2ecd23
movq (%rsp), %rax
addq $0x48, %rsp
retq
nopl (%rax)