// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x88, %rsp
movq %rdi, 0x80(%rsp)
movq %rsi, 0x78(%rsp)
movq %rdx, 0x70(%rsp)
movq $0x0, 0x30(%rsp)
movb $0x0, 0x2f(%rsp)
cmpq $0x0, 0x70(%rsp)
je 0x2f48c7
movq 0x70(%rsp), %rdi
callq 0xd8a60
testb $0x1, %al
jne 0x2f488f
jmp 0x2f48c7
movq 0x34770a(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x221773(%rip), %rsi    # 0x516013
leaq 0x221918(%rip), %rdx    # 0x5161bf
leaq 0x29b10f(%rip), %rcx    # 0x58f9bd
leaq 0x29b0ef(%rip), %r8     # 0x58f9a4
movl $0x14c, %r9d            # imm = 0x14C
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2f48c9
movq $0x0, 0x58(%rsp)
movq $0x0, 0x50(%rsp)
movl $0x0, 0x40(%rsp)
movq 0x80(%rsp), %rdi
movq 0x70(%rsp), %rsi
callq 0x4e7d10
movq %rax, 0x68(%rsp)
cmpq $0x0, 0x68(%rsp)
jne 0x2f4907
movb $0x1, 0x2f(%rsp)
testb $0x1, 0x2f(%rsp)
jne 0x2f494d
cmpq $0x0, 0x68(%rsp)
je 0x2f494d
movq 0x68(%rsp), %rdi
callq 0x4e8100
testb $0x1, %al
jne 0x2f494d
leaq 0x38(%rsp), %rdi
addq $0x8, %rdi
movq 0x68(%rsp), %rsi
movq 0x78(%rsp), %rdx
movq 0x70(%rsp), %rcx
callq 0x4e8a70
cmpl $0x0, %eax
je 0x2f494b
movb $0x1, 0x2f(%rsp)
jmp 0x2f494d
testb $0x1, 0x2f(%rsp)
jne 0x2f4af9
cmpq $0x0, 0x68(%rsp)
je 0x2f4af9
movq 0x68(%rsp), %rdi
callq 0x4e8100
testb $0x1, %al
jne 0x2f4af9
jmp 0x2f4978
cmpl $0x0, 0x40(%rsp)
ja 0x2f49b7
movq 0x34761a(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x221683(%rip), %rsi    # 0x516013
leaq 0x29b03d(%rip), %rdx    # 0x58f9d4
leaq 0x29b01f(%rip), %rcx    # 0x58f9bd
leaq 0x29afff(%rip), %r8     # 0x58f9a4
movl $0x161, %r9d            # imm = 0x161
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2f49b9
movl 0x40(%rsp), %esi
leaq 0x29b02c(%rip), %rdi    # 0x58f9f0
movb $0x0, %al
callq 0x19070
movq 0x68(%rsp), %rdi
callq 0x4e8170
movl %eax, %edi
movl 0x40(%rsp), %esi
callq 0xec720
movq %rax, 0x48(%rsp)
movq $0x0, 0x38(%rsp)
movq 0x48(%rsp), %rsi
leaq 0x29b023(%rip), %rdi    # 0x58fa1d
movb $0x0, %al
callq 0x19070
movq 0x68(%rsp), %rdi
callq 0x4e8080
movq 0x48(%rsp), %rdi
addq $0x1, %rdi
shlq $0x3, %rdi
leaq 0x29af85(%rip), %rsi    # 0x58f9a4
movl $0x16b, %edx            # imm = 0x16B
callq 0xe80f0
movq %rax, 0x58(%rsp)
movq 0x48(%rsp), %rax
addq $0x1, %rax
shrq $0x6, %rax
cmpq $0x0, %rax
jne 0x2f4a4d
movl $0x1, %eax
movq %rax, 0x10(%rsp)
jmp 0x2f4a67
movq 0x48(%rsp), %rax
addq $0x1, %rax
subq $0x1, %rax
shrq $0x6, %rax
addq $0x1, %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rsi
shlq $0x3, %rsi
xorl %eax, %eax
movl %eax, %edi
leaq 0x29af1f(%rip), %rdx    # 0x58f9a4
movl $0x16c, %ecx            # imm = 0x16C
callq 0xe8540
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rdi
movq 0x20(%rsp), %rdx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x19360
movq 0x68(%rsp), %rsi
leaq 0x38(%rsp), %rdi
callq 0x2f4d20
movq 0x80(%rsp), %rdi
movq 0x70(%rsp), %r9
leaq 0x29af65(%rip), %rsi    # 0x58fa31
leaq 0x2320ca(%rip), %rdx    # 0x526b9d
leaq 0x29aeca(%rip), %rcx    # 0x58f9a4
movl $0x16e, %r8d            # imm = 0x16E
callq 0xd92c0
movq %rax, 0x30(%rsp)
cmpq $0x0, 0x30(%rsp)
jne 0x2f4af7
movb $0x1, 0x2f(%rsp)
jmp 0x2f4af9
testb $0x1, 0x2f(%rsp)
jne 0x2f4b7a
cmpq $0x0, 0x68(%rsp)
je 0x2f4b7a
movq 0x68(%rsp), %rdi
callq 0x4e8100
testb $0x1, %al
jne 0x2f4b7a
movl 0x40(%rsp), %eax
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x30(%rsp)
jne 0x2f4b5f
movq 0x347472(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2214db(%rip), %rsi    # 0x516013
leaq 0x29aef7(%rip), %rdx    # 0x58fa36
leaq 0x29ae77(%rip), %rcx    # 0x58f9bd
leaq 0x29ae57(%rip), %r8     # 0x58f9a4
movl $0x177, %r9d            # imm = 0x177
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2f4b61
movq 0x30(%rsp), %rcx
leaq 0x18(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x126d30
testb $0x1, 0x2f(%rsp)
jne 0x2f4bf8
cmpq $0x0, 0x68(%rsp)
je 0x2f4bf8
movq 0x68(%rsp), %rdi
callq 0x4e8100
testb $0x1, %al
jne 0x2f4bf8
jmp 0x2f4b99
cmpq $0x0, 0x30(%rsp)
jne 0x2f4bd9
movq 0x3473f8(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x221461(%rip), %rsi    # 0x516013
leaq 0x29ae7d(%rip), %rdx    # 0x58fa36
leaq 0x29adfd(%rip), %rcx    # 0x58f9bd
leaq 0x29addd(%rip), %r8     # 0x58f9a4
movl $0x17c, %r9d            # imm = 0x17C
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2f4bdb
movq 0x58(%rsp), %rdi
movq 0x48(%rsp), %rdx
addq $0x1, %rdx
movq 0x30(%rsp), %rcx
movl $0x8, %esi
callq 0x126d30
testb $0x1, 0x2f(%rsp)
jne 0x2f4cbe
cmpq $0x0, 0x68(%rsp)
je 0x2f4cbe
movq 0x68(%rsp), %rdi
callq 0x4e8100
testb $0x1, %al
jne 0x2f4cbe
jmp 0x2f4c23
cmpq $0x0, 0x30(%rsp)
jne 0x2f4c63
movq 0x34736e(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2213d7(%rip), %rsi    # 0x516013
leaq 0x29adf3(%rip), %rdx    # 0x58fa36
leaq 0x29ad73(%rip), %rcx    # 0x58f9bd
leaq 0x29ad53(%rip), %r8     # 0x58f9a4
movl $0x182, %r9d            # imm = 0x182
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2f4c65
movq 0x50(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x48(%rsp), %rax
addq $0x1, %rax
shrq $0x6, %rax
cmpq $0x0, %rax
jne 0x2f4c8d
movl $0x1, %eax
movq %rax, (%rsp)
jmp 0x2f4ca6
movq 0x48(%rsp), %rax
addq $0x1, %rax
subq $0x1, %rax
shrq $0x6, %rax
addq $0x1, %rax
movq %rax, (%rsp)
movq 0x8(%rsp), %rdi
movq (%rsp), %rdx
movq 0x30(%rsp), %rcx
movl $0x8, %esi
callq 0x126d30
movq 0x30(%rsp), %rdi
callq 0xd9570
cmpq $0x0, 0x68(%rsp)
je 0x2f4cda
leaq 0x68(%rsp), %rdi
callq 0x4e81b0
movq 0x58(%rsp), %rdi
leaq 0x29acbe(%rip), %rsi    # 0x58f9a4
movl $0x18b, %edx            # imm = 0x18B
callq 0xe88c0
movq 0x50(%rsp), %rdi
leaq 0x29aca8(%rip), %rsi    # 0x58f9a4
movl $0x18c, %edx            # imm = 0x18C
callq 0xe88c0
movb 0x2f(%rsp), %dl
xorl %eax, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testb $0x1, %dl
cmovnel %ecx, %eax
addq $0x88, %rsp
retq
nop