// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/match/randomcodes-sfx-partssuf.c
// Function: gt_suftabparts_rc_new
GtSuftabparts_rc *gt_suftabparts_rc_new(unsigned int numofparts,
                                  const GtBcktab *bcktab,
                                  const GtRandomcodestab *fct,
                                  const GtSfxmappedrangelist *sfxmrlist,
                                  GtUword numofsuffixestoinsert,
                                  GtUword fullspecials,
                                  GtLogger *logger)
{
  GtSuftabparts_rc *suftabparts_rc;
  GtUword size_mapped;
  unsigned int part;

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

    suftabparts_rc->components
      = gt_malloc(sizeof (*suftabparts_rc->components) *
          suftabparts_rc->numofparts);
    remainder = (unsigned int) (numofsuffixestoinsert %
                                (GtUword) suftabparts_rc->numofparts);
    suftabparts_rc->largestsuftabwidth = 0;
    for (part=0; part < suftabparts_rc->numofparts; part++)
    {
      if (remainder > 0)
      {
        suftaboffset += widthofsuftabpart + 1;
        remainder--;
      } else
      {
        suftaboffset += widthofsuftabpart;
      }
      if (part == suftabparts_rc->numofparts - 1)
      {
        secondidx = bcktab != NULL ? gt_bcktab_numofallcodes(bcktab)
                                   : gt_randomcodes_numofsamples(fct);
      } else
      {
        secondidx = bcktab != NULL
                      ? gt_bcktab_findfirstlarger(bcktab,(GtCodetype) 1,
                                                  (GtCodetype) 0,suftaboffset)
                      : gt_randomcodes_findfirstsamplelarger(fct,suftaboffset);
      }
      suftabparts_rc->components[part].nextidx = secondidx;
      secondbound = bcktab != NULL
                      ? gt_bcktab_get_leftborder(bcktab,secondidx)
                      : gt_randomcodes_get_sample(fct,secondidx);
      if (part == 0)
      {
        suftabparts_rc->components[part].widthofpart = secondbound;
        suftabparts_rc->components[part].suftaboffset = 0;
      } else
      {
        gt_assert(secondbound >= randombound);
        suftabparts_rc->components[part].widthofpart = secondbound -
          randombound;
        suftabparts_rc->components[part].suftaboffset = randombound;
      }
      if (suftabparts_rc->largestsuftabwidth <
          suftabparts_rc->components[part].widthofpart)
      {
        suftabparts_rc->largestsuftabwidth
          = suftabparts_rc->components[part].widthofpart;
      }
      sumofwidth += suftabparts_rc->components[part].widthofpart;
      suftabparts_rc->components[part].sumofwidth = sumofwidth;
      randombound = secondbound;
    }
    gt_assert(sumofwidth == numofsuffixestoinsert);
  }
  gt_suftabparts_rc_removeemptyparts(suftabparts_rc,numofsuffixestoinsert,
      logger);
  if (suftabparts_rc->numofparts > 0)
  {
    gt_assert(suftabparts_rc->components != NULL);
    for (part=0; part < suftabparts_rc->numofparts; part++)
    {
      suftabparts_rc->components[part].minindex
        = gt_suftabparts_rc_minindex_raw(part,suftabparts_rc);
      suftabparts_rc->components[part].maxindex
        = gt_suftabparts_rc_maxindex_raw(part,suftabparts_rc);
    }
    for (part=1U; part < suftabparts_rc->numofparts; part++)
    {
      if (suftabparts_rc->components[part].minindex !=
            suftabparts_rc->components[part-1].maxindex + 1)
      {
        suftabparts_rc->components[part].minindex
          = suftabparts_rc->components[part-1].maxindex + 1;
      }
    }
    for (part=0; part < suftabparts_rc->numofparts; part++)
    {
      size_mapped = gt_Sfxmappedrangelist_size_mapped(sfxmrlist,
          gt_suftabparts_rc_minindex(part,suftabparts_rc),
          gt_suftabparts_rc_maxindex(part,suftabparts_rc));
      if (suftabparts_rc->largestsizemappedpartwise < size_mapped)
      {
        suftabparts_rc->largestsizemappedpartwise = size_mapped;
      }
    }
  }
  return suftabparts_rc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, %rbx
movq %r8, %r13
movq %rcx, %r12
movq %rdx, %r15
movl %edi, %ebp
testq %rsi, %rsi
sete %al
testq %rdx, %rdx
setne %cl
testb %cl, %al
jne 0x32dd82
testq %rsi, %rsi
je 0x32e1b9
testq %r15, %r15
jne 0x32e1b9
movq %rsi, 0x10(%rsp)
leaq 0xc02fa(%rip), %rsi     # 0x3ee088
movl $0x28, %edi
movl $0xb8, %edx
callq 0x1092b2
movq $0x0, 0x10(%rax)
movq %r15, 0x20(%rax)
testq %rax, %rax
je 0x32e1aa
movq %rax, %r14
movq %r15, 0x8(%rsp)
testq %r13, %r13
je 0x32dde5
movl %ebp, %eax
movl $0x1, %r15d
cmpq %r13, %rax
movq 0x10(%rsp), %rdi
ja 0x32dde8
testq %rdi, %rdi
je 0x32dde0
callq 0x1946cf
cmpl $0x1, %eax
je 0x32dde8
movl %ebp, %r15d
jmp 0x32dde8
xorl %r15d, %r15d
movl %r15d, 0xc(%r14)
testl %r15d, %r15d
movq %r12, 0x18(%rsp)
movq %r13, (%rsp)
je 0x32df55
movl %r15d, %ecx
movq %r13, %rax
xorl %edx, %edx
divq %rcx
movq %rax, 0x20(%rsp)
shlq $0x4, %rcx
leaq (%rcx,%rcx,2), %rdi
leaq 0xc026b(%rip), %rsi     # 0x3ee088
movl $0xdb, %edx
callq 0x1092b2
movq %rax, (%r14)
movl 0xc(%r14), %esi
movq $0x0, 0x18(%r14)
movl $0x0, %r12d
testq %rsi, %rsi
je 0x32df42
movq (%rsp), %rax
xorl %edx, %edx
divq %rsi
xorl %ebp, %ebp
xorl %r13d, %r13d
xorl %r12d, %r12d
xorl %ecx, %ecx
xorl %r15d, %r15d
addq 0x20(%rsp), %rcx
subl $0x1, %edx
movl $0x0, %eax
cmovbl %eax, %edx
sbbq $-0x1, %rcx
decl %esi
cmpq %rsi, %r13
movq %rdx, 0x28(%rsp)
movq %rcx, 0x30(%rsp)
jne 0x32de94
movq 0x10(%rsp), %rbx
testq %rbx, %rbx
je 0x32deaf
movq %rbx, %rdi
callq 0x1949a8
jmp 0x32dec8
movq 0x10(%rsp), %rbx
testq %rbx, %rbx
je 0x32debb
movl $0x1, %esi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x194a79
jmp 0x32dec8
movq 0x8(%rsp), %rdi
callq 0x32ed5c
jmp 0x32dec8
movq 0x8(%rsp), %rdi
movq %rcx, %rsi
callq 0x32ed61
movq %rax, %rsi
movq (%r14), %rax
movq %rsi, (%rax,%rbp)
testq %rbx, %rbx
je 0x32dee1
movq %rbx, %rdi
callq 0x193482
jmp 0x32deeb
movq 0x8(%rsp), %rdi
callq 0x32ed0c
testq %rbp, %rbp
movq 0x30(%rsp), %rcx
movq %rax, %rsi
je 0x32df02
subq %r15, %rsi
jae 0x32df05
jmp 0x32e1a5
xorl %r15d, %r15d
movq (%r14), %rdx
movq %rsi, 0x8(%rdx,%rbp)
movq %r15, 0x10(%rdx,%rbp)
cmpq %rsi, 0x18(%r14)
jae 0x32df1c
movq %rsi, 0x18(%r14)
addq 0x8(%rdx,%rbp), %r12
movq %r12, 0x18(%rdx,%rbp)
incq %r13
movl 0xc(%r14), %esi
addq $0x30, %rbp
movq %rax, %r15
cmpq %rsi, %r13
movq 0x28(%rsp), %rdx
jb 0x32de5b
movq (%rsp), %r13
cmpq %r13, %r12
movq 0x18(%rsp), %r12
je 0x32df81
callq 0x96867
testl %ebp, %ebp
je 0x32e1be
movl %ebp, %ecx
movq %rbx, %rax
xorl %edx, %edx
divq %rcx
incq %rax
movq %rax, 0x18(%r14)
movq %r12, %rdi
callq 0x1f8d23
movq %rax, 0x10(%r14)
movq $0x0, (%r14)
cmpl $0x0, 0xc(%r14)
je 0x32e07e
movq 0x70(%rsp), %rbx
xorl %eax, %eax
movl $0x8, %edx
xorl %ecx, %ecx
movq (%r14), %rsi
cmpq $0x0, (%rsi,%rdx)
je 0x32dfd9
movl %ecx, %edi
cmpq %rdi, %rax
jbe 0x32dfd7
leaq (%rsi,%rdx), %r8
addq $-0x8, %r8
leaq (%rdi,%rdi,2), %rdi
shlq $0x4, %rdi
movups (%r8), %xmm0
movups 0x10(%r8), %xmm1
movups 0x20(%r8), %xmm2
movups %xmm2, 0x20(%rsi,%rdi)
movups %xmm1, 0x10(%rsi,%rdi)
movups %xmm0, (%rsi,%rdi)
incl %ecx
incq %rax
movl 0xc(%r14), %esi
addq $0x30, %rdx
cmpq %rsi, %rax
jb 0x32df9a
cmpl %eax, %ecx
jae 0x32e01f
movq (%r14), %rdx
leal -0x1(%rsi), %edi
leaq (%rdi,%rdi,2), %rdi
shlq $0x4, %rdi
movq (%rdx,%rdi), %rdi
leal -0x1(%rcx), %r8d
leaq (%r8,%r8,2), %r8
shlq $0x4, %r8
movq %rdi, (%rdx,%r8)
addl %ecx, %esi
subl %eax, %esi
movl %esi, 0xc(%r14)
cmpl %ecx, %esi
jne 0x32e1c3
cmpl $0x0, 0xc(%r14)
je 0x32e06d
movl $0x8, %r13d
leaq 0x94315(%rip), %r15     # 0x3c2348
xorl %r12d, %r12d
xorl %ebp, %ebp
movq (%r14), %rax
movq (%rax,%r13), %rcx
testq %rcx, %rcx
je 0x32e19b
addq %rcx, %rbp
movq %rbx, %rdi
movq %r15, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0x10906e
incq %r12
movl 0xc(%r14), %eax
addq $0x30, %r13
cmpq %rax, %r12
jb 0x32e038
jmp 0x32e06f
xorl %ebp, %ebp
cmpq (%rsp), %rbp
movq 0x18(%rsp), %r12
jne 0x32e1b4
cmpl $0x0, 0xc(%r14)
je 0x32e189
cmpq $0x0, (%r14)
je 0x32e1af
movl 0xc(%r14), %ecx
testl %ecx, %ecx
je 0x32e117
xorl %ebx, %ebx
xorl %r15d, %r15d
testq %rbx, %rbx
je 0x32e0b2
movq (%r14), %rax
movq -0x30(%rax,%rbx), %rax
incq %rax
jmp 0x32e0b4
xorl %eax, %eax
movq 0x20(%r14), %rdi
testq %rdi, %rdi
je 0x32e0c5
movq %rax, %rsi
callq 0x32ede4
movq (%r14), %rcx
movq %rax, 0x20(%rcx,%rbx)
movl 0xc(%r14), %eax
cmpq %rax, %r15
jae 0x32e1a0
movq 0x20(%r14), %rdi
testq %rdi, %rdi
je 0x32e0ee
movq (%rcx,%rbx), %rsi
callq 0x32ede4
jmp 0x32e0ff
decl %eax
xorl %edx, %edx
cmpq %rax, %r15
sete %dl
movq (%rcx,%rbx), %rax
subq %rdx, %rax
movq (%r14), %rcx
movq %rax, 0x28(%rcx,%rbx)
incq %r15
movl 0xc(%r14), %ecx
addq $0x30, %rbx
cmpq %rcx, %r15
jb 0x32e0a0
cmpl $0x2, %ecx
jb 0x32e14c
movq (%r14), %rax
movl %ecx, %ecx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
addq $-0x30, %rcx
xorl %edx, %edx
movq 0x28(%rax,%rdx), %rsi
incq %rsi
cmpq %rsi, 0x50(%rax,%rdx)
je 0x32e143
movq %rsi, 0x50(%rax,%rdx)
addq $0x30, %rdx
cmpq %rdx, %rcx
jne 0x32e12f
cmpl $0x0, 0xc(%r14)
je 0x32e189
movl $0x28, %ebx
xorl %r15d, %r15d
movq (%r14), %rax
movq -0x8(%rax,%rbx), %rsi
movq (%rax,%rbx), %rdx
movq %r12, %rdi
callq 0x1f8cb8
cmpq %rax, 0x10(%r14)
jae 0x32e179
movq %rax, 0x10(%r14)
incq %r15
movl 0xc(%r14), %eax
addq $0x30, %rbx
cmpq %rax, %r15
jb 0x32e15b
movq %r14, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x968d9
callq 0x9694b
callq 0x9682e
callq 0x969f4
callq 0x96982
callq 0x96912
callq 0x967f5
callq 0x969bb
callq 0x968a0