// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/tyr-mersplit.c
// Function: gt_searchinbuckets
const GtUchar *gt_searchinbuckets(const Tyrindex *tyrindex,
                             const Tyrbckinfo *tyrbckinfo,
                             const GtUchar *bytecode)
{
  const GtUchar *result;
  GtUword prefixcode, leftbound, merbytes;

  gt_assert(tyrbckinfo != NULL);
  merbytes = gt_tyrindex_merbytes(tyrindex);
  prefixcode = extractprefixbytecode(merbytes,
                                     tyrbckinfo->prefixlength,
                                     bytecode);
  leftbound = tyrbckinfo->bounds[prefixcode];
  if (ISBOUNDDEFINED(tyrbckinfo->boundisdefined,prefixcode))
  {
    const GtUchar *mertable;
    GtUword rightbound;

    mertable = gt_tyrindex_mertable(tyrindex);
    rightbound = tyrbckinfo->bounds[prefixcode+1] - merbytes;
    if (GT_MOD4(tyrbckinfo->prefixlength) == 0)
    {
      result = gt_tyrindex_binmersearch(tyrindex,
                                     (GtUword)
                                     GT_DIV4(tyrbckinfo->prefixlength),
                                     bytecode,
                                     mertable + leftbound,
                                     mertable + rightbound);
    } else
    {
      Merbounds merbounds;

      merbounds.leftmer = merbounds.rightmer = NULL;
      if (!remainadvance(&merbounds,
                         merbytes,
                         (GtUword) GT_DIV4(tyrbckinfo->prefixlength),
                         tyrbckinfo->remainmask,
                         bytecode,
                         mertable + leftbound,
                         mertable + rightbound) ||
         merbounds.leftmer == NULL ||
         merbounds.leftmer > merbounds.rightmer)
      {
        result = NULL;
      } else
      {
        result = gt_tyrindex_binmersearch(tyrindex,
                                       1UL + (GtUword)
                                             GT_DIV4(tyrbckinfo->prefixlength),
                                       bytecode,
                                       merbounds.leftmer,
                                       merbounds.rightmer);
      }
    }
  } else
  {
    result = NULL;
  }
  return result;
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movq %rdx, 0x50(%rsp)
cmpq $0x0, 0x58(%rsp)
jne 0x2f4423
movq 0x347bae(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x221c17(%rip), %rsi    # 0x516013
leaq 0x29b57b(%rip), %rdx    # 0x58f97e
leaq 0x29b587(%rip), %rcx    # 0x58f991
leaq 0x29b593(%rip), %r8     # 0x58f9a4
movl $0xc5, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2f4425
movq 0x60(%rsp), %rdi
callq 0x4e8150
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rdi
movq 0x58(%rsp), %rax
movl 0x8(%rax), %esi
movq 0x50(%rsp), %rdx
callq 0x2f45e0
movq %rax, 0x40(%rsp)
movq 0x58(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x40(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x38(%rsp)
movq 0x58(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x40(%rsp), %rcx
shrq $0x6, %rcx
movq (%rax,%rcx,8), %rax
movq 0x40(%rsp), %rcx
andq $0x3f, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
shrq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x2f45cd
movq 0x60(%rsp), %rdi
callq 0x4e8130
movq %rax, 0x28(%rsp)
movq 0x58(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x40(%rsp), %rcx
movq 0x8(%rax,%rcx,8), %rax
subq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x58(%rsp), %rax
movl 0x8(%rax), %eax
andl $0x3, %eax
cmpl $0x0, %eax
jne 0x2f451b
movq 0x60(%rsp), %rdi
movq 0x58(%rsp), %rax
movl 0x8(%rax), %eax
shrl $0x2, %eax
movl %eax, %eax
movl %eax, %esi
movq 0x50(%rsp), %rdx
movq 0x28(%rsp), %rcx
addq 0x38(%rsp), %rcx
movq 0x28(%rsp), %r8
addq 0x20(%rsp), %r8
callq 0x4e8680
movq %rax, 0x48(%rsp)
jmp 0x2f45cb
movq $0x0, 0x18(%rsp)
movq $0x0, 0x10(%rsp)
movq 0x30(%rsp), %rsi
movq 0x58(%rsp), %rax
movl 0x8(%rax), %eax
shrl $0x2, %eax
movl %eax, %eax
movl %eax, %edx
movq 0x58(%rsp), %rax
movb 0x28(%rax), %cl
movq 0x50(%rsp), %r8
movq 0x28(%rsp), %r9
addq 0x38(%rsp), %r9
movq 0x28(%rsp), %rax
addq 0x20(%rsp), %rax
leaq 0x10(%rsp), %rdi
movzbl %cl, %ecx
movq %rax, (%rsp)
callq 0x2f46d0
testb $0x1, %al
jne 0x2f4579
jmp 0x2f458d
cmpq $0x0, 0x10(%rsp)
je 0x2f458d
movq 0x10(%rsp), %rax
cmpq 0x18(%rsp), %rax
jbe 0x2f4598
movq $0x0, 0x48(%rsp)
jmp 0x2f45c9
movq 0x60(%rsp), %rdi
movq 0x58(%rsp), %rax
movl 0x8(%rax), %eax
shrl $0x2, %eax
movl %eax, %eax
movl %eax, %esi
addq $0x1, %rsi
movq 0x50(%rsp), %rdx
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %r8
callq 0x4e8680
movq %rax, 0x48(%rsp)
jmp 0x2f45cb
jmp 0x2f45d6
movq $0x0, 0x48(%rsp)
movq 0x48(%rsp), %rax
addq $0x68, %rsp
retq