// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/pckbucket.c
// Function: gt_pckbuckettable_new
Pckbuckettable *gt_pckbuckettable_new(const FMindex *fmindex,
                                      unsigned int numofchars,
                                      GtUword totallength,
                                      unsigned int maxdepth)
{
  GtArrayPckbck_Boundsatdepth stack;
  Pckbck_Boundsatdepth parent, child;
  GtUword rangesize, idx, *rangeOccs;
  Pckbuckettable *pckbt;
  Mbtab *tmpmbtab;

  GT_INITARRAY(&stack,Pckbck_Boundsatdepth);
  child.lowerbound = 0;
  child.upperbound = totallength+1;
  child.depth = 0;
  child.code = (GtCodetype) 0;
  GT_STOREINARRAY(&stack,Pckbck_Boundsatdepth,128,child);
  rangeOccs = gt_malloc(sizeof (*rangeOccs) * GT_MULT2(numofchars));
  tmpmbtab = gt_malloc(sizeof (*tmpmbtab) * numofchars);
  pckbt = pckbuckettable_allocandinittable(numofchars,maxdepth,true);
  while (stack.nextfreePckbck_Boundsatdepth > 0)
  {
    parent
      = stack.spacePckbck_Boundsatdepth[--stack.nextfreePckbck_Boundsatdepth];
    gt_assert(parent.lowerbound < parent.upperbound);
    rangesize = gt_bwtrangesplitallwithoutspecial(tmpmbtab,
                                                  rangeOccs,
                                                  fmindex,
                                                  parent.lowerbound,
                                                  parent.upperbound);
    gt_assert(rangesize <= (GtUword) numofchars);
    for (idx = 0; idx < rangesize; idx++)
    {
      child.lowerbound = tmpmbtab[idx].lowerbound;
      child.upperbound = tmpmbtab[idx].upperbound;
      child.depth = parent.depth + 1;
      gt_assert(child.depth <= maxdepth);
      child.code = parent.code * numofchars + idx;
      pckbuckettable_storeBoundsatdepth(pckbt,&child);
      if (child.depth < maxdepth)
      {
        if (child.lowerbound + 1 < child.upperbound)
        {
          GT_STOREINARRAY(&stack,Pckbck_Boundsatdepth,128,child);
        } else
        {
          pckbuckettable_followleafedge(pckbt,fmindex,&child);
        }
      }
    }
  }
  GT_FREEARRAY(&stack,Pckbck_Boundsatdepth);
  gt_free(rangeOccs);
  gt_free(tmpmbtab);
  printf("filled: "GT_WU" (%.2f)\n",pckbt->numofvalues,
                        (double) pckbt->numofvalues/pckbt->maxnumofvalues);
  return pckbt;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl %ecx, %ebp
movl %esi, %r14d
andq $0x0, 0x30(%rsp)
incq %rdx
movq %rdx, 0x38(%rsp)
andl $0x0, 0x40(%rsp)
movq %rdi, 0x60(%rsp)
andq $0x0, 0x48(%rsp)
leaq 0x1e2e5a(%rip), %rdx    # 0x349bb9
movl $0x1000, %esi           # imm = 0x1000
xorl %edi, %edi
movl $0xad, %ecx
callq 0x93472
testq %rax, %rax
je 0x16715f
leaq 0x30(%rsp), %rcx
movaps (%rcx), %xmm0
movaps 0x10(%rcx), %xmm1
movups %xmm1, 0x10(%rax)
movq %rax, 0x8(%rsp)
movups %xmm0, (%rax)
leal (%r14,%r14), %edi
shlq $0x3, %rdi
leaq 0x1e2e19(%rip), %rbx    # 0x349bb9
movq %rbx, %rsi
movl $0xae, %edx
callq 0x93160
movq %rax, 0x58(%rsp)
movl %r14d, %edi
movq %rdi, 0x88(%rsp)
shlq $0x4, %rdi
movq %rbx, %rsi
movl $0xaf, %edx
callq 0x93160
movq %rax, 0x20(%rsp)
pushq $0x1
popq %rdx
movl %r14d, %edi
movl %ebp, %esi
callq 0x167190
movq %rax, %r15
pushq $0x1
popq %rdi
movl $0x80, %esi
leaq 0x68(%rsp), %r14
movl %ebp, 0x2c(%rsp)
testq %rdi, %rdi
je 0x166ff7
decq %rdi
movq %rdi, %rax
shlq $0x5, %rax
movq 0x8(%rsp), %rdx
movq (%rdx,%rax), %rcx
movq 0x8(%rdx,%rax), %r8
cmpq %r8, %rcx
jae 0x167100
movq %rdi, 0x10(%rsp)
movq %rsi, 0x18(%rsp)
movl 0x10(%rdx,%rax), %r13d
movq 0x18(%rdx,%rax), %r12
movq 0x20(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
callq 0x14bb4b
movq 0x88(%rsp), %rcx
movq %rax, 0x90(%rsp)
cmpq %rcx, %rax
ja 0x16712e
incl %r13d
imulq %rcx, %r12
xorl %ebx, %ebx
movl %r13d, 0x4(%rsp)
cmpq 0x90(%rsp), %rbx
je 0x166fe8
movq %rbx, %rax
shlq $0x4, %rax
movq 0x20(%rsp), %rcx
movups (%rcx,%rax), %xmm0
movaps %xmm0, 0x30(%rsp)
movl %r13d, 0x40(%rsp)
cmpl %ebp, %r13d
ja 0x16709a
movq %r12, %r13
leaq (%rbx,%r12), %rax
movq %rax, 0x48(%rsp)
movq %r15, %rdi
leaq 0x30(%rsp), %rsi
callq 0x167265
movl 0x40(%rsp), %r12d
cmpl %ebp, %r12d
jae 0x166f75
movq 0x30(%rsp), %rsi
leaq 0x1(%rsi), %rax
cmpq 0x38(%rsp), %rax
jae 0x166eef
movq 0x18(%rsp), %rsi
cmpq %rsi, 0x10(%rsp)
jae 0x166f7f
movq 0x8(%rsp), %rax
jmp 0x166fa2
movq 0x48(%rsp), %rax
movq %rax, 0x80(%rsp)
movl %r12d, 0x78(%rsp)
movq %rsi, 0x68(%rsp)
movq 0x60(%rsp), %rdi
callq 0x14b225
movq %rax, %rbp
cmpl 0x4(%r15), %r12d
jae 0x166f69
incl %r12d
movl %r12d, 0x78(%rsp)
movq %r14, %rdi
movq %rbp, %rsi
callq 0x14b27d
cmpb $-0x3, %al
ja 0x166f69
movl (%r15), %ecx
imulq 0x80(%rsp), %rcx
movzbl %al, %eax
addq %rcx, %rax
movq %rax, 0x80(%rsp)
movq 0x68(%rsp), %rax
incq %rax
movq %rax, 0x70(%rsp)
movq %r15, %rdi
movq %r14, %rsi
callq 0x167265
movl 0x78(%rsp), %r12d
jmp 0x166f13
movq %rbp, %rdi
callq 0x14b4fb
movl 0x2c(%rsp), %ebp
movq %r13, %r12
movl 0x4(%rsp), %r13d
jmp 0x166fe0
subq $-0x80, %rsi
movq %rsi, 0x18(%rsp)
shlq $0x5, %rsi
movq 0x8(%rsp), %rdi
leaq 0x1e2c21(%rip), %rdx    # 0x349bb9
movl $0xc8, %ecx
callq 0x93472
movq %r13, %r12
testq %rax, %rax
movl 0x4(%rsp), %r13d
je 0x1670d2
movq %rax, %rcx
movq 0x10(%rsp), %rdx
leaq 0x1(%rdx), %rax
shlq $0x5, %rdx
movaps 0x30(%rsp), %xmm0
movaps 0x40(%rsp), %xmm1
movups %xmm1, 0x10(%rcx,%rdx)
movq %rcx, 0x8(%rsp)
movups %xmm0, (%rcx,%rdx)
movq %rax, 0x10(%rsp)
incq %rbx
jmp 0x166e6d
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rdi
jmp 0x166df4
leaq 0x1e2bbb(%rip), %rbx    # 0x349bb9
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
movl $0xd0, %edx
callq 0x936f9
movq 0x58(%rsp), %rdi
movq %rbx, %rsi
movl $0xd1, %edx
callq 0x936f9
movq 0x20(%rsp), %rdi
movq %rbx, %rsi
movl $0xd2, %edx
callq 0x936f9
movq 0x8(%r15), %rsi
movdqu 0x8(%r15), %xmm0
movdqa 0x1b045a(%rip), %xmm1   # 0x3174a0
pand %xmm0, %xmm1
por 0x1b045e(%rip), %xmm1   # 0x3174b0
psrlq $0x20, %xmm0
por 0x1b0461(%rip), %xmm0   # 0x3174c0
subpd 0x1b0469(%rip), %xmm0   # 0x3174d0
addpd %xmm1, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
divsd %xmm1, %xmm0
leaq 0x1e2bf3(%rip), %rdi    # 0x349c71
movb $0x1, %al
callq 0x17070
movq %r15, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2d0ec7(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x17df68(%rip), %rsi    # 0x2e5013
leaq 0x1e2ba7(%rip), %rdx    # 0x349c59
leaq 0x1e2b16(%rip), %rcx    # 0x349bcf
leaq 0x1e2af9(%rip), %r8     # 0x349bb9
movl $0xc1, %r9d
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x2d0e8f(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x17df30(%rip), %rsi    # 0x2e5013
leaq 0x1e2afb(%rip), %rdx    # 0x349be5
leaq 0x1e2ade(%rip), %rcx    # 0x349bcf
leaq 0x1e2ac1(%rip), %r8     # 0x349bb9
movl $0xc8, %r9d
jmp 0x1670c6
movq 0x2d0e61(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x17df02(%rip), %rsi    # 0x2e5013
leaq 0x1e2af9(%rip), %rdx    # 0x349c11
leaq 0x1e2ab0(%rip), %rcx    # 0x349bcf
leaq 0x1e2a93(%rip), %r8     # 0x349bb9
movl $0xb5, %r9d
jmp 0x1670c6
movq 0x2d0e33(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x17ded4(%rip), %rsi    # 0x2e5013
leaq 0x1e2af1(%rip), %rdx    # 0x349c37
leaq 0x1e2a82(%rip), %rcx    # 0x349bcf
leaq 0x1e2a65(%rip), %r8     # 0x349bb9
movl $0xbb, %r9d
jmp 0x1670c6
movq 0x2d0e02(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x17dea3(%rip), %rsi    # 0x2e5013
leaq 0x1e2a6e(%rip), %rdx    # 0x349be5
leaq 0x1e2a51(%rip), %rcx    # 0x349bcf
leaq 0x1e2a34(%rip), %r8     # 0x349bb9
movl $0xad, %r9d
jmp 0x1670c6