// File: /workspace/github_c_makefile_star2_O2/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 0x1470fe
testq %rsi, %rsi
je 0x1470fe
movl %r8d, %ebp
movq %rcx, %rbx
leaq (%rsi,%rdx), %rax
leaq (%rsi,%rdx), %r13
decq %r13
leaq -0x1(%rsi), %rcx
testb %bpl, %bpl
cmovneq %rax, %rcx
movq %rcx, 0x30(%rsp)
cmovneq %rsi, %r13
movzbl (%r13), %r14d
cmpq $0xfe, %r14
jae 0x14712c
movq %rdi, %r15
callq 0x14b723
testq %rax, %rax
movq %r15, 0x20(%rsp)
movq %rax, 0x18(%rsp)
je 0x146fc7
movq %r15, %rdi
callq 0x14b7bf
movl %eax, %r12d
movq %r15, %rdi
callq 0x14b771
movq 0x18(%rsp), %rsi
movl %eax, 0xc(%rsp)
movq 0x8(%rsi), %rax
movl %r14d, %edx
shll $0x4, %edx
leaq (%rax,%rdx), %rcx
movq (%rax,%rdx), %rax
movq %rax, (%rbx)
movl %r12d, %edx
movq %rdx, 0x10(%rsp)
pushq $0x1
popq %r8
jmp 0x146fee
movq %rax, %rsi
movq 0x38(%r15), %rax
leaq (%rax,%r14,8), %rcx
movq (%rcx), %rax
movq %rax, (%rbx)
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %rdx, 0x10(%rsp)
pushq $-0x1
popq %r8
xorl %r14d, %r14d
movl %r8d, 0xc(%rsp)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rbx)
movzbl %bpl, %edi
decq %rdi
orq $0x1, %rdi
addq %rdi, %r13
movq 0x20(%rsp), %r15
cmpq %rcx, %rax
jae 0x1470b7
cmpq 0x30(%rsp), %r13
je 0x1470b7
movzbl (%r13), %r12d
cmpq $0xfe, %r12
jae 0x1470c6
testq %rsi, %rsi
je 0x147064
cmpl 0xc(%rsp), %r8d
jae 0x147064
imulq 0x10(%rsp), %r14
addq %r12, %r14
movl %r8d, %eax
incl %r8d
movq 0x8(%rsi,%rax,8), %rcx
movq %r14, %rdx
shlq $0x4, %rdx
movq (%rcx,%rdx), %rax
movq %rax, (%rbx)
movq 0x8(%rcx,%rdx), %rcx
jmp 0x1470ab
movq %r14, 0x28(%rsp)
movq %rbx, %r14
movq %rdi, %rbx
movq %r15, %rdi
movl %r12d, %esi
movq %rax, %rdx
movq %r13, %rbp
movl %r8d, %r13d
callq 0x146cf8
movl %r13d, %r8d
movq %rbp, %r13
movq %rbx, %rdi
movq %r14, %rbx
movq 0x28(%rsp), %r14
movq 0x38(%r15), %rsi
addq (%rsi,%r12,8), %rax
movq %rdx, %rcx
movq %rax, (%rbx)
addq (%rsi,%r12,8), %rcx
movq 0x18(%rsp), %rsi
movq %rcx, 0x8(%rbx)
addq %rdi, %r13
jmp 0x147009
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2f0e9b(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x19df3c(%rip), %rsi    # 0x2e5013
leaq 0x1fc5f7(%rip), %rdx    # 0x3436d5
leaq 0x1fc5e2(%rip), %rcx    # 0x3436c7
leaq 0x1fc074(%rip), %r8     # 0x343160
movl $0xcf, %r9d
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x2f0e63(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x19df04(%rip), %rsi    # 0x2e5013
leaq 0x1fc0e8(%rip), %rdx    # 0x3431fe
leaq 0x1fc5aa(%rip), %rcx    # 0x3436c7
leaq 0x1fc03c(%rip), %r8     # 0x343160
movl $0xab, %r9d
jmp 0x1470f2
movq 0x2f0e35(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x19ded6(%rip), %rsi    # 0x2e5013
leaq 0x1fc591(%rip), %rdx    # 0x3436d5
leaq 0x1fc57c(%rip), %rcx    # 0x3436c7
leaq 0x1fc00e(%rip), %r8     # 0x343160
movl $0xb5, %r9d
jmp 0x1470f2