// File: /workspace/github_c_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0x1b5627
movq %rdx, %rbx
movq %rsi, %r13
movq %rdi, %r14
callq 0x2cd41a
movq %rax, %r15
movl 0x8(%r13), %esi
movq %rax, %rdi
movq %rbx, %rdx
callq 0x1b56b5
movq %rax, %rbp
movq 0x18(%r13), %rax
movq %rbp, %rcx
shrq $0x6, %rcx
movq (%rax,%rcx,8), %rax
movl %ebp, %ecx
shlq %cl, %rax
shrq $0x3f, %rax
je 0x1b55a4
movq 0x20(%r13), %rax
movq (%rax,%rbp,8), %r12
movq %r14, %rdi
callq 0x2cd410
movq 0x20(%r13), %rcx
movq 0x8(%rcx,%rbp,8), %r8
subq %r15, %r8
movl 0x8(%r13), %ecx
movl %ecx, %esi
shrl $0x2, %esi
testb $0x3, %cl
je 0x1b558c
movb 0x28(%r13), %dil
addq %rax, %r12
addq %rax, %r8
movb (%rbx,%rsi), %r9b
andb %dil, %r9b
movb (%rsi,%r12), %r10b
andb %dil, %r10b
cmpb %r10b, %r9b
jbe 0x1b559d
movb (%r8,%rsi), %al
andb %dil, %al
cmpb %al, %r9b
ja 0x1b55a4
movq %r15, %r11
addq %r15, %r11
je 0x1b565f
movq %r8, %rcx
movq %r12, %r13
leaq (%r15,%r13), %rax
cmpq %rcx, %rax
jae 0x1b559f
movq %rcx, %rax
subq %r13, %rax
xorl %edx, %edx
divq %r11
imulq %r15, %rax
addq %r13, %rax
movb (%rsi,%rax), %dl
andb %dil, %dl
cmpb %r9b, %dl
cmovaeq %rax, %rcx
cmovbq %rax, %r13
jmp 0x1b555e
addq %rax, %r12
addq %rax, %r8
movq %r14, %rdi
movq %rbx, %rdx
movq %r12, %rcx
jmp 0x1b5614
xorl %ecx, %ecx
cmpb %r10b, %r9b
jae 0x1b55b5
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmoveq %r12, %rcx
movb (%r8,%rsi), %al
andb %dil, %al
cmpb %al, %r9b
jae 0x1b5602
movq %r15, %r10
addq %r15, %r10
je 0x1b5689
leaq (%r12,%r15), %rax
cmpq %r8, %rax
jae 0x1b55ff
movq %r8, %rax
subq %r12, %rax
xorl %edx, %edx
divq %r10
imulq %r15, %rax
addq %r12, %rax
movb (%rsi,%rax), %dl
andb %dil, %dl
cmpb %r9b, %dl
cmovaq %rax, %r8
cmovbeq %rax, %r12
jmp 0x1b55d1
movq %r12, %r8
testq %rcx, %rcx
je 0x1b55a4
cmpq %r8, %rcx
ja 0x1b55a4
incl %esi
movq %r14, %rdi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2cd663
movq 0x28293a(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x12f9db(%rip), %rsi    # 0x2e5013
leaq 0x1a7673(%rip), %rdx    # 0x35ccb2
leaq 0x1a767f(%rip), %rcx    # 0x35ccc5
leaq 0x1a768b(%rip), %r8     # 0x35ccd8
movl $0xc5, %r9d
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x282902(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x12f9a3(%rip), %rsi    # 0x2e5013
leaq 0x1a778c(%rip), %rdx    # 0x35ce03
leaq 0x1a7797(%rip), %rcx    # 0x35ce15
leaq 0x1a7653(%rip), %r8     # 0x35ccd8
pushq $0x5f
jmp 0x1b56b1
movq 0x2828d8(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x12f979(%rip), %rsi    # 0x2e5013
leaq 0x1a7762(%rip), %rdx    # 0x35ce03
leaq 0x1a777f(%rip), %rcx    # 0x35ce27
leaq 0x1a7629(%rip), %r8     # 0x35ccd8
pushq $0x7b
popq %r9
jmp 0x1b5653