// File: /workspace/github_c_makefile_star2_O3/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 0x20168c
movq %rdx, %rbx
movq %rsi, %r13
movq %rdi, %r14
callq 0x32baa7
movq %rax, %r15
movl 0x8(%r13), %eax
cmpq $0x8, %r15
movl $0x8, %ecx
cmovbq %r15, %rcx
movl %eax, %edx
shrl $0x2, %edx
incq %rdx
xorl %esi, %esi
movq %rax, %rdi
xorl %ebp, %ebp
cmpq %rsi, %rcx
je 0x201535
movq %rbp, %r8
shlq $0x8, %r8
movzbl (%rbx,%rsi), %ebp
orq %r8, %rbp
addq $-0x4, %rdi
je 0x201535
incq %rsi
cmpq %rsi, %rdx
jne 0x201509
addl %eax, %eax
andb $0x6, %al
movb $0x8, %cl
subb %al, %cl
shrq %cl, %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 0x20160a
movq 0x20(%r13), %rax
movq (%rax,%rbp,8), %r12
movq %r14, %rdi
callq 0x32ba9d
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 0x2015f2
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 0x201603
movb (%r8,%rsi), %al
andb %dil, %al
cmpb %al, %r9b
ja 0x20160a
movq %r15, %r11
addq %r15, %r11
je 0x201691
leaq (%r12,%r15), %rax
movq %r8, %rcx
cmpq %r8, %rax
jae 0x201605
movq %r12, %r13
movq %r8, %rcx
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
leaq (%r15,%r13), %rax
cmpq %rcx, %rax
jb 0x2015c4
jmp 0x201605
addq %rax, %r12
addq %rax, %r8
movq %r14, %rdi
movq %rbx, %rdx
movq %r12, %rcx
jmp 0x201679
xorl %ecx, %ecx
cmpb %r10b, %r9b
jae 0x20161b
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 0x201661
movq %r15, %r10
addq %r15, %r10
je 0x201696
leaq (%r12,%r15), %rax
cmpq %r8, %rax
jae 0x201664
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 0x201633
movq %r8, %r12
testq %rcx, %rcx
je 0x20160a
cmpq %r12, %rcx
ja 0x20160a
incl %esi
movq %r14, %rdi
movq %rbx, %rdx
movq %r12, %r8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x32bca9
callq 0x7f7db
callq 0x7f7a4
callq 0x7f76d