// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/match/tyr-mersplit.c
// Function: gt_constructmerbuckets
int gt_constructmerbuckets(const char *inputindex,
                           const Definedunsignedint *callprefixlength,
                           GtError *err)
{
  Tyrindex *tyrindex;
  Tyrbckinfo tyrbckinfo;
  FILE *bucketfp = NULL;
  bool haserr = false;

  gt_error_check(err);
  tyrbckinfo.bounds = NULL;
  tyrbckinfo.boundisdefined = NULL;
  tyrbckinfo.prefixlength = 0;
  tyrindex = gt_tyrindex_new(inputindex,err);
  if (tyrindex == NULL)
  {
    haserr = true;
  }
  if (!haserr && tyrindex != NULL && !gt_tyrindex_isempty(tyrindex))
  {
    if (gt_determinetyrbckpfxlen(&tyrbckinfo.prefixlength,
                              tyrindex,
                              callprefixlength,
                              err) != 0)
    {
      haserr = true;
    }
  }
  if (!haserr && tyrindex != NULL && !gt_tyrindex_isempty(tyrindex))
  {
    gt_assert(tyrbckinfo.prefixlength > 0);
    printf("# construct mer buckets for prefixlength %u\n",
            tyrbckinfo.prefixlength);
    tyrbckinfo.numofcodes
      = gt_power_for_small_exponents(gt_tyrindex_alphasize(tyrindex),
                                     tyrbckinfo.prefixlength);
    tyrbckinfo.mappedmbdfileptr = NULL;
    printf("# numofcodes = "GT_WU"\n",tyrbckinfo.numofcodes);
    gt_tyrindex_show(tyrindex);
    tyrbckinfo.bounds = gt_malloc(sizeof *tyrbckinfo.bounds
                                  * (tyrbckinfo.numofcodes+1));
    GT_INITBITTAB(tyrbckinfo.boundisdefined,tyrbckinfo.numofcodes+1);
    splitmerinterval(&tyrbckinfo,tyrindex);
    bucketfp = gt_fa_fopen_with_suffix(inputindex,BUCKETSUFFIX,"wb",err);
    if (bucketfp == NULL)
    {
      haserr = true;
    }
  }
  if (!haserr && tyrindex != NULL && !gt_tyrindex_isempty(tyrindex))
  {
    GtUword pl_long = (GtUword) tyrbckinfo.prefixlength;
    gt_assert(bucketfp != NULL);
    gt_xfwrite(&pl_long, sizeof (pl_long), (size_t) 1, bucketfp);
  }
  if (!haserr && tyrindex != NULL && !gt_tyrindex_isempty(tyrindex))
  {
    gt_assert(bucketfp != NULL);
    gt_xfwrite(tyrbckinfo.bounds, sizeof (*tyrbckinfo.bounds),
               (size_t) (tyrbckinfo.numofcodes+1), bucketfp);
  }
  if (!haserr && tyrindex != NULL && !gt_tyrindex_isempty(tyrindex))
  {
    gt_assert(bucketfp != NULL);
    gt_xfwrite(tyrbckinfo.boundisdefined, sizeof (*tyrbckinfo.boundisdefined),
               GT_NUMOFINTSFORBITS(tyrbckinfo.numofcodes+1), bucketfp);
  }
  gt_fa_xfclose(bucketfp);
  if (tyrindex != NULL)
  {
    gt_tyrindex_delete(&tyrindex);
  }
  gt_free(tyrbckinfo.bounds);
  gt_free(tyrbckinfo.boundisdefined);
  return haserr ? -1 : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
testq %rdx, %rdx
je 0x20af91
movq %r14, %rdi
callq 0x101a9a
testb %al, %al
jne 0x20b47e
movl $0x0, 0x30(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x40(%rsp)
movq %r12, %rdi
movq %r14, %rsi
callq 0x336476
movq %rax, 0x8(%rsp)
xorl %ebx, %ebx
testq %rax, %rax
sete %bpl
je 0x20afea
movq %rax, %rdi
callq 0x33669b
testb %al, %al
jne 0x20afea
leaq 0x30(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x336a19
testl %eax, %eax
movb %bpl, %bl
movl $0x1, %ebp
cmovel %ebx, %ebp
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
sete %al
orb %bpl, %al
jne 0x20b003
callq 0x33669b
testb %al, %al
je 0x20b00a
xorl %ebx, %ebx
jmp 0x20b34c
movq %r12, 0x68(%rsp)
movq %r14, 0x70(%rsp)
movl 0x30(%rsp), %esi
testl %esi, %esi
je 0x20b483
leaq 0x1baf19(%rip), %rdi    # 0x3c5f40
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x17070
movq 0x8(%rsp), %rdi
callq 0x3366b8
movl 0x30(%rsp), %esi
movl %eax, %edi
callq 0x10af8d
movq %rax, 0x38(%rsp)
movq $0x0, 0x28(%rsp)
leaq 0x1baf13(%rip), %rdi    # 0x3c5f6d
movq %rax, %rsi
xorl %eax, %eax
callq 0x17070
movq 0x8(%rsp), %rdi
callq 0x33663d
movq 0x38(%rsp), %rdi
shlq $0x3, %rdi
movl $0x8, %r14d
addq %r14, %rdi
leaq 0x1bae6d(%rip), %r15    # 0x3c5ef4
movq %r15, %rsi
movl $0x16b, %edx            # imm = 0x16B
callq 0x1092b2
movq %rax, 0x48(%rsp)
movq 0x38(%rsp), %r12
leaq 0x1(%r12), %rax
shrq $0x3, %r12
andq $-0x8, %r12
addq %r14, %r12
cmpq $0x40, %rax
cmovbq %r14, %r12
xorl %edi, %edi
movq %r12, %rsi
movq %r15, %rdx
movl $0x16c, %ecx            # imm = 0x16C
callq 0x1094e6
movq %rax, 0x40(%rsp)
movq %rax, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x173a0
movq 0x8(%rsp), %r13
movq %r13, %rdi
callq 0x3366a4
movq %rax, %r15
movq %rax, 0x60(%rsp)
movq %r13, %rdi
callq 0x3366a9
movq %rax, %r12
movq %r13, %rdi
callq 0x3366ae
movq %r12, %rdi
movq %rax, %rsi
movl 0x30(%rsp), %r10d
cmpq $0x8, %rax
cmovbq %rax, %r14
movl %r10d, %eax
shrl $0x2, %eax
movl %r10d, %ecx
andl $-0x4, %ecx
addq $0x4, %rcx
movq %rcx, %r8
leaq 0x1(%rax), %r11
movq %r10, %rcx
movq $0x0, 0x10(%rsp)
movl %ebp, 0x5c(%rsp)
cmpq %rbx, %r14
je 0x20b172
movq 0x10(%rsp), %rdx
shlq $0x8, %rdx
movzbl (%rdi,%rbx), %r9d
orq %rdx, %r9
movq %r9, 0x10(%rsp)
addq $-0x4, %rcx
je 0x20b172
incq %rbx
cmpq %rbx, %r11
jne 0x20b13c
movl %r8d, %ecx
subl %r10d, %ecx
addl %ecx, %ecx
shrq %cl, 0x10(%rsp)
movabsq $-0x8000000000000000, %r13 # imm = 0x8000000000000000
movq 0x40(%rsp), %rcx
movq %rcx, 0x20(%rsp)
movq 0x48(%rsp), %rcx
movq %rcx, 0x18(%rsp)
subq %r10, %r8
addq %r8, %r8
movq %r8, 0x78(%rsp)
leaq (%rsi,%rsi), %rbp
leal (%r10,%r10), %ecx
andl $0x6, %ecx
movl $0x8, %edx
subq %rcx, %rdx
movq %rdx, 0x88(%rsp)
leaq 0x4(,%rax,4), %r12
leaq (,%r14,4), %rbx
movq %rdi, 0x80(%rsp)
movq %r10, %rax
xorl %ecx, %ecx
xorl %r9d, %r9d
cmpq %rcx, %r14
je 0x20b200
movq %r9, %rdx
shlq $0x8, %rdx
movzbl (%r15,%rcx), %r9d
orq %rdx, %r9
addq $-0x4, %rax
je 0x20b200
incq %rcx
cmpq %rcx, %r11
jne 0x20b1d6
movq 0x78(%rsp), %rcx
shrq %cl, %r9
movq %r15, %rax
movq %r13, %rdx
movl %r9d, %ecx
shrq %cl, %rdx
subq 0x60(%rsp), %rax
movq 0x18(%rsp), %rcx
movq %rax, (%rcx,%r9,8)
movq %r9, %rax
shrq $0x6, %rax
movq 0x20(%rsp), %rcx
orq %rdx, (%rcx,%rax,8)
cmpq 0x10(%rsp), %r9
jne 0x20b287
jmp 0x20b2aa
movq %rdi, %rax
subq %r15, %rax
xorl %edx, %edx
divq %rbp
imulq %rsi, %rax
addq %r15, %rax
xorl %ecx, %ecx
xorl %r13d, %r13d
xorl %edx, %edx
cmpq %rcx, %rbx
je 0x20b27c
movq %rdx, %r8
shlq $0x8, %r8
movzbl (%rax,%r13), %edx
orq %r8, %rdx
addq $0x4, %rcx
cmpq %rcx, %r10
je 0x20b27c
incq %r13
cmpq %rcx, %r12
jne 0x20b24c
movq 0x88(%rsp), %rcx
shrq %cl, %rdx
cmpq %r9, %rdx
cmovaq %rax, %rdi
cmovbeq %rax, %r15
leaq (%r15,%rsi), %rax
cmpq %rdi, %rax
jb 0x20b233
addq %rsi, %r15
movq 0x80(%rsp), %rdi
movabsq $-0x8000000000000000, %r13 # imm = 0x8000000000000000
jmp 0x20b1ce
addq %rsi, %rdi
subq 0x60(%rsp), %rdi
movq 0x38(%rsp), %rax
movq 0x18(%rsp), %rcx
movq %rdi, (%rcx,%rax,8)
movq 0x38(%rsp), %rcx
movq %r13, %rax
shrq %cl, %rax
shrq $0x6, %rcx
movq 0x20(%rsp), %rdx
orq %rax, (%rdx,%rcx,8)
movq 0x38(%rsp), %rcx
decq %rcx
movl 0x5c(%rsp), %ebp
movq 0x70(%rsp), %r9
movq 0x68(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq %r13, %rax
shrq %cl, %rax
movq %rcx, %rdx
shrq $0x6, %rdx
testq %rax, (%rsi,%rdx,8)
jne 0x20b314
movq 0x18(%rsp), %rdx
movq 0x8(%rdx,%rcx,8), %rax
movq %rax, (%rdx,%rcx,8)
addq $-0x1, %rcx
jb 0x20b2f3
leaq 0x1bac60(%rip), %rsi    # 0x3c5f81
leaq 0x1537e5(%rip), %rdx    # 0x35eb0d
leaq 0x1babc5(%rip), %rcx    # 0x3c5ef4
movl $0x16e, %r8d            # imm = 0x16E
callq 0x101dff
movq %rax, %rbx
testq %rax, %rax
movzbl %bpl, %eax
movl $0x1, %ebp
cmovnel %eax, %ebp
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
sete %al
orb %bpl, %al
jne 0x20b394
callq 0x33669b
testb %al, %al
jne 0x20b394
movl 0x30(%rsp), %eax
movq %rax, 0x90(%rsp)
testq %rbx, %rbx
je 0x20b488
leaq 0x90(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x125658
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
sete %al
orb %bpl, %al
jne 0x20b3d0
callq 0x33669b
testb %al, %al
jne 0x20b3d0
testq %rbx, %rbx
je 0x20b48d
movq 0x38(%rsp), %rdx
movq 0x48(%rsp), %rdi
incq %rdx
movl $0x8, %esi
movq %rbx, %rcx
callq 0x125658
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
sete %al
orb %bpl, %al
jne 0x20b421
callq 0x33669b
testb %al, %al
jne 0x20b421
testq %rbx, %rbx
je 0x20b492
movq 0x38(%rsp), %rax
movq 0x40(%rsp), %rdi
leaq 0x1(%rax), %rcx
shrq $0x6, %rax
incq %rax
cmpq $0x40, %rcx
movl $0x1, %edx
cmovaeq %rax, %rdx
movl $0x8, %esi
movq %rbx, %rcx
callq 0x125658
movq %rbx, %rdi
callq 0x101f02
cmpq $0x0, 0x8(%rsp)
je 0x20b43b
leaq 0x8(%rsp), %rdi
callq 0x3366ca
movq 0x48(%rsp), %rdi
leaq 0x1baaad(%rip), %rbx    # 0x3c5ef4
movq %rbx, %rsi
movl $0x18b, %edx            # imm = 0x18B
callq 0x109670
movq 0x40(%rsp), %rdi
movq %rbx, %rsi
movl $0x18c, %edx            # imm = 0x18C
callq 0x109670
movzbl %bpl, %eax
negl %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x8161e
callq 0x81657
callq 0x81690
callq 0x816c9
callq 0x81702