// File: /workspace/github_c_makefile_star2_O1/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 $0x48, %rsp
movq %r9, %r12
movq %r8, %r15
movq %rcx, 0x18(%rsp)
movq %rdx, %r13
movl %edi, %ebx
testq %rsi, %rsi
sete %al
testq %r8, %r8
setne %cl
testb %cl, %al
jne 0x1f909f
testq %rsi, %rsi
je 0x1f95c8
testq %r15, %r15
jne 0x1f95c8
movq %rsi, 0x10(%rsp)
movq 0x80(%rsp), %r14
leaq 0x1c8dcf(%rip), %rsi    # 0x3c1e82
movl $0x38, %edi
movl $0xbc, %edx
callq 0x1092b2
movq %rax, %rsi
movq $0x0, 0x20(%rax)
cmpq 0x18(%rsp), %r13
seta %cl
testq %r15, %r15
setne %dl
addq $0x10, %rax
orb %cl, %dl
movq %rsi, 0x8(%rsp)
jne 0x1f9109
movq %r13, (%rax)
testq %r13, %r13
je 0x1f9111
leaq -0x1(%r13), %rsi
movq 0x10(%rsp), %rdi
callq 0x193482
movq 0x8(%rsp), %rsi
movq %rax, 0x18(%rsi)
jmp 0x1f9119
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
jmp 0x1f9119
movq $0x0, 0x18(%rsi)
movq %r15, 0x30(%rsi)
testq %r14, %r14
je 0x1f914e
movl %ebx, %eax
movl $0x1, %ebp
cmpq %r14, %rax
ja 0x1f9150
cmpq $0x0, 0x10(%rsp)
je 0x1f914a
movq 0x10(%rsp), %rdi
callq 0x1946cf
movq 0x8(%rsp), %rsi
cmpl $0x1, %eax
je 0x1f9150
movl %ebx, %ebp
jmp 0x1f9150
xorl %ebp, %ebp
movl %ebp, 0xc(%rsi)
testl %ebp, %ebp
movq %r12, 0x30(%rsp)
je 0x1f9331
movq %r13, 0x28(%rsp)
movq %r15, 0x20(%rsp)
movl %ebp, %ecx
movq %r14, %rax
xorl %edx, %edx
divq %rcx
movq %rax, 0x40(%rsp)
shlq $0x4, %rcx
leaq (%rcx,%rcx,2), %rdi
leaq 0x1c8cfa(%rip), %rsi    # 0x3c1e82
movl $0xf0, %edx
callq 0x1092b2
movq 0x8(%rsp), %rsi
movq %rax, (%rsi)
movl 0xc(%rsi), %ecx
movq $0x0, 0x28(%rsi)
movl $0x0, %ebp
testq %rcx, %rcx
je 0x1f9314
cmpq $0x0, 0x20(%rsp)
setne %sil
movq 0x80(%rsp), %rax
xorl %edx, %edx
divq %rcx
movq %rdx, %r8
movq 0x28(%rsp), %rax
cmpq 0x18(%rsp), %rax
seta %al
andb %sil, %al
movb %al, 0x7(%rsp)
xorl %r15d, %r15d
xorl %r13d, %r13d
xorl %ebp, %ebp
xorl %ebx, %ebx
xorl %r14d, %r14d
movq %rbx, %rax
subl $0x1, %r8d
movl $0x0, %edx
cmovbl %edx, %r8d
movq 0x40(%rsp), %rbx
sbbq $-0x1, %rbx
addq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
movq %r8, 0x38(%rsp)
je 0x1f9241
decl %ecx
cmpq %rcx, %r13
jne 0x1f925f
movq 0x18(%rsp), %rax
movq %rax, %r12
cmpq %rax, 0x28(%rsp)
jbe 0x1f9279
callq 0x1949a8
movq 0x10(%rsp), %rdi
movq %rax, %r12
decq %r12
jmp 0x1f9279
cmpb $0x0, 0x7(%rsp)
je 0x1f95b4
decl %ecx
cmpq %rcx, %r13
jne 0x1f9291
movq 0x20(%rsp), %rdi
callq 0x321d41
jmp 0x1f929e
movq 0x28(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %rbx, %rcx
callq 0x194a79
movq 0x10(%rsp), %rdi
movq %rax, %r12
movq %r12, %rsi
callq 0x193482
movq 0x8(%rsp), %rsi
subq 0x18(%rsi), %rax
jae 0x1f92b3
jmp 0x1f95aa
movq 0x20(%rsp), %rdi
movq %rbx, %rsi
callq 0x321d46
movq %rax, %r12
movq 0x20(%rsp), %rdi
movq %rax, %rsi
callq 0x321cf6
movq 0x8(%rsp), %rsi
movq 0x38(%rsp), %r8
movq (%rsi), %rcx
movq %r12, 0x18(%rcx,%r15)
testq %r15, %r15
je 0x1f92db
movq %rax, %rdx
subq %r14, %rdx
jb 0x1f95af
movq %rdx, (%rcx,%r15)
addq 0x18(%rsi), %r14
jmp 0x1f92e3
movq %rax, (%rcx,%r15)
movq 0x18(%rsi), %r14
movq %r14, 0x8(%rcx,%r15)
movq (%rcx,%r15), %rdx
cmpq %rdx, 0x28(%rsi)
jae 0x1f92f6
movq %rdx, 0x28(%rsi)
addq %rdx, %rbp
movq %rbp, 0x10(%rcx,%r15)
incq %r13
movl 0xc(%rsi), %ecx
addq $0x30, %r15
movq %rax, %r14
cmpq %rcx, %r13
jb 0x1f91ee
movq 0x80(%rsp), %rax
cmpq %rax, %rbp
movq 0x30(%rsp), %r12
je 0x1f9367
movq %rbp, %rdi
movq %rax, %rsi
callq 0x7b880
testl %ebx, %ebx
je 0x1f95cd
movq 0x88(%rsp), %rax
movl %ebx, %ecx
xorl %edx, %edx
divq %rcx
incq %rax
movq %rax, 0x28(%rsi)
movq %r12, %rdi
callq 0x1f8d23
movq 0x8(%rsp), %rsi
movq %rax, 0x20(%rsi)
movq $0x0, (%rsi)
testq %rsi, %rsi
je 0x1f95b9
cmpl $0x0, 0xc(%rsi)
je 0x1f9478
movq 0x90(%rsp), %rbx
xorl %edx, %edx
xorl %ecx, %ecx
xorl %eax, %eax
movq (%rsi), %r9
cmpq $0x0, (%r9,%rdx)
je 0x1f93c6
movl %eax, %edi
cmpq %rdi, %rcx
jbe 0x1f93c4
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)
incl %eax
incq %rcx
movl 0xc(%rsi), %r9d
addq $0x30, %rdx
cmpq %r9, %rcx
jb 0x1f9388
cmpl %ecx, %eax
jae 0x1f9412
movq (%rsi), %rdx
leal -0x1(%r9), %edi
leaq (%rdi,%rdi,2), %rdi
shlq $0x4, %rdi
movq 0x18(%rdx,%rdi), %rdi
leal -0x1(%rax), %r8d
leaq (%r8,%r8,2), %r8
shlq $0x4, %r8
movq %rdi, 0x18(%rdx,%r8)
addl %eax, %r9d
subl %ecx, %r9d
movl %r9d, 0xc(%rsi)
cmpl %eax, %r9d
jne 0x1f95d2
cmpl $0x0, 0xc(%rsi)
je 0x1f9462
leaq 0x1c8f29(%rip), %r15    # 0x3c2348
xorl %r13d, %r13d
xorl %r12d, %r12d
xorl %r14d, %r14d
movq (%rsi), %rax
movq (%rax,%r13), %rcx
testq %rcx, %rcx
je 0x1f95a5
movq %rsi, %rbp
addq %rcx, %r14
movq %rbx, %rdi
movq %r15, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0x10906e
incq %r12
movl 0xc(%rbp), %eax
addq $0x30, %r13
cmpq %rax, %r12
movq %rbp, %rsi
jb 0x1f9428
jmp 0x1f9465
xorl %r14d, %r14d
cmpq 0x80(%rsp), %r14
movq 0x30(%rsp), %r12
jne 0x1f95c3
cmpl $0x0, 0xc(%rsi)
je 0x1f958e
cmpq $0x0, (%rsi)
je 0x1f95be
movl 0xc(%rsi), %ecx
testl %ecx, %ecx
je 0x1f9517
xorl %ebx, %ebx
xorl %r14d, %r14d
testq %rbx, %rbx
je 0x1f94ae
movq (%rsi), %rax
movq -0x18(%rax,%rbx), %rax
incq %rax
jmp 0x1f94b2
movq 0x10(%rsi), %rax
movq 0x30(%rsi), %rdi
testq %rdi, %rdi
je 0x1f94c8
movq %rax, %rsi
callq 0x321dc9
movq 0x8(%rsp), %rsi
movq (%rsi), %rcx
movq %rax, 0x20(%rcx,%rbx)
testq %rcx, %rcx
je 0x1f95a0
movl 0xc(%rsi), %eax
cmpq %rax, %r14
jae 0x1f95a0
movq 0x18(%rcx,%rbx), %rax
movq 0x30(%rsi), %rdi
testq %rdi, %rdi
je 0x1f9500
movq %rax, %rsi
callq 0x321dc9
movq 0x8(%rsp), %rsi
movq (%rsi), %rcx
movq %rax, 0x28(%rcx,%rbx)
incq %r14
movl 0xc(%rsi), %ecx
addq $0x30, %rbx
cmpq %rcx, %r14
jb 0x1f949c
cmpl $0x2, %ecx
jb 0x1f954c
movq (%rsi), %rax
movl %ecx, %ecx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
addq $-0x30, %rcx
xorl %edx, %edx
movq 0x28(%rax,%rdx), %rdi
incq %rdi
cmpq %rdi, 0x50(%rax,%rdx)
je 0x1f9543
movq %rdi, 0x50(%rax,%rdx)
addq $0x30, %rdx
cmpq %rdx, %rcx
jne 0x1f952f
cmpl $0x0, 0xc(%rsi)
je 0x1f958e
xorl %ebx, %ebx
movl %ebx, %edi
callq 0x1f8f44
movq %rax, %r15
movl %ebx, %edi
movq 0x8(%rsp), %rsi
callq 0x1f8f6c
movq %r12, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x1f8cb8
movq 0x8(%rsp), %rsi
cmpq %rax, 0x20(%rsi)
jae 0x1f9587
movq %rax, 0x20(%rsi)
incl %ebx
cmpl 0xc(%rsi), %ebx
jb 0x1f9554
movq %rsi, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x7b978
callq 0x7b906
callq 0x7b7d5
callq 0x7b847
callq 0x7b80e
callq 0x7b9e8
callq 0x7b9af
callq 0x7b93f
callq 0x7b79c
callq 0x7ba21
callq 0x7b8cd