// File: /workspace/github_c_makefile_star2_O1/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 $0x18, %rsp
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %r15
leaq 0x1d2e14(%rip), %r13    # 0x3be6c9
movl $0x30, %edi
movq %r13, %rsi
movl $0x72, %edx
callq 0x1092b2
movq %rax, %rbx
leaq (,%r12,8), %rax
leaq (%rax,%rax,2), %rdi
movq %r13, %rsi
movl $0x73, %edx
callq 0x1092b2
movq %rax, (%rbx)
movq %r15, %rdi
callq 0xeef80
movq %rax, 0x8(%rbx)
movq %r15, %rdi
callq 0xec1d8
movq %rax, 0x18(%rbx)
movq %r15, %rdi
callq 0xec1e8
movq %rax, 0x20(%rbx)
cmpq $0x0, 0x8(%rbx)
je 0x1eb915
xorl %eax, %eax
jmp 0x1eb91f
movq %r15, %rdi
xorl %esi, %esi
callq 0xeffd3
movq %rax, 0x10(%rbx)
cmpq %r14, %r12
jae 0x1ebaa6
movq %r15, 0x8(%rsp)
movq %rbx, %rsi
addq $0x18, %rsi
movq 0x8(%rbx), %rdi
movq 0x18(%rbx), %rax
xorl %r8d, %r8d
movq %rax, (%rsp)
xorl %edx, %edx
divq %r12
leaq -0x1(%r14), %rdx
xorl %r13d, %r13d
movq %r12, 0x10(%rsp)
testq %rdi, %rdi
je 0x1eb96c
testq %r8, %r8
je 0x1eb979
movq -0x8(%rdi,%r8,8), %r9
incq %r9
jmp 0x1eb97c
movq 0x10(%rbx), %r9
incq %r9
imulq %r8, %r9
jmp 0x1eb97c
xorl %r9d, %r9d
movq $-0x1, %rcx
movq %rdx, %r11
movq %r8, %rbp
cmpq %r11, %rbp
ja 0x1eba1a
movq %r11, %r10
subq %rbp, %r10
incq %r10
shrq %r10
addq %rbp, %r10
cmpq %r14, %r10
jae 0x1ebc2f
testq %rdi, %rdi
je 0x1eb9c9
movq 0x20(%rbx), %r15
decq %r15
cmpq %r10, %r15
leaq (%rdi,%r10,8), %r15
cmovbeq %rsi, %r15
movq (%r15), %r15
decq %r15
jmp 0x1eb9dc
leaq 0x1(%r10), %r12
movq 0x10(%rbx), %r15
incq %r15
imulq %r12, %r15
addq $-0x2, %r15
subq %r9, %r15
jbe 0x1ebc34
cmpq %rax, %r15
jbe 0x1eb9fe
leaq -0x1(%r10), %rcx
testq %r11, %r11
sete %r15b
cmovneq %rcx, %r11
movq %r10, %rcx
jmp 0x1eba0f
incq %r10
cmpq %rdx, %rbp
sete %r15b
cmovneq %r10, %rbp
movq %rcx, %r10
testb %r15b, %r15b
je 0x1eb989
jmp 0x1eba1d
movq %rcx, %r10
movq (%rbx), %rcx
leaq (,%r13,2), %r9
addq %r13, %r9
leaq (%rcx,%r9,8), %rcx
addq $0x8, %rcx
movq %r8, -0x8(%rcx)
cmpq $-0x1, %r10
movq 0x10(%rsp), %r9
je 0x1eba4b
movq %r10, (%rcx)
leaq 0x1(%r10), %r8
jmp 0x1eba51
movq %rdx, (%rcx)
incq %r13
cmpq $-0x1, %r10
je 0x1eba68
incq %r13
cmpq %r9, %r13
jae 0x1eba68
cmpq %r14, %r8
jb 0x1eb958
testq %r13, %r13
je 0x1ebc3e
movq (%rbx), %r11
leaq (,%r13,2), %rsi
addq %r13, %rsi
leaq -0x1(%r14), %rcx
cmpq %rcx, -0x10(%r11,%rsi,8)
jne 0x1ebc3e
cmpq $0x1, %r13
jne 0x1ebae5
movq 0x8(%rsp), %rdi
callq 0xf035e
movq (%rbx), %rcx
jmp 0x1ebc15
testq %r14, %r14
je 0x1ebadd
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 0x1eb83b
movq %rax, (%r12)
incq %r15
addq $0x18, %r12
cmpq %r15, %r14
jne 0x1ebab5
movq %r14, %r13
jmp 0x1ebc19
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x1ebb4f
cmpq $0x2, %r14
jb 0x1ebc48
testq %rcx, %rcx
je 0x1ebbe5
xorl %r10d, %r10d
xorl %esi, %esi
xorl %r9d, %r9d
xorl %ecx, %ecx
movq (%rdi,%rcx,8), %r8
subq %r9, %r8
jbe 0x1ebc39
cmpq %r8, %r10
cmovaq %r10, %r8
leaq (%rsi,%rsi,2), %r9
cmpq 0x8(%r11,%r9,8), %rcx
jne 0x1ebb38
leaq (%r11,%r9,8), %r9
movq %r8, 0x10(%r9)
incq %rsi
xorl %r8d, %r8d
movq (%rdi,%rcx,8), %r9
incq %r9
incq %rcx
movq %r8, %r10
cmpq %rcx, %rdx
jne 0x1ebb0b
jmp 0x1ebbef
movq 0x10(%rbx), %rcx
leaq 0x1(%r13), %rdx
andq $-0x2, %rdx
leaq -0x1(%r13), %rsi
movq %rsi, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
addq $0x28, %r11
movdqa 0x175efb(%rip), %xmm1   # 0x361a70
movdqa 0x175f03(%rip), %xmm2   # 0x361a80
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movdqa 0x175f03(%rip), %xmm4   # 0x361a90
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, %esi
notl %esi
testb $0x1, %sil
je 0x1ebbc3
movq %rcx, -0x18(%r11)
pxor %xmm3, %xmm5
pextrw $0x4, %xmm5, %esi
testb $0x1, %sil
je 0x1ebbd5
movq %rcx, (%r11)
paddq %xmm4, %xmm1
addq $0x30, %r11
addq $-0x2, %rdx
jne 0x1ebb8d
jmp 0x1ebc19
xorl %ecx, %ecx
xorl %r9d, %r9d
xorl %esi, %esi
xorl %r8d, %r8d
leaq 0x1(%rsi), %rdx
cmpq %r13, %rdx
movq (%rsp), %rax
jne 0x1ebc43
subq %r9, %rax
cmpq %rax, %r8
cmovaq %r8, %rax
leaq (%rsi,%rsi,2), %rdx
cmpq 0x8(%r11,%rdx,8), %rcx
jne 0x1ebc43
leaq (%r11,%rdx,8), %rcx
movq %rax, 0x10(%rcx)
movq %r13, 0x28(%rbx)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x76d1d
callq 0x76d54
callq 0x76dc4
callq 0x76e36
callq 0x76dfd
callq 0x76d8b