// File: /workspace/github_c_makefile_star2_O3/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 $0x28, %rsp
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %r15
leaq 0x1d3066(%rip), %r13    # 0x3b50a9
movl $0x30, %edi
movq %r13, %rsi
movl $0x72, %edx
callq 0x104226
movq %rax, %rbx
movq %r12, 0x8(%rsp)
leaq (,%r12,8), %rax
leaq (%rax,%rax,2), %rdi
movq %r13, %rsi
movl $0x73, %edx
callq 0x104226
movq %rax, (%rbx)
movq %r15, %rdi
callq 0xea9eb
movq %rax, 0x8(%rbx)
movq %r15, %rdi
callq 0xe7b9c
movq %rax, 0x18(%rbx)
movq %r15, %rdi
callq 0xe7bac
movq %rax, 0x20(%rbx)
cmpq $0x0, 0x8(%rbx)
je 0x1e20a8
xorl %esi, %esi
jmp 0x1e20b5
movq %r15, %rdi
xorl %esi, %esi
callq 0xeb9d2
movq %rax, %rsi
movq %rsi, 0x10(%rbx)
movq 0x8(%rsp), %r8
cmpq %r14, %r8
jae 0x1e21f3
movq %r15, 0x20(%rsp)
movq %rbx, %r9
addq $0x18, %r9
movq 0x8(%rbx), %rdi
movq 0x18(%rbx), %rax
xorl %ecx, %ecx
movq %rax, 0x18(%rsp)
xorl %edx, %edx
divq %r8
leaq -0x1(%r14), %r15
movq %rsi, 0x10(%rsp)
leaq 0x1(%rsi), %r10
xorl %r13d, %r13d
testq %rdi, %rdi
je 0x1e210b
testq %rcx, %rcx
je 0x1e2114
movq -0x8(%rdi,%rcx,8), %r8
incq %r8
jmp 0x1e2117
movq %r10, %r8
imulq %rcx, %r8
jmp 0x1e2117
xorl %r8d, %r8d
movq $-0x1, %rsi
movq %rcx, %r11
movq %r15, %rdx
movq %rdx, %rbp
subq %r11, %rbp
incq %rbp
shrq %rbp
addq %r11, %rbp
cmpq %r14, %rbp
jae 0x1e23b1
testq %rdi, %rdi
je 0x1e215c
movq 0x20(%rbx), %r12
decq %r12
cmpq %rbp, %r12
leaq (%rdi,%rbp,8), %r12
cmovbeq %r9, %r12
movq (%r12), %r12
decq %r12
jmp 0x1e2168
leaq 0x1(%rbp), %r12
imulq %r10, %r12
addq $-0x2, %r12
subq %r8, %r12
jbe 0x1e23ac
cmpq %rax, %r12
jbe 0x1e2184
testq %rdx, %rdx
je 0x1e21b6
leaq -0x1(%rbp), %rdx
movq %rbp, %rsi
jmp 0x1e2192
cmpq %r15, %r11
je 0x1e2199
movq %rbp, %r11
incq %r11
movq %rsi, %rbp
cmpq %rdx, %r11
jbe 0x1e2124
jmp 0x1e219c
movq %rsi, %rbp
movq (%rbx), %r8
leaq (,%r13,2), %rdx
addq %r13, %rdx
movq %rcx, (%r8,%rdx,8)
cmpq $-0x1, %rbp
jne 0x1e21c8
jmp 0x1e2232
movq (%rbx), %r8
leaq (,%r13,2), %rdx
addq %r13, %rdx
movq %rcx, (%r8,%rdx,8)
leaq (,%r13,2), %rcx
addq %r13, %rcx
movq %rbp, 0x8(%r8,%rcx,8)
incq %r13
cmpq 0x8(%rsp), %r13
jae 0x1e2240
incq %rbp
movq %rbp, %rcx
cmpq %r14, %rbp
jb 0x1e20f7
jmp 0x1e2240
testq %r14, %r14
je 0x1e222a
movq (%rbx), %r12
addq $0x10, %r12
xorl %r15d, %r15d
movq %r15, -0x8(%r12)
movq %r15, -0x10(%r12)
movq %rbx, %rdi
movq %r15, %rsi
movq %r15, %rdx
callq 0x1e1fd3
movq %rax, (%r12)
incq %r15
addq $0x18, %r12
cmpq %r15, %r14
jne 0x1e2202
movq %r14, %r13
jmp 0x1e22fe
movq %r15, 0x8(%r8,%rdx,8)
incq %r13
je 0x1e23bb
leaq (,%r13,2), %rax
addq %r13, %rax
cmpq %r15, -0x10(%r8,%rax,8)
jne 0x1e23bb
cmpq $0x1, %r13
jne 0x1e226e
movq 0x20(%rsp), %rdi
callq 0xebd5d
movq (%rbx), %rcx
jmp 0x1e22fa
testq %rdi, %rdi
je 0x1e2314
cmpq $0x2, %r14
jb 0x1e23c5
xorl %ecx, %ecx
xorl %r11d, %r11d
xorl %esi, %esi
xorl %edx, %edx
movq (%rdi,%rdx,8), %r9
movq %r9, %r10
subq %rsi, %r10
jbe 0x1e23b6
cmpq %r10, %rcx
cmovbeq %r10, %rcx
leaq (%r11,%r11,2), %rsi
cmpq 0x8(%r8,%rsi,8), %rdx
jne 0x1e22bd
leaq (%r8,%rsi,8), %rsi
movq %rcx, 0x10(%rsi)
incq %r11
movq (%rdi,%rdx,8), %r9
xorl %ecx, %ecx
movq %r9, %rsi
incq %rsi
incq %rdx
cmpq %rdx, %r15
jne 0x1e228a
leaq 0x1(%r11), %rdx
cmpq %r13, %rdx
movq 0x18(%rsp), %rax
jne 0x1e23c0
subq %rsi, %rax
cmpq %rax, %rcx
cmovaq %rcx, %rax
leaq (%r11,%r11,2), %rcx
cmpq 0x8(%r8,%rcx,8), %r15
jne 0x1e23c0
leaq (%r8,%rcx,8), %rcx
movq %rax, 0x10(%rcx)
movq %r13, 0x28(%rbx)
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1(%r13), %rax
andq $-0x2, %rax
leaq -0x1(%r13), %rcx
movq %rcx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
addq $0x28, %r8
movdqa 0x1766ea(%rip), %xmm1   # 0x358a20
movdqa 0x1766f2(%rip), %xmm2   # 0x358a30
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movdqa 0x1766f2(%rip), %xmm4   # 0x358a40
movq 0x10(%rsp), %rdx
movdqa %xmm1, %xmm5
pxor %xmm2, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
movd %xmm5, %ecx
notl %ecx
testb $0x1, %cl
je 0x1e2388
movq %rdx, -0x18(%r8)
pxor %xmm3, %xmm5
pextrw $0x4, %xmm5, %ecx
testb $0x1, %cl
je 0x1e2399
movq %rdx, (%r8)
paddq %xmm4, %xmm1
addq $0x30, %r8
addq $-0x2, %rax
jne 0x1e2353
jmp 0x1e22fe
callq 0x750c7
callq 0x75090
callq 0x75170
callq 0x750fe
callq 0x751a9
callq 0x75137