// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/eis-specialsrank.c
// Function: specialsRankFromSampleTable
static GtUword
specialsRankFromSampleTable(const SpecialsRankLookup *ranker, GtUword pos)
{
  const SpecialsRankTable *rankTable = &ranker->implementationData.sampleTable;
  GtUword rankCount, samplePos, encSeqLen;
  gt_assert(ranker);
  encSeqLen = gt_encseq_total_length(ranker->encseq);
  gt_assert(pos <= encSeqLen + 1);
  samplePos = pos & ~(rankTable->sampleInterval - 1);
  {
    size_t sampleIdx = pos >> rankTable->sampleIntervalLog2;
    rankCount = rankTable->rankSumSamples[sampleIdx];
  }
  {
    const GtEncseq *encseq = ranker->encseq;
    GtEncseqReader *esr = rankTable->scanState;
    GtReadmode readmode = rankTable->readmode;
    GtUword encseqQueryMax = GT_MIN(pos, encSeqLen);
    if (samplePos < encseqQueryMax)
    {
      gt_encseq_reader_reinit_with_readmode(esr, encseq, readmode, samplePos);
      do {
        samplePos++;
        if (GT_ISSPECIAL(gt_encseq_reader_next_encoded_char(esr)))
          ++rankCount;
      } while (samplePos < encseqQueryMax);
    }
    if (pos == encSeqLen + 1)
      ++rankCount;
  }
  return rankCount;
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movq 0x60(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x50(%rsp)
cmpq $0x0, 0x60(%rsp)
jne 0x22cdec
movq 0x40f1e5(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2e924e(%rip), %rsi    # 0x516013
leaq 0x3494d5(%rip), %rdx    # 0x5762a1
leaq 0x3494d5(%rip), %rcx    # 0x5762a8
leaq 0x349430(%rip), %r8     # 0x57620a
movl $0xa3, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x22cdee
movq 0x60(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0xa9d00
movq %rax, 0x38(%rsp)
movq 0x58(%rsp), %rax
movq 0x38(%rsp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jbe 0x22ce4c
movq 0x40f185(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2e91ee(%rip), %rsi    # 0x516013
leaq 0x349498(%rip), %rdx    # 0x5762c4
leaq 0x349475(%rip), %rcx    # 0x5762a8
leaq 0x3493d0(%rip), %r8     # 0x57620a
movl $0xa5, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x22ce4e
movq 0x58(%rsp), %rax
movq 0x50(%rsp), %rcx
movq 0x18(%rcx), %rcx
subq $0x1, %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
movq %rax, 0x40(%rsp)
movq 0x58(%rsp), %rax
movq 0x50(%rsp), %rcx
movl 0x24(%rcx), %ecx
shrq %cl, %rax
movq %rax, 0x30(%rsp)
movq 0x50(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x30(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x48(%rsp)
movq 0x60(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x50(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x50(%rsp), %rax
movl 0x20(%rax), %eax
movl %eax, 0x1c(%rsp)
movq 0x58(%rsp), %rax
cmpq 0x38(%rsp), %rax
jae 0x22ced7
movq 0x58(%rsp), %rax
movq %rax, 0x8(%rsp)
jmp 0x22cee1
movq 0x38(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x40(%rsp), %rax
cmpq 0x10(%rsp), %rax
jae 0x22cf4f
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rsi
movl 0x1c(%rsp), %edx
movq 0x40(%rsp), %rcx
callq 0xabdb0
movq 0x40(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x40(%rsp)
movq 0x20(%rsp), %rdi
callq 0xaae30
movzbl %al, %eax
cmpl $0xfe, %eax
jl 0x22cf3f
movq 0x48(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x48(%rsp)
jmp 0x22cf41
movq 0x40(%rsp), %rax
cmpq 0x10(%rsp), %rax
jb 0x22cf0f
jmp 0x22cf4f
movq 0x58(%rsp), %rax
movq 0x38(%rsp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jne 0x22cf70
movq 0x48(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rax
addq $0x68, %rsp
retq
nopw (%rax,%rax)