// File: /workspace/github_c_makefile_star2_O3/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, %rbx
movq %rsi, %r12
movq %rdi, %r14
testq %rdx, %rdx
je 0x2016ca
movq %rbx, %rdi
callq 0xfcc32
testb %al, %al
jne 0x201bae
movl $0x0, 0x20(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rsp)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x32b8a6
movq %rax, 0x90(%rsp)
testq %rax, %rax
je 0x201706
movq %rax, %r13
movq %rax, %rdi
callq 0x32ba94
testb %al, %al
je 0x201715
xorl %r15d, %r15d
jmp 0x20172e
xorl %edi, %edi
callq 0xfd09a
movb $0x1, %r15b
jmp 0x201b6b
leaq 0x20(%rsp), %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x32bdc5
testl %eax, %eax
setne %r15b
testq %r13, %r13
sete %al
orb %r15b, %al
jne 0x201748
movq %r13, %rdi
callq 0x32ba94
testb %al, %al
je 0x201750
xorl %r15d, %r15d
xorl %r14d, %r14d
jmp 0x201a87
movq %r14, 0x60(%rsp)
movq %rbx, 0x68(%rsp)
movl 0x20(%rsp), %esi
testl %esi, %esi
je 0x201bb3
leaq 0x1bb163(%rip), %rdi    # 0x3bc8d0
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x17070
movq %r13, %rdi
callq 0x32bab1
movl 0x20(%rsp), %esi
movl %eax, %edi
callq 0x105ed6
movq %rax, 0x28(%rsp)
movq $0x0, 0x18(%rsp)
leaq 0x1bb15f(%rip), %rdi    # 0x3bc8fd
movq %rax, %rsi
xorl %eax, %eax
callq 0x17070
movq %r13, %rdi
callq 0x32ba36
movq 0x28(%rsp), %rdi
shlq $0x3, %rdi
movq %r13, %r14
movl $0x8, %ebp
addq %rbp, %rdi
leaq 0x1bb0b9(%rip), %r12    # 0x3bc884
movq %r12, %rsi
movl $0x16b, %edx            # imm = 0x16B
callq 0x104226
movq %rax, 0x38(%rsp)
movq 0x28(%rsp), %r13
leaq 0x1(%r13), %rax
shrq $0x3, %r13
andq $-0x8, %r13
addq %rbp, %r13
cmpq $0x40, %rax
cmovbq %rbp, %r13
xorl %edi, %edi
movq %r13, %rsi
movq %r12, %rdx
movl $0x16c, %ecx            # imm = 0x16C
callq 0x104461
movq %rax, 0x30(%rsp)
movq %rax, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x173a0
movq %r14, %rdi
callq 0x32ba9d
movq %rax, %r12
movq %rax, 0x50(%rsp)
movq %r14, %rdi
callq 0x32baa2
movq %r14, 0x58(%rsp)
movq %r14, %rdi
movq %rax, %r14
callq 0x32baa7
movq %rax, %rsi
movl 0x20(%rsp), %r10d
cmpq $0x8, %rax
cmovbq %rax, %rbp
movl %r10d, %eax
shrl $0x2, %eax
movl %r10d, %ecx
andl $-0x4, %ecx
addq $0x4, %rcx
movq %rcx, %rdi
leaq 0x1(%rax), %r11
movq %r10, %rcx
movq $0x0, 0x8(%rsp)
cmpq %rbx, %rbp
je 0x2018b6
movq 0x8(%rsp), %rdx
shlq $0x8, %rdx
movzbl (%r14,%rbx), %r8d
orq %rdx, %r8
movq %r8, 0x8(%rsp)
addq $-0x4, %rcx
je 0x2018b6
incq %rbx
cmpq %rbx, %r11
jne 0x201878
movq %rdi, %rcx
subq %r10, %rcx
addq %rcx, %rcx
movq %rcx, 0x48(%rsp)
shrq %cl, 0x8(%rsp)
jmp 0x2018c1
subq %r10, %rdi
addq %rdi, %rdi
movq %rdi, 0x48(%rsp)
movabsq $-0x8000000000000000, %r8 # imm = 0x8000000000000000
movq 0x30(%rsp), %rbx
movq 0x38(%rsp), %rcx
movq %rcx, 0x10(%rsp)
leaq (%rsi,%rsi), %rdi
leal (%r10,%r10), %ecx
andl $0x6, %ecx
movl $0x8, %edx
subq %rcx, %rdx
movq %rdx, 0x80(%rsp)
leaq 0x4(,%rax,4), %r13
leaq (,%rbp,4), %r15
movq %r14, 0x78(%rsp)
movq %rbx, 0x70(%rsp)
movq %r10, %rax
xorl %ecx, %ecx
xorl %r9d, %r9d
cmpq %rcx, %rbp
je 0x201941
movq %r9, %rdx
shlq $0x8, %rdx
movzbl (%r12,%rcx), %r9d
orq %rdx, %r9
addq $-0x4, %rax
je 0x201941
incq %rcx
cmpq %rcx, %r11
jne 0x201917
movq 0x48(%rsp), %rcx
shrq %cl, %r9
movq %r12, %rax
movq %r8, %rdx
movl %r9d, %ecx
shrq %cl, %rdx
subq 0x50(%rsp), %rax
movq 0x10(%rsp), %rcx
movq %rax, (%rcx,%r9,8)
movq %r9, %rax
shrq $0x6, %rax
orq %rdx, (%rbx,%rax,8)
cmpq 0x8(%rsp), %r9
je 0x2019f6
leaq (%r12,%rsi), %rax
cmpq %r14, %rax
jae 0x2019da
movq %r14, %rbx
movq %rbx, %rax
subq %r12, %rax
xorl %edx, %edx
divq %rdi
imulq %rsi, %rax
addq %r12, %rax
xorl %ecx, %ecx
xorl %r14d, %r14d
xorl %edx, %edx
cmpq %rcx, %r15
je 0x2019c6
movq %rdx, %r8
shlq $0x8, %r8
movzbl (%rax,%r14), %edx
orq %r8, %rdx
addq $0x4, %rcx
cmpq %rcx, %r10
je 0x2019c6
incq %r14
cmpq %rcx, %r13
jne 0x201996
movq 0x80(%rsp), %rcx
shrq %cl, %rdx
cmpq %r9, %rdx
cmovaq %rax, %rbx
cmovbeq %rax, %r12
leaq (%r12,%rsi), %rax
cmpq %rbx, %rax
jb 0x20197d
addq %rsi, %r12
movq 0x78(%rsp), %r14
movabsq $-0x8000000000000000, %r8 # imm = 0x8000000000000000
movq 0x70(%rsp), %rbx
jmp 0x20190f
addq %rsi, %r14
subq 0x50(%rsp), %r14
movq 0x28(%rsp), %rax
movq 0x10(%rsp), %rcx
movq %r14, (%rcx,%rax,8)
movq 0x28(%rsp), %rcx
movq %r8, %rax
shrq %cl, %rax
shrq $0x6, %rcx
orq %rax, (%rbx,%rcx,8)
movq 0x28(%rsp), %rcx
decq %rcx
movq 0x58(%rsp), %r13
movq 0x68(%rsp), %r9
movq 0x60(%rsp), %rdi
movq %r8, %rax
shrq %cl, %rax
movq %rcx, %rdx
shrq $0x6, %rdx
testq %rax, (%rbx,%rdx,8)
jne 0x201a57
movq 0x10(%rsp), %rdx
movq 0x8(%rdx,%rcx,8), %rax
movq %rax, (%rdx,%rcx,8)
addq $-0x1, %rcx
jb 0x201a36
leaq 0x1baead(%rip), %rsi    # 0x3bc911
leaq 0x154076(%rip), %rdx    # 0x355ae1
leaq 0x1bae12(%rip), %rcx    # 0x3bc884
movl $0x16e, %r8d            # imm = 0x16E
callq 0xfcf97
movq %rax, %r14
testq %rax, %rax
sete %r15b
testq %r13, %r13
sete %al
orb %r15b, %al
je 0x201aa8
movq %r14, %rdi
callq 0xfd09a
testq %r13, %r13
jne 0x201b5e
jmp 0x201b6b
movq %r13, %rdi
callq 0x32ba94
testb %al, %al
jne 0x201ae3
movl 0x20(%rsp), %eax
movq %rax, 0x88(%rsp)
testq %r14, %r14
je 0x201bb8
leaq 0x88(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x11f89c
movq %r13, %rdi
callq 0x32ba94
testb %al, %al
jne 0x201b12
testq %r14, %r14
je 0x201bbd
movq 0x28(%rsp), %rdx
movq 0x38(%rsp), %rdi
incq %rdx
movl $0x8, %esi
movq %r14, %rcx
callq 0x11f89c
movq %r13, %rdi
callq 0x32ba94
testb %al, %al
jne 0x201b56
testq %r14, %r14
je 0x201bc2
movq 0x28(%rsp), %rax
movq 0x30(%rsp), %rdi
leaq 0x1(%rax), %rcx
shrq $0x6, %rax
incq %rax
cmpq $0x40, %rcx
movl $0x1, %edx
cmovaeq %rax, %rdx
movl $0x8, %esi
movq %r14, %rcx
callq 0x11f89c
movq %r14, %rdi
callq 0xfd09a
leaq 0x90(%rsp), %rdi
callq 0x32bac3
movq 0x38(%rsp), %rdi
leaq 0x1bad0d(%rip), %rbx    # 0x3bc884
movq %rbx, %rsi
movl $0x18b, %edx            # imm = 0x18B
callq 0x1045eb
movq 0x30(%rsp), %rdi
movq %rbx, %rsi
movl $0x18c, %edx            # imm = 0x18C
callq 0x1045eb
movzbl %r15b, %eax
negl %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x7f814
callq 0x7f84d
callq 0x7f886
callq 0x7f8bf
callq 0x7f8f8