// File: /workspace/github_c_makefile_star2_O2/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 0x81dea
movb %al, 0x7(%rsp)
movq (%rbx), %rdi
leaq 0x1aa97a(%rip), %rdx    # 0x35bdd3
pushq $0x8
popq %rsi
pushq $0x41
popq %rcx
callq 0x9334a
movq %rax, %r14
xorl %r12d, %r12d
pushq $0x44
popq %r13
xorl %r15d, %r15d
cmpq 0x8(%rbx), %r15
jae 0x1b1514
movq 0x28(%rbx), %rdi
movq %r15, %rsi
callq 0x81afe
movq %rax, %rdi
leaq 0x1aa942(%rip), %rsi    # 0x35bdd3
movl %r13d, %edx
leaq -0x10ce13(%rip), %rcx   # 0xa4688
xorl %r8d, %r8d
callq 0xa47aa
movq %rax, %rbp
movq 0x28(%rbx), %rdi
movq %r15, %rsi
callq 0x81c44
movq 0x8(%rbx), %rcx
movq 0x28(%rbx), %rdi
decq %rcx
cmpq %rcx, %r15
jne 0x1b14dc
callq 0x705a1
movq %r12, %rcx
notq %rcx
cmpb $0x0, 0x7(%rsp)
je 0x1b14d7
shrq %rax
addq %rcx, %rax
jmp 0x1b14f2
leaq (%rax,%rbp), %rsi
decq %rsi
callq 0x74c9d
leaq 0x1(%rax), %rcx
subq %r12, %rax
movq %rcx, %r12
movq 0x20(%rbx), %rcx
subq %rax, %rbp
testq %rcx, %rcx
je 0x1b1508
movq (%rcx,%r15,8), %rax
addq %rbp, (%r14,%rax,8)
jmp 0x1b150c
movq %rbp, (%r14,%r15,8)
incq %r15
jmp 0x1b1471
cmpb $0x0, 0x7(%rsp)
je 0x1b152b
xorl %eax, %eax
cmpq (%rbx), %rax
jae 0x1b152b
shlq (%r14,%rax,8)
incq %rax
jmp 0x1b151d
callq 0x92a76
testb %al, %al
je 0x1b1559
leaq 0x1aa9fb(%rip), %r15    # 0x35bf36
xorl %r12d, %r12d
cmpq (%rbx), %r12
jae 0x1b1559
movq (%r14,%r12,8), %rdx
movq %r15, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x92a82
incq %r12
jmp 0x1b153e
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq