// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/match/eis-bwtseq.c
// Function: getMatchBound
static inline void
getMatchBound(const BWTSeq *bwtSeq, const Symbol *query, size_t queryLen,
              struct matchBound *match, bool forward)
{
  const Symbol *qptr, *qend;
  unsigned int cc;
  const Mbtab *mbptr;
  GtPrebwtstate prebwt;

  gt_assert(bwtSeq && query);
  if (forward)
  {
    qptr = query;
    qend = query + queryLen;
  } else
  {
    qptr = query + queryLen - 1;
    qend = query - 1;
  }
  gt_assert(GT_ISNOTSPECIAL(*qptr));
  cc = (unsigned int) *qptr;
  prebwt.mbtab = gt_bwtseq2mbtab((const FMindex *) bwtSeq);
  if (prebwt.mbtab != NULL)
  {
    prebwt.numofchars = gt_bwtseq2numofchars((const FMindex *) bwtSeq);
    prebwt.maxdepth = gt_bwtseq2maxdepth((const FMindex *) bwtSeq);
    prebwt.code = 0;
    prebwt.depth = 0;
    mbptr = gt_prebwt_next(&prebwt,cc);
    match->start = mbptr->lowerbound;
    match->end = mbptr->upperbound;
  } else
  {
    prebwt.numofchars = GT_UNDEF_UINT;
    prebwt.maxdepth = GT_UNDEF_UINT;
    prebwt.code = 0;
    prebwt.depth = GT_UNDEF_UINT;
    match->start = bwtSeq->count[cc];
    match->end   = bwtSeq->count[cc + 1];
  }
  qptr = forward ? (qptr+1) : (qptr-1);
  while (match->start < match->end && qptr != qend)
  {
    GtUwordPair occPair;

    gt_assert(GT_ISNOTSPECIAL(*qptr));
    cc = (unsigned int) *qptr;
    if (prebwt.mbtab != NULL && prebwt.depth < prebwt.maxdepth)
    {
      mbptr = gt_prebwt_next(&prebwt,cc);
      match->start = mbptr->lowerbound;
      match->end = mbptr->upperbound;
    } else
    {
      occPair = BWTSeqTransformedPosPairOcc(bwtSeq, (Symbol) cc, match->start,
                                            match->end);
      match->start = bwtSeq->count[cc] + occPair.a;
      match->end   = bwtSeq->count[cc] + occPair.b;
    }
    qptr = forward ? (qptr+1) : (qptr-1);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
testq %rdi, %rdi
je 0x1a478f
testq %rsi, %rsi
je 0x1a478f
movl %r8d, %r12d
leaq (%rsi,%rdx), %rax
leaq (%rsi,%rdx), %r13
decq %r13
leaq -0x1(%rsi), %r14
testb %r12b, %r12b
cmovneq %rax, %r14
cmovneq %rsi, %r13
movzbl (%r13), %ebp
cmpq $0xfe, %rbp
jae 0x1a4794
movq %rcx, %rbx
movq %rdi, %r15
callq 0x1a8812
testq %rax, %rax
movq %r15, 0x30(%rsp)
movq %rax, 0x18(%rsp)
je 0x1a4663
movq %r15, %rdi
callq 0x1a8848
movl %r12d, 0x8(%rsp)
movl %eax, %r12d
movq %r15, %rdi
callq 0x1a882d
movq 0x18(%rsp), %rdi
movl %eax, 0x4(%rsp)
movq 0x8(%rdi), %rax
movl %ebp, %ecx
shll $0x4, %ecx
movups (%rax,%rcx), %xmm0
movups %xmm0, (%rbx)
movl %r12d, %eax
movl 0x8(%rsp), %r12d
movq %rax, 0x10(%rsp)
movl $0x1, %r15d
jmp 0x1a4694
movq %rax, %rdi
movq 0x38(%r15), %rax
movq (%rax,%rbp,8), %rcx
movq %rcx, (%rbx)
movq 0x8(%rax,%rbp,8), %rax
movq %rax, 0x8(%rbx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0x10(%rsp)
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
xorl %ebp, %ebp
movl $0xffffffff, 0x4(%rsp)  # imm = 0xFFFFFFFF
movzbl %r12b, %r9d
decq %r9
orq $0x1, %r9
leaq (%r9,%r13), %rax
movq (%rbx), %rdx
movq 0x8(%rbx), %rcx
cmpq %rcx, %rdx
setb %sil
cmpq %r14, %rax
setne %al
andb %sil, %al
cmpb $0x1, %al
jne 0x1a477b
leaq (%r9,%r9), %rsi
movq %rbx, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movzbl (%r13,%r9), %r12d
cmpq $0xfe, %r12
jae 0x1a478a
testq %rdi, %rdi
je 0x1a4718
cmpl 0x4(%rsp), %r15d
jae 0x1a4718
imulq 0x10(%rsp), %rbp
addq %r12, %rbp
movl %r15d, %eax
incl %r15d
movq 0x8(%rdi,%rax,8), %rax
movq %rbp, %rcx
shlq $0x4, %rcx
movq (%rax,%rcx), %rdx
movq %rdx, (%rbx)
movq 0x8(%rax,%rcx), %rcx
jmp 0x1a475f
movq %rbp, 0x8(%rsp)
movq %r14, %rbx
movq 0x30(%rsp), %r14
movq %r14, %rdi
movl %r12d, %esi
movq %r9, %rbp
callq 0x1a441a
movq %rbp, %r9
movq 0x18(%rsp), %rdi
movq 0x38(%r14), %rsi
movq %rbx, %r14
movq 0x28(%rsp), %rbx
movq 0x8(%rsp), %rbp
addq (%rsi,%r12,8), %rax
movq %rdx, %rcx
movq %rax, (%rbx)
addq (%rsi,%r12,8), %rcx
movq 0x20(%rsp), %rsi
movq %rcx, 0x8(%rbx)
movq (%rbx), %rdx
cmpq %rcx, %rdx
jae 0x1a477b
leaq (%rsi,%r13), %rax
addq %r9, %r13
cmpq %r14, %rax
jne 0x1a46d0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x60ee1
callq 0x60e6f
callq 0x60ea8