// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/match/sfx-partssuf.c
// Function: gt_suftabparts_new
GtSuftabparts *gt_suftabparts_new(unsigned int numofparts,
                                  const GtBcktab *bcktab,
                                  GtCodetype mincode,
                                  GtCodetype maxcode,
                                  const GtFirstcodestab *fct,
                                  const GtSfxmappedrangelist *sfxmrlist,
                                  GtUword numofsuffixestoinsert,
                                  GtUword fullspecials,
                                  GtLogger *logger)
{
  GtSuftabparts *suftabparts;
  GtUword size_mapped;
  unsigned int part;

  gt_assert((bcktab == NULL && fct != NULL) ||
            (bcktab != NULL && fct == NULL));
  suftabparts = gt_malloc(sizeof *suftabparts);
  suftabparts->largestsizemappedpartwise = 0;
  if (mincode <= maxcode && fct == NULL)
  {
    suftabparts->codeoffset = mincode;
    if (mincode > 0)
    {
      suftabparts->partoffset = gt_bcktab_get_leftborder(bcktab,mincode-1);
    } else
    {
      suftabparts->partoffset = 0;
    }
  } else
  {
    suftabparts->codeoffset = 0;
    suftabparts->partoffset = 0;
  }
  suftabparts->fct = fct;
  if (numofsuffixestoinsert == 0)
  {
    suftabparts->numofparts = 0;
  } else
  {
    if (numofsuffixestoinsert < (GtUword) numofparts ||
        (bcktab != NULL && gt_bcktab_prefixlength(bcktab) == 1U))
    {
      suftabparts->numofparts = 1U;
    } else
    {
      suftabparts->numofparts = numofparts;
    }
  }
  if (suftabparts->numofparts == 0)
  {
    gt_assert(numofparts != 0);
    suftabparts->largestsuftabwidth = fullspecials/numofparts+1;
    suftabparts->largestsizemappedpartwise
      = gt_Sfxmappedrangelist_size_entire(sfxmrlist);
    suftabparts->components = NULL;
  } else
  {
    unsigned int remainder;
    GtUword firstbound = 0, secondbound, suftaboffset = 0, sumofwidth = 0;
    const GtUword widthofsuftabpart
      = numofsuffixestoinsert/suftabparts->numofparts;

    /*printf("%s: parts = "GT_WUT", mincode = "GT_WU", maxcode = "GT_WU"\n",
             __func__,
             suftabparts->numofparts,
             mincode,maxcode);*/

    suftabparts->components
      = gt_malloc(sizeof (*suftabparts->components) * suftabparts->numofparts);
    remainder = (unsigned int) (numofsuffixestoinsert %
                                (GtUword) suftabparts->numofparts);
    suftabparts->largestsuftabwidth = 0;
    for (part=0; part < suftabparts->numofparts; part++)
    {
      GtUword secondidx;
      if (remainder > 0)
      {
        suftaboffset += widthofsuftabpart + 1;
        remainder--;
      } else
      {
        suftaboffset += widthofsuftabpart;
      }
      if (bcktab != NULL)
      {
        if (part == suftabparts->numofparts - 1)
        {
          if (mincode <= maxcode)
          {
            secondidx = maxcode;
          } else
          {
            secondidx = gt_bcktab_numofallcodes(bcktab) - 1;
          }
        } else
        {
          secondidx = gt_bcktab_findfirstlarger(bcktab,mincode,maxcode,
                                                suftaboffset);
        }
        secondbound = gt_bcktab_get_leftborder(bcktab,secondidx);
        gt_assert(secondbound >= suftabparts->partoffset);
        secondbound -= suftabparts->partoffset;
      } else
      {
        gt_assert(fct != NULL && mincode > maxcode);
        if (part == suftabparts->numofparts - 1)
        {
          secondidx = gt_firstcodes_numofsamples(fct);
        } else
        {
          secondidx = gt_firstcodes_findfirstsamplelarger(fct,suftaboffset);
        }
        secondbound = gt_firstcodes_get_sample(fct,secondidx);
      }
      suftabparts->components[part].nextidx = secondidx;
      if (part == 0)
      {
        suftabparts->components[part].widthofpart = secondbound;
        suftabparts->components[part].suftaboffset = suftabparts->partoffset;
      } else
      {
        gt_assert(secondbound >= firstbound);
        suftabparts->components[part].widthofpart = secondbound - firstbound;
        suftabparts->components[part].suftaboffset
          = firstbound + suftabparts->partoffset;
      }
      if (suftabparts->largestsuftabwidth <
          suftabparts->components[part].widthofpart)
      {
        suftabparts->largestsuftabwidth
          = suftabparts->components[part].widthofpart;
      }
      sumofwidth += suftabparts->components[part].widthofpart;
      suftabparts->components[part].sumofwidth = sumofwidth;
      firstbound = secondbound;
    }
    if (sumofwidth != numofsuffixestoinsert)
    {
      printf("sumofwidth = " GT_WU " != " GT_WU "= numofsuffixestosort\n",
              sumofwidth,numofsuffixestoinsert);
    }
    gt_assert(sumofwidth == numofsuffixestoinsert);
  }
  gt_suftabparts_removeemptyparts(suftabparts,numofsuffixestoinsert,logger);
  if (suftabparts->numofparts > 0)
  {
    gt_assert(suftabparts->components != NULL);
    for (part=0; part < suftabparts->numofparts; part++)
    {
      suftabparts->components[part].minindex
        = gt_suftabparts_minindex_raw(part,suftabparts);
      suftabparts->components[part].maxindex
        = gt_suftabparts_maxindex_raw(part,suftabparts);
    }
    for (part=1U; part < suftabparts->numofparts; part++)
    {
      if (suftabparts->components[part].minindex !=
          suftabparts->components[part-1].maxindex + 1)
      {
        suftabparts->components[part].minindex
          = suftabparts->components[part-1].maxindex + 1;
      }
    }
    for (part=0; part < suftabparts->numofparts; part++)
    {
      size_mapped = gt_Sfxmappedrangelist_size_mapped(sfxmrlist,
                                    gt_suftabparts_minindex(part,suftabparts),
                                    gt_suftabparts_maxindex(part,suftabparts));
      if (suftabparts->largestsizemappedpartwise < size_mapped)
      {
        suftabparts->largestsizemappedpartwise = size_mapped;
      }
    }
  }
  return suftabparts;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r9, %r14
movq %r8, %r12
movq %rcx, %rbp
movq %rdx, %r13
movl %edi, %ebx
testq %rsi, %rsi
sete %al
testq %r8, %r8
setne %cl
testb %cl, %al
jne 0x1ef8e7
testq %rsi, %rsi
je 0x1efe40
testq %r12, %r12
jne 0x1efe40
movq %rsi, 0x10(%rsp)
movq 0x90(%rsp), %r15
leaq 0x1c8f15(%rip), %rsi    # 0x3b8810
movl $0x38, %edi
movl $0xbc, %edx
callq 0x104226
movq %rax, %rsi
movq $0x0, 0x20(%rax)
cmpq %rbp, %r13
seta %cl
testq %r12, %r12
setne %dl
addq $0x10, %rax
orb %cl, %dl
movq %rsi, 0x8(%rsp)
jne 0x1ef94f
movq %r13, (%rax)
testq %r13, %r13
je 0x1ef957
leaq -0x1(%r13), %rsi
movq 0x10(%rsp), %rdi
callq 0x18ae26
movq 0x8(%rsp), %rsi
movq %rax, 0x18(%rsi)
jmp 0x1ef95f
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
jmp 0x1ef95f
movq $0x0, 0x18(%rsi)
movq %r12, 0x30(%rsi)
testq %r15, %r15
movq %r14, 0x30(%rsp)
je 0x1ef9a8
movl %ebx, %eax
cmpq %r15, %rax
movq %r12, 0x20(%rsp)
movq %r13, 0x28(%rsp)
ja 0x1ef99a
cmpq $0x0, 0x10(%rsp)
je 0x1ef9fa
movq 0x10(%rsp), %rdi
callq 0x18c054
movq 0x8(%rsp), %rsi
cmpl $0x1, %eax
jne 0x1ef9fa
movl $0x1, 0xc(%rsi)
movl $0x1, %ebx
jmp 0x1efa05
movl $0x0, 0xc(%rsi)
testl %ebx, %ebx
je 0x1efe3b
movq 0x98(%rsp), %rax
movq %rsi, %rcx
addq $0xc, %rcx
movq %rcx, 0x18(%rsp)
movl %ebx, %ecx
xorl %edx, %edx
divq %rcx
incq %rax
movq %rax, 0x28(%rsi)
movq %r14, %rdi
callq 0x1ef570
movq 0x8(%rsp), %rsi
movq %rax, 0x20(%rsi)
movq $0x0, (%rsi)
movl 0xc(%rsi), %r12d
jmp 0x1efbe4
movl %ebx, 0xc(%rsi)
testl %ebx, %ebx
je 0x1efe3b
addq $0xc, %rsi
movq %rsi, 0x18(%rsp)
movl %ebx, %ecx
xorl %r12d, %r12d
movq %r15, %rax
xorl %edx, %edx
divq %rcx
movq %rax, 0x40(%rsp)
shlq $0x4, %rcx
leaq (%rcx,%rcx,2), %rdi
leaq 0x1c8de1(%rip), %rsi    # 0x3b8810
movl $0xf0, %edx
callq 0x104226
movq 0x8(%rsp), %rsi
movq %rax, (%rsi)
movl 0xc(%rsi), %ecx
movq $0x0, 0x28(%rsi)
movl $0x0, %r8d
testq %rcx, %rcx
je 0x1efbd3
cmpq $0x0, 0x20(%rsp)
setne %sil
movq 0x90(%rsp), %rax
xorl %edx, %edx
divq %rcx
cmpq %rbp, 0x28(%rsp)
seta %al
andb %sil, %al
movb %al, 0x7(%rsp)
movl $0x18, %r15d
xorl %r13d, %r13d
movl %ecx, %r12d
xorl %r8d, %r8d
xorl %ebx, %ebx
xorl %r14d, %r14d
movq %rbp, 0x38(%rsp)
movq %rbx, %rax
subl $0x1, %edx
movl $0x0, %ecx
cmovbl %ecx, %edx
movq %rdx, 0x48(%rsp)
movq 0x40(%rsp), %rbx
sbbq $-0x1, %rbx
addq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
movq %r8, 0x50(%rsp)
je 0x1efaec
decl %r12d
cmpq %r12, %r13
jne 0x1efb0e
movq %rbp, %r12
cmpq %rbp, 0x28(%rsp)
jbe 0x1efb26
callq 0x18c2f5
movq 0x10(%rsp), %rdi
movq %rax, %r12
decq %r12
jmp 0x1efb26
cmpb $0x0, 0x7(%rsp)
je 0x1efe26
decl %r12d
cmpq %r12, %r13
jne 0x1efb3e
movq 0x20(%rsp), %rbp
movq %rbp, %rdi
callq 0x31799b
jmp 0x1efb4e
movq 0x28(%rsp), %rsi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x18c3c6
movq 0x10(%rsp), %rdi
movq %rax, %r12
movq %r12, %rsi
callq 0x18ae26
movq 0x8(%rsp), %rsi
subq 0x18(%rsi), %rax
jae 0x1efb66
jmp 0x1efe1c
movq 0x20(%rsp), %rbp
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x3179a0
movq %rax, %r12
movq %rbp, %rdi
movq %rax, %rsi
callq 0x317950
movq 0x8(%rsp), %rsi
movq 0x38(%rsp), %rbp
movq (%rsi), %rcx
movq %r12, (%rcx,%r15)
testq %r13, %r13
je 0x1efb8e
movq %rax, %rdx
subq %r14, %rdx
jb 0x1efe21
movq %rdx, -0x18(%rcx,%r15)
addq 0x18(%rsi), %r14
movq %r14, -0x10(%rcx,%r15)
jmp 0x1efb9c
movq %rax, (%rcx)
movq 0x18(%rsi), %rdx
movq %rdx, 0x8(%rcx)
movq %rax, %rdx
cmpq %rdx, 0x28(%rsi)
jae 0x1efba6
movq %rdx, 0x28(%rsi)
movq 0x50(%rsp), %r8
addq %rdx, %r8
movq %r8, -0x8(%rcx,%r15)
incq %r13
movq 0x18(%rsp), %rcx
movl (%rcx), %r12d
addq $0x30, %r15
movq %rax, %r14
cmpq %r12, %r13
movq 0x48(%rsp), %rdx
jb 0x1efa9a
movq 0x90(%rsp), %r15
cmpq %r15, %r8
jne 0x1efe2b
testl %r12d, %r12d
movq 0x30(%rsp), %rbp
je 0x1efe00
movq 0xa0(%rsp), %rbx
xorl %edx, %edx
xorl %eax, %eax
xorl %ecx, %ecx
movq (%rsi), %r9
cmpq $0x0, (%r9,%rdx)
je 0x1efc46
movl %ecx, %edi
cmpq %rdi, %rax
jbe 0x1efc44
leaq (%r9,%rdx), %r8
leaq (%rdi,%rdi,2), %rdi
shlq $0x4, %rdi
movups (%r8), %xmm0
movups 0x10(%r8), %xmm1
movups 0x20(%r8), %xmm2
movups %xmm2, 0x20(%r9,%rdi)
movups %xmm1, 0x10(%r9,%rdi)
movups %xmm0, (%r9,%rdi)
movq 0x18(%rsp), %rdi
movl (%rdi), %r12d
incl %ecx
incq %rax
movl %r12d, %edi
addq $0x30, %rdx
cmpq %rdi, %rax
jb 0x1efc00
cmpl %eax, %ecx
jae 0x1efc92
movq (%rsi), %rdx
leal -0x1(%r12), %edi
leaq (%rdi,%rdi,2), %rdi
shlq $0x4, %rdi
movq 0x18(%rdx,%rdi), %r8
leal -0x1(%rcx), %edi
leaq (%rdi,%rdi,2), %rdi
shlq $0x4, %rdi
movq %r8, 0x18(%rdx,%rdi)
addl %ecx, %r12d
subl %eax, %r12d
movl %r12d, 0xc(%rsi)
cmpl %ecx, %r12d
je 0x1efc95
callq 0x79ba7
movl %r12d, %ecx
testl %ecx, %ecx
je 0x1efcee
leaq 0x1c9036(%rip), %r15    # 0x3b8cd6
xorl %r13d, %r13d
xorl %r12d, %r12d
xorl %r14d, %r14d
movq (%rsi), %rax
movq (%rax,%r13), %rcx
testq %rcx, %rcx
je 0x1efe12
addq %rcx, %r14
movq %rbx, %rdi
movq %r15, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0x103fe1
incq %r12
movq 0x18(%rsp), %rax
movl (%rax), %ecx
addq $0x30, %r13
cmpq %rcx, %r12
movq 0x8(%rsp), %rsi
jb 0x1efca9
movq 0x90(%rsp), %r15
jmp 0x1efcf1
xorl %r14d, %r14d
cmpq %r15, %r14
jne 0x1efe36
testl %ecx, %ecx
je 0x1efe00
movq (%rsi), %rdx
testq %rdx, %rdx
je 0x1efe45
xorl %ebx, %ebx
xorl %r14d, %r14d
testq %rbx, %rbx
je 0x1efd22
movq -0x18(%rdx,%rbx), %rax
incq %rax
jmp 0x1efd26
movq 0x10(%rsi), %rax
movq 0x30(%rsi), %rdi
testq %rdi, %rdi
je 0x1efd42
movq %rax, %rsi
callq 0x317a23
movq 0x8(%rsp), %rsi
movq (%rsi), %rdx
movl 0xc(%rsi), %ecx
movq %rax, 0x20(%rdx,%rbx)
movl %ecx, %r8d
cmpq %r8, %r14
jae 0x1efe17
movq 0x18(%rdx,%rbx), %rax
movq 0x30(%rsi), %rdi
testq %rdi, %rdi
je 0x1efd78
movq %rax, %rsi
callq 0x317a23
movq 0x8(%rsp), %rsi
movq (%rsi), %rdx
movl 0xc(%rsi), %r8d
movl %r8d, %ecx
movq %rax, 0x28(%rdx,%rbx)
incq %r14
addq $0x30, %rbx
cmpq %r8, %r14
jb 0x1efd13
cmpl $0x2, %ecx
jb 0x1efdbc
movl %ecx, %eax
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
addq $-0x30, %rax
xorl %r8d, %r8d
movq 0x28(%rdx,%r8), %rdi
incq %rdi
cmpq %rdi, 0x50(%rdx,%r8)
je 0x1efdb3
movq %rdi, 0x50(%rdx,%r8)
addq $0x30, %r8
cmpq %r8, %rax
jne 0x1efd9f
testl %ecx, %ecx
je 0x1efe00
xorl %ebx, %ebx
movl %ebx, %edi
callq 0x1ef78e
movq %rax, %r15
movl %ebx, %edi
movq 0x8(%rsp), %rsi
callq 0x1ef7b6
movq %rbp, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x1ef505
movq 0x8(%rsp), %rsi
cmpq %rax, 0x20(%rsi)
jae 0x1efdf5
movq %rax, 0x20(%rsi)
incl %ebx
movq 0x18(%rsp), %rax
cmpl (%rax), %ebx
jb 0x1efdc2
movq %rsi, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x79be0
callq 0x79c52
callq 0x79aaf
callq 0x79b21
callq 0x79ae8
movq %r8, %rdi
movq %r15, %rsi
callq 0x79b5a
callq 0x79c19
callq 0x79cc2
callq 0x79a76
callq 0x79c89