// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/seed_extend_parts.c
// Function: gt_sequence_parts_info_new
GtSequencePartsInfo *gt_sequence_parts_info_new(const GtEncseq *encseq,
                                                GtUword numofsequences,
                                                GtUword numparts)
{
  GtSequencePartsInfo *spi = gt_malloc(sizeof *spi);
  spi->ranges = gt_malloc(sizeof *spi->ranges * numparts);
  spi->ssptab = gt_all_sequence_separators_get(encseq);
  spi->totallength = gt_encseq_total_length(encseq);
  spi->numofsequences = gt_encseq_num_of_sequences(encseq);

  if (spi->ssptab == NULL)
  {
    spi->same_length = gt_encseq_seqlength(encseq,0);
  } else
  {
    spi->same_length = 0;
  }
  if (numparts >= numofsequences)
  { /* assign one seq for each part */
    GtUword idx;

    for (idx = 0; idx < numofsequences; ++idx) {
      spi->ranges[idx].start = spi->ranges[idx].end = idx;
      spi->ranges[idx].max_length
        = gt_sequence_parts_info_partlength(spi,idx,idx);
    }
    spi->parts_number = numofsequences;
  } else
  {
    GtUword seqnum, idx, effective_num_parts;
    const GtUword partwidth = spi->totallength/numparts;

    for (idx = 0, seqnum = 0; idx < numparts && seqnum < numofsequences; idx++)
    {
      const GtUword seqnum_next_width
        = gt_encseq_next_larger_width(spi,seqnum,partwidth,
                                      numofsequences);
      spi->ranges[idx].start = seqnum;
      if (seqnum_next_width == GT_UWORD_MAX)
      {
        spi->ranges[idx].end = numofsequences - 1;
        idx++;
        break;
      }
      spi->ranges[idx].end = seqnum_next_width;
      seqnum = seqnum_next_width + 1;
    }
    gt_assert(idx > 0 &&
              spi->ranges[idx-1].end == numofsequences - 1);
    effective_num_parts = idx;
    if (effective_num_parts == 1)
    {
      spi->ranges[0].max_length = gt_encseq_max_seq_length(encseq);
    } else
    {
      if (spi->ssptab == NULL)
      {
        for (idx = 0; idx < effective_num_parts; idx++)
        {
          spi->ranges[idx].max_length = spi->same_length;
        }
      } else
      {
        GtUword currentstart = 0, idx = 0, currentlength, maxlength = 0;

        gt_assert(numofsequences > 1);
        for (seqnum = 0; seqnum < numofsequences - 1; seqnum++)
        {
          gt_assert(currentstart < spi->ssptab[seqnum]);
          currentlength = spi->ssptab[seqnum] - currentstart;
          if (maxlength < currentlength)
          {
            maxlength = currentlength;
          }
          if (seqnum == spi->ranges[idx].end)
          {
            spi->ranges[idx].max_length = maxlength;
            idx++;
            maxlength = 0;
          }
          currentstart = spi->ssptab[seqnum] + 1;
        }
        currentlength = spi->totallength - currentstart;
        if (maxlength < currentlength)
        {
          maxlength = currentlength;
        }
        gt_assert(idx + 1 == effective_num_parts &&
                  seqnum == spi->ranges[idx].end);
        spi->ranges[idx].max_length = maxlength;
      }
    }
    spi->parts_number = effective_num_parts;
  }
  return spi;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x1c46fc(%rip), %r15    # 0x355509
pushq $0x30
popq %rdi
pushq $0x72
popq %rdx
movq %r15, %rsi
callq 0x93160
movq %rax, %r13
imulq $0x18, %r14, %rdi
pushq $0x73
popq %rdx
movq %r15, %rsi
callq 0x93160
movq %rax, (%r13)
movq %rbx, %rdi
callq 0x73ceb
movq %rax, 0x8(%r13)
movq %rbx, %rdi
callq 0x7055e
movq %rax, 0x18(%r13)
movq %rbx, %rdi
callq 0x705a1
movq %rax, 0x20(%r13)
cmpq $0x0, 0x8(%r13)
je 0x190e60
xorl %eax, %eax
jmp 0x190e6a
movq %rbx, %rdi
xorl %esi, %esi
callq 0x75173
movq %rax, 0x10(%r13)
cmpq %r12, %r14
jae 0x190f8a
movq %rax, 0x30(%rsp)
movq %rbx, 0x28(%rsp)
movq 0x18(%r13), %rax
xorl %ebx, %ebx
movq %rax, 0x20(%rsp)
xorl %edx, %edx
divq %r14
movq %rax, 0x50(%rsp)
leaq -0x1(%r12), %rax
movq %rax, 0x8(%rsp)
xorl %ebp, %ebp
movq %r12, 0x10(%rsp)
movq %r14, 0x38(%rsp)
cmpq %r14, %rbx
jae 0x190fd6
cmpq %r12, %rbp
jae 0x190fd6
movq %rbx, 0x48(%rsp)
movq %r13, %r15
movq %r13, %rdi
movq %rbp, %rsi
callq 0x190d60
movq %rax, %r13
pushq $-0x1
popq %rcx
movq %rbp, %r14
movq 0x8(%rsp), %rbp
movq %r14, 0x40(%rsp)
movq %rcx, 0x18(%rsp)
leaq 0x1(%rbp), %rbx
cmpq %rbp, %r14
ja 0x190f45
movq %rbx, %r12
subq %r14, %r12
shrq %r12
addq %r14, %r12
cmpq 0x10(%rsp), %r12
jae 0x1910e0
movq %r15, %rdi
movq %r12, %rsi
callq 0x190d86
subq %r13, %rax
jbe 0x19110a
cmpq 0x50(%rsp), %rax
ja 0x190f33
incq %r12
cmpq 0x8(%rsp), %r14
movq %r12, %r14
jne 0x190eed
jmp 0x190f45
leaq -0x1(%r12), %rax
movq %r12, %rcx
testq %rbp, %rbp
movq %rax, %rbp
jne 0x190ee4
jmp 0x190f4a
movq 0x18(%rsp), %r12
movq %r15, %r13
movq (%r15), %rax
movq 0x48(%rsp), %rbx
imulq $0x18, %rbx, %rcx
addq %rcx, %rax
addq $0x8, %rax
movq 0x40(%rsp), %rcx
movq %rcx, -0x8(%rax)
cmpq $-0x1, %r12
movq 0x38(%rsp), %r14
je 0x190fc6
movq %r12, (%rax)
incq %r12
incq %rbx
movq %r12, %rbp
movq 0x10(%rsp), %r12
jmp 0x190eac
pushq $0x10
popq %rbx
xorl %r15d, %r15d
cmpq %r15, %r12
je 0x190fbe
movq (%r13), %r14
movq %r15, -0x8(%r14,%rbx)
movq %r15, -0x10(%r14,%rbx)
movq %r13, %rdi
movq %r15, %rsi
movq %r15, %rdx
callq 0x190dbf
movq %rax, (%r14,%rbx)
incq %r15
addq $0x18, %rbx
jmp 0x190f90
movq %r12, %rbx
jmp 0x1910b4
movq 0x8(%rsp), %rcx
movq %rcx, (%rax)
incq %rbx
movq 0x10(%rsp), %r12
testq %rbx, %rbx
je 0x19116e
movq (%r13), %r11
imulq $0x18, %rbx, %rcx
movq 0x8(%rsp), %rax
cmpq %rax, -0x10(%r11,%rcx)
jne 0x19116e
cmpq $0x1, %rbx
movq 0x30(%rsp), %rax
jne 0x191015
movq 0x28(%rsp), %rdi
callq 0x755c5
movq (%r13), %r11
jmp 0x1910b0
movq 0x8(%r13), %rcx
testq %rcx, %rcx
je 0x1910ca
cmpq $0x2, %r12
jb 0x1911cd
xorl %esi, %esi
xorl %r10d, %r10d
xorl %edx, %edx
xorl %edi, %edi
movq 0x20(%rsp), %rax
cmpq %rsi, 0x8(%rsp)
je 0x191082
movq (%rcx,%rsi,8), %r9
movq %r9, %r8
subq %r10, %r8
jbe 0x191140
cmpq %r8, %rdi
cmovaq %rdi, %r8
imulq $0x18, %rdx, %rdi
cmpq 0x8(%r11,%rdi), %rsi
jne 0x191074
addq %r11, %rdi
movq %r8, 0x10(%rdi)
incq %rdx
movq (%rcx,%rsi,8), %r9
xorl %r8d, %r8d
incq %r9
incq %rsi
movq %r9, %r10
movq %r8, %rdi
jmp 0x19103a
leaq 0x1(%rdx), %rcx
cmpq %rbx, %rcx
jne 0x19119c
subq %r10, %rax
cmpq %rax, %rdi
cmovaq %rdi, %rax
imulq $0x18, %rdx, %rcx
movq 0x8(%rsp), %rdx
cmpq 0x8(%r11,%rcx), %rdx
jne 0x19119c
addq %rcx, %r11
movq %rax, 0x10(%r11)
movq %rbx, 0x28(%r13)
movq %r13, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0x10, %r11
movq %rbx, %rcx
subq $0x1, %rcx
jb 0x1910b4
movq %rax, (%r11)
addq $0x18, %r11
jmp 0x1910d1
movq 0x2a6e81(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x153f22(%rip), %rsi    # 0x2e5013
leaq 0x1c468c(%rip), %rdx    # 0x355784
leaq 0x1c4669(%rip), %rcx    # 0x355768
leaq 0x1c4403(%rip), %r8     # 0x355509
pushq $0x56
jmp 0x191132
movq 0x2a6e57(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x153ef8(%rip), %rsi    # 0x2e5013
leaq 0x1c4677(%rip), %rdx    # 0x355799
leaq 0x1c463f(%rip), %rcx    # 0x355768
leaq 0x1c43d9(%rip), %r8     # 0x355509
pushq $0x58
popq %r9
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x2a6e21(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x153ec2(%rip), %rsi    # 0x2e5013
leaq 0x1c4435(%rip), %rdx    # 0x35558d
leaq 0x1c4400(%rip), %rcx    # 0x35555f
leaq 0x1c43a3(%rip), %r8     # 0x355509
movl $0xb2, %r9d
jmp 0x191134
movq 0x2a6df3(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x153e94(%rip), %rsi    # 0x2e5013
leaq 0x1c43a1(%rip), %rdx    # 0x355527
leaq 0x1c43d2(%rip), %rcx    # 0x35555f
leaq 0x1c4375(%rip), %r8     # 0x355509
movl $0x9e, %r9d
jmp 0x191134
movq 0x2a6dc5(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x153e66(%rip), %rsi    # 0x2e5013
leaq 0x1c43fc(%rip), %rdx    # 0x3555b0
leaq 0x1c43a4(%rip), %rcx    # 0x35555f
leaq 0x1c4347(%rip), %r8     # 0x355509
movl $0xc6, %r9d
jmp 0x191134
movq 0x2a6d94(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x153e35(%rip), %rsi    # 0x2e5013
leaq 0x1c4395(%rip), %rdx    # 0x35557a
leaq 0x1c4373(%rip), %rcx    # 0x35555f
leaq 0x1c4316(%rip), %r8     # 0x355509
movl $0xaf, %r9d
jmp 0x191134