// File: /workspace/github_c_makefile_star2_O1/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 $0x88, %rsp
movl %ecx, %ebp
movl %esi, %r14d
movq %rdi, 0x50(%rsp)
xorl %eax, %eax
movq %rax, 0x20(%rsp)
incq %rdx
movq %rdx, 0x28(%rsp)
movl $0x0, 0x30(%rsp)
movq %rax, 0x38(%rsp)
leaq 0x1f2135(%rip), %rdx    # 0x3b2e09
movl $0x1000, %esi           # imm = 0x1000
xorl %edi, %edi
movl $0xad, %ecx
callq 0x1094e6
testq %rax, %rax
je 0x1c0fff
leaq 0x20(%rsp), %rcx
movaps (%rcx), %xmm0
movaps 0x10(%rcx), %xmm1
movups %xmm1, 0x10(%rax)
movq %rax, (%rsp)
movups %xmm0, (%rax)
leal (%r14,%r14), %edi
shlq $0x3, %rdi
leaq 0x1f20f5(%rip), %rbx    # 0x3b2e09
movq %rbx, %rsi
movl $0xae, %edx
callq 0x1092b2
movq %rax, 0x40(%rsp)
movl %r14d, %edi
movq %rdi, 0x48(%rsp)
shlq $0x4, %rdi
movq %rbx, %rsi
movl $0xaf, %edx
callq 0x1092b2
movq %rax, 0x8(%rsp)
movl %r14d, %edi
movl %ebp, %esi
movl $0x1, %edx
callq 0x1c1004
movq %rax, %r15
movl $0x80, %eax
movq %rax, 0x58(%rsp)
movl $0x1, %r12d
movl %ebp, 0x1c(%rsp)
decq %r12
movq %r12, %rax
shlq $0x5, %rax
movq (%rsp), %rdx
movq (%rdx,%rax), %rcx
movq 0x8(%rdx,%rax), %r8
cmpq %r8, %rcx
jae 0x1c0ffa
movl 0x10(%rdx,%rax), %r13d
movq 0x18(%rdx,%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x8(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x50(%rsp), %rdx
callq 0x1a8ace
cmpq 0x48(%rsp), %rax
ja 0x1c0ff5
movq %rax, %r14
testq %rax, %rax
je 0x1c0f40
incl %r13d
movq 0x10(%rsp), %rax
imulq 0x48(%rsp), %rax
movq %rax, 0x10(%rsp)
xorl %ebx, %ebx
movq %rbx, %rax
shlq $0x4, %rax
movq 0x8(%rsp), %rcx
movups (%rcx,%rax), %xmm0
movaps %xmm0, 0x20(%rsp)
movl %r13d, 0x30(%rsp)
cmpl %ebp, %r13d
ja 0x1c0feb
movq 0x10(%rsp), %rax
addq %rbx, %rax
movq %rax, 0x38(%rsp)
movq %r15, %rdi
leaq 0x20(%rsp), %rsi
callq 0x1c1125
movl 0x30(%rsp), %eax
cmpl %ebp, %eax
jae 0x1c0f34
movq 0x20(%rsp), %rsi
leaq 0x1(%rsi), %rcx
cmpq 0x28(%rsp), %rcx
jae 0x1c0e49
movq 0x58(%rsp), %rsi
cmpq %rsi, %r12
jae 0x1c0ee1
movq (%rsp), %rax
jmp 0x1c0f03
movq %r12, 0x80(%rsp)
movq 0x38(%rsp), %rcx
movq %rcx, 0x78(%rsp)
movl %eax, 0x70(%rsp)
movq %rsi, 0x60(%rsp)
movq 0x50(%rsp), %rdi
callq 0x1a830f
movq %rax, %rbp
movl 0x70(%rsp), %eax
cmpl 0x4(%r15), %eax
leaq 0x60(%rsp), %r12
jae 0x1c0ecb
incl %eax
movl %eax, 0x70(%rsp)
movq %r12, %rdi
movq %rbp, %rsi
callq 0x1a83a4
cmpb $-0x3, %al
ja 0x1c0ecb
movl (%r15), %ecx
imulq 0x78(%rsp), %rcx
movzbl %al, %eax
addq %rcx, %rax
movq %rax, 0x78(%rsp)
movq 0x60(%rsp), %rax
incq %rax
movq %rax, 0x68(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x1c1125
movl 0x70(%rsp), %eax
cmpl 0x4(%r15), %eax
jb 0x1c0e80
movq %rbp, %rdi
callq 0x1a864b
movl 0x1c(%rsp), %ebp
movq 0x80(%rsp), %r12
jmp 0x1c0f34
subq $-0x80, %rsi
movq %rsi, 0x58(%rsp)
shlq $0x5, %rsi
movq (%rsp), %rdi
leaq 0x1f1f10(%rip), %rdx    # 0x3b2e09
movl $0xc8, %ecx
callq 0x1094e6
testq %rax, %rax
je 0x1c0ff0
movq %rax, %rcx
leaq 0x1(%r12), %rax
shlq $0x5, %r12
movaps 0x20(%rsp), %xmm0
movaps 0x30(%rsp), %xmm1
movups %xmm1, 0x10(%rcx,%r12)
movq %rcx, (%rsp)
movups %xmm0, (%rcx,%r12)
movq %rax, %r12
incq %rbx
cmpq %r14, %rbx
jne 0x1c0dd9
testq %r12, %r12
jne 0x1c0d6a
leaq 0x1f1eb9(%rip), %rbx    # 0x3b2e09
movq (%rsp), %rdi
movq %rbx, %rsi
movl $0xd0, %edx
callq 0x109670
movq 0x40(%rsp), %rdi
movq %rbx, %rsi
movl $0xd1, %edx
callq 0x109670
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
movl $0xd2, %edx
callq 0x109670
movq 0x8(%r15), %rsi
movdqu 0x8(%r15), %xmm0
movdqa 0x1bf489(%rip), %xmm1   # 0x380420
pand %xmm0, %xmm1
por 0x1bf48d(%rip), %xmm1   # 0x380430
psrlq $0x20, %xmm0
por 0x1bf490(%rip), %xmm0   # 0x380440
subpd 0x1bf498(%rip), %xmm0   # 0x380450
addpd %xmm1, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
divsd %xmm1, %xmm0
leaq 0x1f1ef2(%rip), %rdi    # 0x3b2ec1
movb $0x1, %al
callq 0x17070
movq %r15, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x6865e
callq 0x68625
callq 0x68697
callq 0x685ec
callq 0x686d0