// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x78, %rsp
movq %rdi, 0x70(%rsp)
movq %rsi, 0x68(%rsp)
movq %rdx, 0x60(%rsp)
movl $0x30, %edi
leaq 0x2d860a(%rip), %rsi    # 0x587ef9
movl $0x72, %edx
callq 0xe80f0
movq %rax, 0x58(%rsp)
imulq $0x18, 0x60(%rsp), %rdi
leaq 0x2d85ee(%rip), %rsi    # 0x587ef9
movl $0x73, %edx
callq 0xe80f0
movq %rax, %rcx
movq 0x58(%rsp), %rax
movq %rcx, (%rax)
movq 0x70(%rsp), %rdi
callq 0xaec30
movq %rax, %rcx
movq 0x58(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x70(%rsp), %rdi
callq 0xa9d00
movq %rax, %rcx
movq 0x58(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x70(%rsp), %rdi
callq 0xa9d50
movq %rax, %rcx
movq 0x58(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x58(%rsp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x2af98a
movq 0x70(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xb09f0
movq %rax, %rcx
movq 0x58(%rsp), %rax
movq %rcx, 0x10(%rax)
jmp 0x2af997
movq 0x58(%rsp), %rax
movq $0x0, 0x10(%rax)
movq 0x60(%rsp), %rax
cmpq 0x68(%rsp), %rax
jb 0x2afa39
movq $0x0, 0x50(%rsp)
movq 0x50(%rsp), %rax
cmpq 0x68(%rsp), %rax
jae 0x2afa26
movq 0x50(%rsp), %rcx
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x18, 0x50(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x18, 0x50(%rsp), %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq 0x58(%rsp), %rdi
movq 0x50(%rsp), %rsi
movq 0x50(%rsp), %rdx
callq 0x2af880
movq %rax, %rcx
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x18, 0x50(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movq 0x50(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x50(%rsp)
jmp 0x2af9b0
movq 0x68(%rsp), %rcx
movq 0x58(%rsp), %rax
movq %rcx, 0x28(%rax)
jmp 0x2afe66
movq 0x58(%rsp), %rax
movq 0x18(%rax), %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq 0x60(%rsp)
movq %rax, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
movq $0x0, 0x48(%rsp)
movq 0x40(%rsp), %rcx
xorl %eax, %eax
cmpq 0x60(%rsp), %rcx
movb %al, 0x7(%rsp)
jae 0x2afa85
movq 0x48(%rsp), %rax
cmpq 0x68(%rsp), %rax
setb %al
movb %al, 0x7(%rsp)
movb 0x7(%rsp), %al
testb $0x1, %al
jne 0x2afa92
jmp 0x2afb3a
movq 0x58(%rsp), %rdi
movq 0x48(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x68(%rsp), %rcx
callq 0x2afe70
movq %rax, 0x28(%rsp)
movq 0x48(%rsp), %rcx
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x18, 0x40(%rsp), %rdx
addq %rdx, %rax
movq %rcx, (%rax)
cmpq $-0x1, 0x28(%rsp)
jne 0x2afaff
movq 0x68(%rsp), %rcx
subq $0x1, %rcx
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x18, 0x40(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movq 0x40(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x40(%rsp)
jmp 0x2afb3a
movq 0x28(%rsp), %rcx
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x18, 0x40(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movq 0x28(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x48(%rsp)
movq 0x40(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x40(%rsp)
jmp 0x2afa62
jmp 0x2afb3c
cmpq $0x0, 0x40(%rsp)
jbe 0x2afb6e
movq 0x58(%rsp), %rax
movq (%rax), %rax
movq 0x40(%rsp), %rcx
subq $0x1, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq 0x68(%rsp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
je 0x2afba6
movq 0x38c42b(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x266494(%rip), %rsi    # 0x516013
leaq 0x2d8391(%rip), %rdx    # 0x587f17
leaq 0x2d83c2(%rip), %rcx    # 0x587f4f
leaq 0x2d8365(%rip), %r8     # 0x587ef9
movl $0x9e, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2afba8
movq 0x40(%rsp), %rax
movq %rax, 0x38(%rsp)
cmpq $0x1, 0x38(%rsp)
jne 0x2afbd8
movq 0x70(%rsp), %rdi
callq 0xb10b0
movq %rax, %rcx
movq 0x58(%rsp), %rax
movq (%rax), %rax
movq %rcx, 0x10(%rax)
jmp 0x2afe58
movq 0x58(%rsp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x2afc2c
movq $0x0, 0x40(%rsp)
movq 0x40(%rsp), %rax
cmpq 0x38(%rsp), %rax
jae 0x2afc27
movq 0x58(%rsp), %rax
movq 0x10(%rax), %rcx
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x18, 0x40(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movq 0x40(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x40(%rsp)
jmp 0x2afbed
jmp 0x2afe56
movq $0x0, 0x20(%rsp)
movq $0x0, 0x18(%rsp)
movq $0x0, 0x8(%rsp)
cmpq $0x1, 0x68(%rsp)
ja 0x2afc87
movq 0x38c34a(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2663b3(%rip), %rsi    # 0x516013
leaq 0x2d8303(%rip), %rdx    # 0x587f6a
leaq 0x2d82e1(%rip), %rcx    # 0x587f4f
leaq 0x2d8284(%rip), %r8     # 0x587ef9
movl $0xaf, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2afc89
movq $0x0, 0x48(%rsp)
movq 0x48(%rsp), %rax
movq 0x68(%rsp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x2afdab
jmp 0x2afcab
movq 0x20(%rsp), %rax
movq 0x58(%rsp), %rcx
movq 0x8(%rcx), %rcx
movq 0x48(%rsp), %rdx
cmpq (%rcx,%rdx,8), %rax
jb 0x2afcfc
movq 0x38c2d5(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x26633e(%rip), %rsi    # 0x516013
leaq 0x2d82a1(%rip), %rdx    # 0x587f7d
leaq 0x2d826c(%rip), %rcx    # 0x587f4f
leaq 0x2d820f(%rip), %r8     # 0x587ef9
movl $0xb2, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2afcfe
movq 0x58(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x48(%rsp), %rcx
movq (%rax,%rcx,8), %rax
subq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x8(%rsp), %rax
cmpq 0x10(%rsp), %rax
jae 0x2afd30
movq 0x10(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x48(%rsp), %rax
movq 0x58(%rsp), %rcx
movq (%rcx), %rcx
imulq $0x18, 0x18(%rsp), %rdx
addq %rdx, %rcx
cmpq 0x8(%rcx), %rax
jne 0x2afd7d
movq 0x8(%rsp), %rcx
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x18, 0x18(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movq 0x18(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x18(%rsp)
movq $0x0, 0x8(%rsp)
movq 0x58(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x48(%rsp), %rcx
movq (%rax,%rcx,8), %rax
addq $0x1, %rax
movq %rax, 0x20(%rsp)
movq 0x48(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x48(%rsp)
jmp 0x2afc92
movq 0x58(%rsp), %rax
movq 0x18(%rax), %rax
subq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x8(%rsp), %rax
cmpq 0x10(%rsp), %rax
jae 0x2afdd4
movq 0x10(%rsp), %rax
movq %rax, 0x8(%rsp)
jmp 0x2afdd6
movq 0x18(%rsp), %rax
addq $0x1, %rax
cmpq 0x38(%rsp), %rax
jne 0x2afe02
movq 0x48(%rsp), %rax
movq 0x58(%rsp), %rcx
movq (%rcx), %rcx
imulq $0x18, 0x18(%rsp), %rdx
addq %rdx, %rcx
cmpq 0x8(%rcx), %rax
je 0x2afe3a
movq 0x38c197(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x266200(%rip), %rsi    # 0x516013
leaq 0x2d8186(%rip), %rdx    # 0x587fa0
leaq 0x2d812e(%rip), %rcx    # 0x587f4f
leaq 0x2d80d1(%rip), %r8     # 0x587ef9
movl $0xc6, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2afe3c
movq 0x8(%rsp), %rcx
movq 0x58(%rsp), %rax
movq (%rax), %rax
imulq $0x18, 0x18(%rsp), %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
jmp 0x2afe58
movq 0x38(%rsp), %rcx
movq 0x58(%rsp), %rax
movq %rcx, 0x28(%rax)
movq 0x58(%rsp), %rax
addq $0x78, %rsp
retq