// File: /workspace/github_c_makefile_star2_O3/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 $0x48, %rsp
movq %r9, %r15
movq %r8, %r13
movq %rcx, %rbp
movq %rdx, %r12
movl %edi, %ebx
movq %rsi, 0x8(%rsp)
testq %rsi, %rsi
sete %al
testq %rdx, %rdx
setne %cl
testb %cl, %al
jne 0x3239be
cmpq $0x0, 0x8(%rsp)
je 0x323e64
testq %r12, %r12
jne 0x323e64
leaq 0xc0eff(%rip), %rsi     # 0x3e48c4
movl $0x28, %edi
movl $0xb8, %edx
callq 0x104226
movq %rax, %r14
movq $0x0, 0x10(%rax)
movq %r12, 0x20(%rax)
testq %r13, %r13
movq %rax, (%rsp)
movq %r13, 0x18(%rsp)
je 0x323a23
movl %ebx, %eax
cmpq %r13, %rax
movq %r12, 0x20(%rsp)
ja 0x323a14
cmpq $0x0, 0x8(%rsp)
je 0x323a6c
movq 0x8(%rsp), %rdi
callq 0x18c054
cmpl $0x1, %eax
jne 0x323a6c
movl $0x1, 0xc(%r14)
movl $0x1, %ebx
jmp 0x323a78
movl $0x0, 0xc(%r14)
testl %ebx, %ebx
je 0x323e5f
movq %r14, %rax
addq $0xc, %rax
movq %rax, 0x10(%rsp)
movl %ebx, %ecx
movq %r15, %rax
xorl %edx, %edx
divq %rcx
incq %rax
movq %rax, 0x18(%r14)
movq %rbp, %rdi
callq 0x1ef570
movq %rax, 0x10(%r14)
movq $0x0, (%r14)
movl 0xc(%r14), %r12d
jmp 0x323c0f
movl %ebx, 0xc(%r14)
testl %ebx, %ebx
je 0x323e5f
movq %rbp, 0x28(%rsp)
movq %r14, %rax
addq $0xc, %rax
movq %rax, 0x10(%rsp)
movl %ebx, %ecx
xorl %r12d, %r12d
movq %r13, %rax
xorl %edx, %edx
divq %rcx
movq %rax, 0x30(%rsp)
shlq $0x4, %rcx
leaq (%rcx,%rcx,2), %rdi
leaq 0xc0e1a(%rip), %rsi     # 0x3e48c4
movl $0xdb, %edx
callq 0x104226
movq %rax, (%r14)
movl 0xc(%r14), %ecx
movq $0x0, 0x18(%r14)
movl $0x0, %ebp
testq %rcx, %rcx
movq 0x8(%rsp), %rbx
je 0x323bfc
movq 0x18(%rsp), %rax
xorl %edx, %edx
divq %rcx
xorl %r13d, %r13d
xorl %r14d, %r14d
movl %ecx, %r12d
xorl %ebp, %ebp
xorl %ecx, %ecx
xorl %r15d, %r15d
addq 0x30(%rsp), %rcx
subl $0x1, %edx
movl $0x0, %eax
cmovbl %eax, %edx
sbbq $-0x1, %rcx
decl %r12d
cmpq %r12, %r14
movq %rdx, 0x40(%rsp)
movq %rcx, 0x38(%rsp)
jne 0x323b29
testq %rbx, %rbx
movq (%rsp), %r12
je 0x323b56
movq %rbx, %rdi
callq 0x18c2f5
jmp 0x323b41
testq %rbx, %rbx
movq (%rsp), %r12
je 0x323b65
movl $0x1, %esi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x18c3c6
movq (%r12), %rcx
movq %rax, (%rcx,%r13)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x18ae26
jmp 0x323b8d
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x324989
jmp 0x323b75
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
movq %rcx, %rsi
callq 0x32498e
movq (%r12), %rcx
movq %rax, (%rcx,%r13)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x324939
movq 0x8(%rsp), %rbx
testq %r13, %r13
je 0x323bae
movq %rax, %rdx
subq %r15, %rdx
jb 0x323e50
movq (%r12), %rcx
movq %rdx, 0x8(%rcx,%r13)
movq %r15, 0x10(%rcx,%r13)
jmp 0x323bc1
movq (%r12), %rcx
movq %rax, 0x8(%rcx)
movq $0x0, 0x10(%rcx)
movq %rax, %rdx
cmpq %rdx, 0x18(%r12)
jae 0x323bcd
movq %rdx, 0x18(%r12)
addq 0x8(%rcx,%r13), %rbp
movq %rbp, 0x18(%rcx,%r13)
incq %r14
movq 0x10(%rsp), %rcx
movl (%rcx), %r12d
addq $0x30, %r13
movq %rax, %r15
cmpq %r12, %r14
movq 0x40(%rsp), %rdx
movq 0x38(%rsp), %rcx
jb 0x323af0
movq 0x18(%rsp), %r13
cmpq %r13, %rbp
movq 0x28(%rsp), %rbp
jne 0x323e55
testl %r12d, %r12d
je 0x323e33
movq 0x80(%rsp), %r15
xorl %eax, %eax
movl $0x8, %edx
xorl %ecx, %ecx
movq (%rsp), %rsi
movq (%rsi), %rsi
cmpq $0x0, (%rsi,%rdx)
je 0x323c74
movl %ecx, %edi
cmpq %rdi, %rax
jbe 0x323c72
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)
movq 0x10(%rsp), %rsi
movl (%rsi), %r12d
incl %ecx
incq %rax
movl %r12d, %esi
addq $0x30, %rdx
cmpq %rsi, %rax
jb 0x323c29
cmpl %eax, %ecx
jae 0x323cc2
movq (%rsp), %r8
movq (%r8), %rdx
leal -0x1(%r12), %esi
leaq (%rsi,%rsi,2), %rsi
shlq $0x4, %rsi
movq (%rdx,%rsi), %rsi
leal -0x1(%rcx), %edi
leaq (%rdi,%rdi,2), %rdi
shlq $0x4, %rdi
movq %rsi, (%rdx,%rdi)
addl %ecx, %r12d
subl %eax, %r12d
movl %r12d, 0xc(%r8)
cmpl %ecx, %r12d
je 0x323cc5
callq 0x948e2
movl %r12d, %ecx
testl %ecx, %ecx
je 0x323d1d
movl $0x8, %r13d
leaq 0x95000(%rip), %rbx     # 0x3b8cd6
xorl %r12d, %r12d
xorl %r14d, %r14d
movq (%rsp), %rax
movq (%rax), %rax
movq (%rax,%r13), %rcx
testq %rcx, %rcx
je 0x323e46
addq %rcx, %r14
movq %r15, %rdi
movq %rbx, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0x103fe1
incq %r12
movq 0x10(%rsp), %rax
movl (%rax), %ecx
addq $0x30, %r13
cmpq %rcx, %r12
jb 0x323cdc
movq 0x18(%rsp), %r13
jmp 0x323d20
xorl %r14d, %r14d
cmpq %r13, %r14
jne 0x323e5a
testl %ecx, %ecx
je 0x323e33
movq (%rsp), %r15
movq (%r15), %rdx
testq %rdx, %rdx
je 0x323e69
xorl %ebx, %ebx
xorl %r14d, %r14d
testq %rbx, %rbx
je 0x323d55
movq -0x30(%rdx,%rbx), %rax
incq %rax
jmp 0x323d57
xorl %eax, %eax
movq 0x20(%r15), %rdi
testq %rdi, %rdi
je 0x323d6f
movq %rax, %rsi
callq 0x324a11
movq (%r15), %rdx
movl 0xc(%r15), %ecx
movq %rax, 0x20(%rdx,%rbx)
movl %ecx, %esi
cmpq %rsi, %r14
jae 0x323e4b
movq 0x20(%r15), %rdi
testq %rdi, %rdi
je 0x323d9c
movq (%rdx,%rbx), %rsi
callq 0x324a11
movq (%r15), %rdx
movl 0xc(%r15), %esi
movl %esi, %ecx
jmp 0x323daf
leal -0x1(%rcx), %eax
xorl %edi, %edi
cmpq %rax, %r14
sete %dil
movq (%rdx,%rbx), %rax
subq %rdi, %rax
movq %rax, 0x28(%rdx,%rbx)
incq %r14
addq $0x30, %rbx
cmpq %rsi, %r14
jb 0x323d46
cmpl $0x2, %ecx
jb 0x323df2
movl %ecx, %eax
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
addq $-0x30, %rax
xorl %esi, %esi
movq 0x28(%rdx,%rsi), %rdi
incq %rdi
cmpq %rdi, 0x50(%rdx,%rsi)
je 0x323de9
movq %rdi, 0x50(%rdx,%rsi)
addq $0x30, %rsi
cmpq %rsi, %rax
jne 0x323dd5
testl %ecx, %ecx
je 0x323e33
movl $0x28, %ebx
xorl %r14d, %r14d
movq (%rsp), %r15
movq (%r15), %rax
movq -0x8(%rax,%rbx), %rsi
movq (%rax,%rbx), %rdx
movq %rbp, %rdi
callq 0x1ef505
cmpq %rax, 0x10(%r15)
jae 0x323e20
movq %rax, 0x10(%r15)
incq %r14
movq 0x10(%rsp), %rax
movl (%rax), %eax
addq $0x30, %rbx
cmpq %rax, %r14
jb 0x323e02
movq (%rsp), %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x9491b
callq 0x9498d
callq 0x94870
callq 0x948a9
callq 0x94954
callq 0x949fd
callq 0x94837
callq 0x949c4