// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/eis-bwtseq.c
// Function: gt_packedindexmstatsforward
GtUword gt_packedindexmstatsforward(const BWTSeq *bwtSeq,
                                       GtUword *witnessleftbound,
                                       const GtUchar *qstart,
                                       const GtUchar *qend)
{
  GtUchar cc;
  const GtUchar *qptr;
  GtUword prevlbound;
  struct matchBound bwtbound;
  GtUwordPair seqpospair;
  Symbol curSym;
  GtUword matchlength;
  const MRAEnc *alphabet;

  gt_assert(bwtSeq && qstart && qstart < qend);
  alphabet = BWTSeqGetAlphabet(bwtSeq);
  qptr = qstart;
  cc = *qptr;
#undef SKDEBUG
#ifdef SKDEBUG
  printf("# start cc=%u\n",cc);
#endif
  if (GT_ISSPECIAL(cc))
  {
    return 0;
  }
  curSym = MRAEncMapSymbol(alphabet, cc);
  bwtbound.start = bwtSeq->count[curSym];
  bwtbound.end = bwtSeq->count[curSym+1];
  if (bwtbound.start >= bwtbound.end)
  {
    return 0;
  }
#ifdef SKDEBUG
  printf("# bounds="GT_WU","GT_WU" = "GT_WU""
          "occurrences\n",
         bwtbound.start,
         bwtbound.end,
         bwtbound.end - bwtbound.start);
#endif
  prevlbound = bwtbound.start;
  for (qptr++; qptr < qend; qptr++)
  {
    cc = *qptr;
#ifdef SKDEBUG
    printf("# cc=%u\n",cc);
#endif
    if (GT_ISSPECIAL (cc))
    {
      break;
    }
    curSym = MRAEncMapSymbol(alphabet, cc);
    seqpospair = BWTSeqTransformedPosPairOcc(bwtSeq, curSym,
                                             bwtbound.start,bwtbound.end);
    bwtbound.start = bwtSeq->count[curSym] + seqpospair.a;
    bwtbound.end = bwtSeq->count[curSym] + seqpospair.b;
#ifdef SKDEBUG
    printf("# bounds="GT_WU","GT_WU" = "GT_WU""
            "occurrences\n",
           bwtbound.start,
           bwtbound.end,
           bwtbound.end - bwtbound.start);
#endif
    if (bwtbound.start >= bwtbound.end)
    {
      break;
    }
    prevlbound = bwtbound.start;
  }
  matchlength = (GtUword) (qptr - qstart);
  if (witnessleftbound != NULL)
  {
    *witnessleftbound = prevlbound;
  }
  return matchlength;
}

// Assembly:
subq $0x88, %rsp
movq %rdi, 0x78(%rsp)
movq %rsi, 0x70(%rsp)
movq %rdx, 0x68(%rsp)
movq %rcx, 0x60(%rsp)
cmpq $0x0, 0x78(%rsp)
je 0x2266d7
cmpq $0x0, 0x68(%rsp)
je 0x2266d7
movq 0x68(%rsp), %rax
cmpq 0x60(%rsp), %rax
jb 0x22670f
movq 0x4158c2(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2ef92b(%rip), %rsi    # 0x516013
leaq 0x34ee14(%rip), %rdx    # 0x575503
leaq 0x34ee2f(%rip), %rcx    # 0x575525
leaq 0x34edc2(%rip), %r8     # 0x5754bf
movl $0x12f, %r9d            # imm = 0x12F
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x226711
movq 0x78(%rsp), %rdi
callq 0x226440
movq %rax, 0x10(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
movb (%rax), %al
movb %al, 0x5f(%rsp)
movzbl 0x5f(%rsp), %eax
cmpl $0xfe, %eax
jl 0x226752
movq $0x0, 0x80(%rsp)
jmp 0x2268db
movq 0x10(%rsp), %rdi
movzbl 0x5f(%rsp), %esi
callq 0x226450
movb %al, 0x27(%rsp)
movq 0x78(%rsp), %rax
movq 0x38(%rax), %rax
movzbl 0x27(%rsp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, 0x38(%rsp)
movq 0x78(%rsp), %rax
movq 0x38(%rax), %rax
movzbl 0x27(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x40(%rsp)
movq 0x38(%rsp), %rax
cmpq 0x40(%rsp), %rax
jb 0x2267b6
movq $0x0, 0x80(%rsp)
jmp 0x2268db
movq 0x38(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x50(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
cmpq 0x60(%rsp), %rax
jae 0x2268a7
movq 0x50(%rsp), %rax
movb (%rax), %al
movb %al, 0x5f(%rsp)
movzbl 0x5f(%rsp), %eax
cmpl $0xfe, %eax
jl 0x2267fa
jmp 0x2268a7
movq 0x10(%rsp), %rdi
movzbl 0x5f(%rsp), %esi
callq 0x226450
movb %al, 0x27(%rsp)
movq 0x78(%rsp), %rdi
movb 0x27(%rsp), %al
movq 0x38(%rsp), %rdx
movq 0x40(%rsp), %rcx
movzbl %al, %esi
callq 0x226490
movq %rax, (%rsp)
movq %rdx, 0x8(%rsp)
movq (%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x78(%rsp), %rax
movq 0x38(%rax), %rax
movzbl 0x27(%rsp), %ecx
movq (%rax,%rcx,8), %rax
addq 0x28(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x78(%rsp), %rax
movq 0x38(%rax), %rax
movzbl 0x27(%rsp), %ecx
movq (%rax,%rcx,8), %rax
addq 0x30(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x38(%rsp), %rax
cmpq 0x40(%rsp), %rax
jb 0x22688a
jmp 0x2268a7
movq 0x38(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x50(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x50(%rsp)
jmp 0x2267ce
movq 0x50(%rsp), %rax
movq 0x68(%rsp), %rcx
subq %rcx, %rax
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x70(%rsp)
je 0x2268ce
movq 0x48(%rsp), %rcx
movq 0x70(%rsp), %rax
movq %rcx, (%rax)
movq 0x18(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rax
addq $0x88, %rsp
retq
nopl (%rax,%rax)