// File: /workspace/github_c_makefile_star2_O1/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 0x20af53
movq %rdx, %rbx
movq %rsi, %r13
movq %rdi, %r14
callq 0x3366ae
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 0x20adad
movq %rbp, %r8
shlq $0x8, %r8
movzbl (%rbx,%rsi), %ebp
orq %r8, %rbp
addq $-0x4, %rdi
je 0x20adad
incq %rsi
cmpq %rsi, %rdx
jne 0x20ad81
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 0x20af42
movq 0x20(%r13), %rax
movq (%rax,%rbp,8), %r12
movq %r14, %rdi
callq 0x3366a4
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 0x20ae2f
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 0x20ae43
movb (%r8,%rsi), %al
andb %dil, %al
cmpb %al, %r9b
jbe 0x20aeba
movb $0x1, %r10b
xorl %r8d, %r8d
xorl %ecx, %ecx
jmp 0x20af18
addq %rax, %r12
addq %rax, %r8
movq %r14, %rdi
movq %rbx, %rdx
movq %r12, %rcx
jmp 0x20af2f
xorl %ecx, %ecx
cmpb %r10b, %r9b
jae 0x20ae55
movb $0x1, %r10b
xorl %r8d, %r8d
jmp 0x20af18
cmoveq %r12, %rcx
movb (%r8,%rsi), %al
andb %dil, %al
cmpb %al, %r9b
jae 0x20af0d
movq %r15, %r11
addq %r15, %r11
je 0x20af5d
leaq (%r12,%r15), %rax
cmpq %r8, %rax
jae 0x20af12
movq %r12, %r13
movq %r8, %rax
subq %r12, %rax
xorl %r10d, %r10d
xorl %edx, %edx
divq %r11
movq %rax, %r12
imulq %r15, %r12
addq %r13, %r12
movb (%rsi,%r12), %al
andb %dil, %al
cmpb %r9b, %al
cmovaq %r12, %r8
cmovaq %r13, %r12
leaq (%r12,%r15), %rax
cmpq %r8, %rax
jb 0x20ae82
jmp 0x20af15
movq %r15, %r11
addq %r15, %r11
je 0x20af58
leaq (%r12,%r15), %rax
movq %r8, %rcx
cmpq %r8, %rax
jae 0x20ae45
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 0x20aedc
jmp 0x20ae45
xorl %r10d, %r10d
jmp 0x20af18
xorl %r10d, %r10d
movq %r12, %r8
testb %r10b, %r10b
jne 0x20af42
testq %rcx, %rcx
je 0x20af42
cmpq %r8, %rcx
ja 0x20af42
incl %esi
movq %r14, %rdi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3368d1
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x815e5
callq 0x815ae
callq 0x81577