// File: /workspace/github_c_makefile_star2_O2/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, %r15
movq %r8, %r13
movq %rcx, 0x18(%rsp)
movq %rdx, %rbp
movl %edi, %ebx
testq %rsi, %rsi
sete %al
testq %r8, %r8
setne %cl
testb %cl, %al
jne 0x1a0ae6
testq %rsi, %rsi
je 0x1a115b
testq %r13, %r13
jne 0x1a115b
movq %rsi, 0x8(%rsp)
movq 0x90(%rsp), %r12
leaq 0x1b8176(%rip), %rsi    # 0x358c70
pushq $0x38
popq %rdi
movl $0xbc, %edx
callq 0x93160
movq %rax, %r14
andq $0x0, 0x20(%rax)
cmpq 0x18(%rsp), %rbp
seta %cl
testq %r13, %r13
setne %dl
addq $0x10, %rax
orb %cl, %dl
jne 0x1a0b41
movq %rbp, (%rax)
testq %rbp, %rbp
je 0x1a0b49
leaq -0x1(%rbp), %rsi
movq 0x8(%rsp), %rdi
callq 0x134141
movq %rax, 0x18(%r14)
jmp 0x1a0b4e
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
jmp 0x1a0b4e
andq $0x0, 0x18(%r14)
movq %r13, 0x30(%r14)
movl %ebx, %ecx
testq %r12, %r12
movq %r15, 0x38(%rsp)
je 0x1a0b8c
cmpq %r12, %rcx
movq %rbp, 0x20(%rsp)
ja 0x1a0b7f
cmpq $0x0, 0x8(%rsp)
je 0x1a0bd2
movq 0x8(%rsp), %rdi
callq 0x1356a1
cmpl $0x1, %eax
jne 0x1a0bd2
movl $0x1, 0xc(%r14)
pushq $0x1
popq %rbx
jmp 0x1a0bde
andl $0x0, 0xc(%r14)
testl %ebx, %ebx
je 0x1a112a
movq 0x98(%rsp), %rax
movq %r14, %rdx
addq $0xc, %rdx
movq %rdx, 0x10(%rsp)
xorl %edx, %edx
divq %rcx
incq %rax
movq %rax, 0x28(%r14)
movq %r15, %rdi
callq 0x1a067e
movq %rax, 0x20(%r14)
andq $0x0, (%r14)
movl 0xc(%r14), %r9d
jmp 0x1a0da1
movl %ebx, 0xc(%r14)
testl %ebx, %ebx
je 0x1a112a
movq %r13, 0x28(%rsp)
testq %r13, %r13
setne %r15b
movq %r14, %rax
addq $0xc, %rax
movq %rax, 0x10(%rsp)
movl %ebx, %ecx
movq %r12, %rax
xorl %edx, %edx
divq %rcx
movq %rax, 0x48(%rsp)
imulq $0x30, %rcx, %rdi
leaq 0x1b8060(%rip), %rsi    # 0x358c70
movl $0xf0, %edx
callq 0x93160
movq %rax, (%r14)
movl 0xc(%r14), %r9d
movq %r12, %rax
xorl %edx, %edx
divq %r9
movq %rdx, %rbp
andq $0x0, 0x28(%r14)
movq 0x20(%rsp), %rax
cmpq 0x18(%rsp), %rax
seta %al
andb %r15b, %al
movb %al, 0x7(%rsp)
pushq $0x18
popq %r15
xorl %r13d, %r13d
xorl %r12d, %r12d
xorl %ecx, %ecx
xorl %esi, %esi
movq %r14, 0x40(%rsp)
movl %r9d, %eax
cmpq %rax, %r13
movq 0x8(%rsp), %rdi
jae 0x1a0d90
subl $0x1, %ebp
movl $0x0, %eax
cmovbl %eax, %ebp
movq 0x48(%rsp), %rax
sbbq $-0x1, %rax
addq %rax, %rcx
testq %rdi, %rdi
movq %rsi, 0x30(%rsp)
movq %rcx, 0x50(%rsp)
je 0x1a0cb8
decl %r9d
cmpq %r9, %r13
jne 0x1a0cda
movq 0x18(%rsp), %rax
movq %rax, %rbx
cmpq %rax, 0x20(%rsp)
jbe 0x1a0cf1
callq 0x1359e8
movq 0x8(%rsp), %rdi
movq %rax, %rbx
decq %rbx
jmp 0x1a0cf1
cmpb $0x0, 0x7(%rsp)
je 0x1a1088
decl %r9d
cmpq %r9, %r13
jne 0x1a0d04
movq 0x28(%rsp), %r14
movq %r14, %rdi
callq 0x2b751a
jmp 0x1a0d14
movq 0x20(%rsp), %rsi
movq 0x18(%rsp), %rdx
callq 0x135ad5
movq 0x8(%rsp), %rdi
movq %rax, %rbx
movq %rbx, %rsi
callq 0x134141
subq 0x18(%r14), %rax
jae 0x1a0d27
jmp 0x1a102e
movq 0x28(%rsp), %r14
movq %r14, %rdi
movq %rcx, %rsi
callq 0x2b751f
movq %rax, %rbx
movq %r14, %rdi
movq %rax, %rsi
callq 0x2b74a3
movq 0x40(%rsp), %r14
movq 0x30(%rsp), %rsi
movq (%r14), %rcx
movq %rbx, (%rcx,%r15)
testq %r13, %r13
je 0x1a0d54
movq %rax, %rdx
subq %r12, %rdx
jb 0x1a0ffd
movq %rdx, -0x18(%rcx,%r15)
addq 0x18(%r14), %r12
movq %r12, -0x10(%rcx,%r15)
jmp 0x1a0d62
movq %rax, (%rcx)
movq 0x18(%r14), %rdx
movq %rdx, 0x8(%rcx)
movq %rax, %rdx
cmpq %rdx, 0x28(%r14)
jae 0x1a0d6c
movq %rdx, 0x28(%r14)
addq %rdx, %rsi
movq %rsi, -0x8(%rcx,%r15)
incq %r13
movq 0x10(%rsp), %rcx
movl (%rcx), %r9d
addq $0x30, %r15
movq %rax, %r12
movq 0x50(%rsp), %rcx
jmp 0x1a0c58
movq 0x90(%rsp), %rdx
cmpq %rdx, %rsi
jne 0x1a10c0
testl %r9d, %r9d
je 0x1a0fba
movq 0xa0(%rsp), %rbx
xorl %edx, %edx
xorl %eax, %eax
xorl %ecx, %ecx
movl %r9d, %edi
cmpq %rdi, %rax
jae 0x1a0e09
movq (%r14), %rdi
cmpq $0x0, (%rdi,%rdx)
je 0x1a0e00
movl %ecx, %r8d
cmpq %r8, %rax
jbe 0x1a0dfe
leaq (%rdi,%rdx), %rsi
imulq $0x30, %r8, %r8
movups (%rsi), %xmm0
movups 0x10(%rsi), %xmm1
movups 0x20(%rsi), %xmm2
movups %xmm2, 0x20(%rdi,%r8)
movups %xmm1, 0x10(%rdi,%r8)
movups %xmm0, (%rdi,%r8)
movq 0x10(%rsp), %rsi
movl (%rsi), %r9d
incl %ecx
incq %rax
addq $0x30, %rdx
jmp 0x1a0db8
cmpl %eax, %ecx
jae 0x1a0e6d
movq (%r14), %rdx
leal -0x1(%r9), %edi
imulq $0x30, %rdi, %rdi
movq 0x18(%rdx,%rdi), %rdi
leal -0x1(%rcx), %r8d
imulq $0x30, %r8, %r8
movq %rdi, 0x18(%rdx,%r8)
addl %ecx, %r9d
subl %eax, %r9d
movl %r9d, 0xc(%r14)
cmpl %ecx, %r9d
movl %ecx, %r9d
je 0x1a0e70
movq 0x297125(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1441c6(%rip), %rsi    # 0x2e5013
leaq 0x1b828d(%rip), %rdx    # 0x3590e1
leaq 0x1b8266(%rip), %rcx    # 0x3590c1
leaq 0x1b7e0e(%rip), %r8     # 0x358c70
movl $0x9a, %r9d
jmp 0x1a10b4
movl %r9d, %ecx
leaq 0x1b82bf(%rip), %r15    # 0x359136
xorl %r13d, %r13d
xorl %r12d, %r12d
xorl %ebp, %ebp
movl %r9d, %eax
cmpq %rax, %r12
jae 0x1a0ebd
movq (%r14), %rax
movq (%rax,%r13), %rcx
testq %rcx, %rcx
je 0x1a0fcc
addq %rcx, %rbp
movq %rbx, %rdi
movq %r15, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0x92e71
incq %r12
movq 0x10(%rsp), %rax
movl (%rax), %ecx
addq $0x30, %r13
movl %ecx, %r9d
jmp 0x1a0e7f
cmpq 0x90(%rsp), %rbp
jne 0x1a10fc
testl %ecx, %ecx
movq 0x38(%rsp), %r12
je 0x1a0fba
movq (%r14), %rdx
testq %rdx, %rdx
je 0x1a118c
xorl %ebx, %ebx
xorl %r15d, %r15d
movl %ecx, %esi
cmpq %rsi, %r15
jae 0x1a0f56
testq %rbx, %rbx
je 0x1a0eff
movq -0x18(%rdx,%rbx), %rax
incq %rax
jmp 0x1a0f03
movq 0x10(%r14), %rax
movq 0x30(%r14), %rdi
testq %rdi, %rdi
je 0x1a0f1d
movq %rax, %rsi
callq 0x2b75cc
movq (%r14), %rdx
movl 0xc(%r14), %esi
movl %esi, %ecx
movq %rax, 0x20(%rdx,%rbx)
cmpq %r15, %rsi
jbe 0x1a105c
movq 0x18(%rdx,%rbx), %rax
movq 0x30(%r14), %rdi
testq %rdi, %rdi
je 0x1a0f48
movq %rax, %rsi
callq 0x2b75cc
movq (%r14), %rdx
movl 0xc(%r14), %ecx
movq %rax, 0x28(%rdx,%rbx)
incq %r15
addq $0x30, %rbx
jmp 0x1a0ee9
addq $0x50, %rdx
pushq $0x1
popq %rax
cmpq %rsi, %rax
jae 0x1a0f7a
movq -0x28(%rdx), %rdi
incq %rdi
cmpq %rdi, (%rdx)
je 0x1a0f71
movq %rdi, (%rdx)
incq %rax
addq $0x30, %rdx
jmp 0x1a0f5d
xorl %ebx, %ebx
cmpl %ecx, %ebx
jae 0x1a0fba
movl %ebx, %edi
movq %r14, %rsi
callq 0x1a0914
movq %rax, %r15
movl %ebx, %edi
movq %r14, %rsi
callq 0x1a096b
movq %r12, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x1a05ec
cmpq %rax, 0x20(%r14)
jae 0x1a0faf
movq %rax, 0x20(%r14)
incl %ebx
movq 0x10(%rsp), %rax
movl (%rax), %ecx
jmp 0x1a0f7c
movq %r14, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x296f95(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x144036(%rip), %rsi    # 0x2e5013
leaq 0x1b8121(%rip), %rdx    # 0x359105
leaq 0x1b80d6(%rip), %rcx    # 0x3590c1
leaq 0x1b7c7e(%rip), %r8     # 0x358c70
movl $0x9e, %r9d
jmp 0x1a10b4
movq 0x296f64(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x144005(%rip), %rsi    # 0x2e5013
leaq 0x1b7dd7(%rip), %rdx    # 0x358dec
leaq 0x1b7d65(%rip), %rcx    # 0x358d81
leaq 0x1b7c4d(%rip), %r8     # 0x358c70
movl $0x125, %r9d            # imm = 0x125
jmp 0x1a10b4
movq 0x296f33(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x143fd4(%rip), %rsi    # 0x2e5013
leaq 0x1b7d5e(%rip), %rdx    # 0x358da4
leaq 0x1b7d34(%rip), %rcx    # 0x358d81
leaq 0x1b7c1c(%rip), %r8     # 0x358c70
movl $0x110, %r9d            # imm = 0x110
jmp 0x1a10b4
movq 0x296f05(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x143fa6(%rip), %rsi    # 0x2e5013
leaq 0x1b7dfc(%rip), %rdx    # 0x358e70
leaq 0x1b80e6(%rip), %rcx    # 0x359161
leaq 0x1b7bee(%rip), %r8     # 0x358c70
pushq $0x71
popq %r9
jmp 0x1a10b4
movq 0x296ed9(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x143f7a(%rip), %rsi    # 0x2e5013
leaq 0x1b7d2b(%rip), %rdx    # 0x358dcb
leaq 0x1b7cda(%rip), %rcx    # 0x358d81
leaq 0x1b7bc2(%rip), %r8     # 0x358c70
movl $0x114, %r9d            # imm = 0x114
xorl %eax, %eax
callq 0x17a50
callq 0x17390
leaq 0x1b7d3f(%rip), %rdi    # 0x358e06
xorl %eax, %eax
callq 0x17070
movq 0x296e93(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x143f34(%rip), %rsi    # 0x2e5013
leaq 0x1b7d4e(%rip), %rdx    # 0x358e34
leaq 0x1b7c94(%rip), %rcx    # 0x358d81
leaq 0x1b7b7c(%rip), %r8     # 0x358c70
movl $0x139, %r9d            # imm = 0x139
jmp 0x1a10b4
movq 0x296e65(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x143f06(%rip), %rsi    # 0x2e5013
leaq 0x1b8036(%rip), %rdx    # 0x35914a
leaq 0x1b7fa6(%rip), %rcx    # 0x3590c1
leaq 0x1b7b4e(%rip), %r8     # 0x358c70
movl $0xa4, %r9d
jmp 0x1a10b4
movq 0x296e37(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x143ed8(%rip), %rsi    # 0x2e5013
leaq 0x1b7c52(%rip), %rdx    # 0x358d94
leaq 0x1b7c38(%rip), %rcx    # 0x358d81
leaq 0x1b7b20(%rip), %r8     # 0x358c70
movl $0xde, %r9d
jmp 0x1a10b4
movq 0x296e06(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x143ea7(%rip), %rsi    # 0x2e5013
leaq 0x1b7bcb(%rip), %rdx    # 0x358d3e
leaq 0x1b7c07(%rip), %rcx    # 0x358d81
leaq 0x1b7aef(%rip), %r8     # 0x358c70
movl $0xbb, %r9d
jmp 0x1a10b4
movq 0x296dd5(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x143e76(%rip), %rsi    # 0x2e5013
leaq 0x1b7ae5(%rip), %rdx    # 0x358c89
leaq 0x1b7bd6(%rip), %rcx    # 0x358d81
leaq 0x1b7abe(%rip), %r8     # 0x358c70
movl $0x13e, %r9d            # imm = 0x13E
jmp 0x1a10b4