// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/match/eis-blockcomp.c
// Function: blockCompSeqRank
static GtUword
blockCompSeqRank(struct encIdxSeq *eSeqIdx, Symbol eSym, GtUword pos,
                 union EISHint *hint)
{
  struct blockCompositionSeq *seqIdx;
  GtUword rankCount;
  gt_assert(eSeqIdx && eSeqIdx->classInfo == &blockCompositionSeqClass);
  seqIdx = encIdxSeq2blockCompositionSeq(eSeqIdx);
  gt_assert(gt_MRAEncSymbolIsInSelectedRanges(seqIdx->baseClass.alphabet,
                                        eSym, BLOCK_COMPOSITION_INCLUDE,
                                        seqIdx->modes) >= 0);
  if (gt_MRAEncSymbolIsInSelectedRanges(seqIdx->baseClass.alphabet, eSym,
                                     BLOCK_COMPOSITION_INCLUDE, seqIdx->modes))
  {
    BitOffset varDataMemOffset, cwIdxMemOffset;
    struct superBlock *sBlock;
    Symbol bSym = MRAEncMapSymbol(seqIdx->blockMapAlphabet, eSym);
    GtUword blockNum, bucketNum;
    unsigned blockSize = seqIdx->blockSize, bitsPerCompositionIdx
      = seqIdx->compositionTable.compositionIdxBits;
    bucketNum = bucketNumFromPos(seqIdx, pos);
#ifdef USE_SBLOCK_CACHE
    sBlock = cacheFetchSuperBlock(seqIdx, bucketNum,
                                  &hint->bcHint.sBlockCache);
#else
    sBlock = fetchSuperBlock(seqIdx, bucketNum, NULL);
#endif
    rankCount = sBlockGetPartialSymSum(sBlock, bSym, seqIdx);
    blockNum = blockNumFromPos(seqIdx, pos);
    walkCompIndicesPrefix(
      seqIdx, sBlock, blockNum % seqIdx->bucketBlocks, cwIdxMemOffset,
      rankCount += symCountFromComposition(
        &seqIdx->compositionTable, seqIdx->blockMapAlphabetSize, compIndex,
        bSym);,
      varDataMemOffset);
    rankCount = adjustPosRankForBlock(
      seqIdx, sBlock, pos, bSym, blockSize, rankCount, cwIdxMemOffset,
      varDataMemOffset, bitsPerCompositionIdx);
    if (bSym == seqIdx->blockEncFallback)
    {
      GtUword base = bucketBasePos(seqIdx, bucketNum);
      rankCount -= gt_SRLAllSymbolsCountInSeqRegion(
        seqIdx->rangeEncs, base, pos, &hint->bcHint.rangeHint);
    }
#ifndef USE_SBLOCK_CACHE
    deleteSuperBlock(sBlock);
#endif
  }
  else
  {
    rankCount = gt_SRLSymbolCountInSeqRegion(seqIdx->rangeEncs, 0, pos, eSym,
                                          &hint->bcHint.rangeHint);
  }
  return rankCount;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
testq %rdi, %rdi
je 0x30b916
movq %rdi, %r14
leaq 0x1ad4e8(%rip), %rax    # 0x4b8bb0
cmpq %rax, (%rdi)
jne 0x30b916
movq %rcx, %r15
movq %rdx, %r12
movq 0x8(%r14), %rdi
movq 0xa8(%r14), %rcx
movzbl %sil, %ebx
movl %ebx, %esi
movl $0x1, %edx
callq 0x19e32c
testl %eax, %eax
js 0x30b91b
movq 0x8(%r14), %rdi
movq 0xa8(%r14), %rcx
movl %ebx, %esi
movl $0x1, %edx
callq 0x19e32c
testl %eax, %eax
je 0x30b8ec
movq 0x98(%r14), %rax
cmpl $0x1, (%rax)
jne 0x30b920
movzbl 0x18(%rax,%rbx), %ebx
movl 0x68(%r14), %eax
movq %rax, 0x30(%rsp)
movl 0xb4(%r14), %eax
movl 0xb0(%r14), %ecx
movl %eax, 0xc(%rsp)
imull %eax, %ecx
movq %r12, %rax
xorl %edx, %edx
divq %rcx
movq %r14, %rdi
movq %rax, 0x20(%rsp)
movq %rax, %rsi
movq %r15, 0x28(%rsp)
movq %r15, %rdx
callq 0x30cc26
movq %rax, %r13
movq 0x10(%rax), %rdi
movq 0xd0(%r14), %rax
movq 0xd8(%r14), %rcx
movq %rbx, 0x10(%rsp)
movl %ebx, %edx
shll $0x2, %edx
movl (%rcx,%rdx), %esi
addl 0x4(%r13), %esi
movl (%rax,%rdx), %edx
callq 0x2f37dc
movq %rax, %rbp
movl 0xb4(%r14), %ecx
movq %r12, 0x38(%rsp)
movq %r12, %rax
xorl %edx, %edx
divq %rcx
movl (%r13), %r10d
movq %r13, 0x18(%rsp)
movl 0x4(%r13), %ecx
movl 0xc0(%r14), %edx
movl 0xe0(%r14), %esi
addq %rdx, %rsi
movl 0xb8(%r14), %ebx
addq %rsi, %rbx
addq %rcx, %rbx
movl 0xb0(%r14), %ecx
xorl %edx, %edx
divq %rcx
testq %rdx, %rdx
je 0x30b867
movq %rdx, %r12
movl 0x68(%r14), %edx
movq %r10, 0x40(%rsp)
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rdi
movq %rbx, %rsi
movq %rdx, %r15
callq 0x2f2688
movl %eax, %r13d
cmpq %r13, 0x48(%r14)
jbe 0x30b911
movzwl 0xc4(%r14), %esi
movl 0x60(%r14), %edx
movq 0x58(%r14), %rdi
imulq %r13, %rsi
addq 0x10(%rsp), %rsi
imulq %rdx, %rsi
callq 0x2f2688
movl %eax, %eax
addq %rax, %rbp
movq 0x50(%r14), %rax
leaq (,%r13,2), %rcx
addq %r13, %rcx
movl 0x8(%rax,%rcx,8), %eax
movq 0x40(%rsp), %r10
addq %rax, %r10
movq %r15, %rdx
addq %r15, %rbx
decl %r12d
jne 0x30b7f4
subq $0x8, %rsp
movq %r14, %rdi
movq 0x20(%rsp), %rsi
movq 0x40(%rsp), %r12
movq %r12, %rdx
movq 0x18(%rsp), %r13
movl %r13d, %ecx
movl 0x14(%rsp), %r8d
movq %rbp, %r9
pushq 0x38(%rsp)
pushq %r10
pushq %rbx
callq 0x30cfac
addq $0x20, %rsp
movq %rax, %rbx
cmpb 0xc6(%r14), %r13b
jne 0x30b8da
movl 0xb0(%r14), %eax
movl 0xb4(%r14), %ecx
movq 0x20(%rsp), %rsi
imulq %rax, %rsi
imulq %rcx, %rsi
movq 0x70(%r14), %rdi
movq 0x28(%rsp), %rcx
addq $0x20, %rcx
movq %r12, %rdx
callq 0x30f6e7
subq %rax, %rbx
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x70(%r14), %rdi
addq $0x20, %r15
xorl %esi, %esi
movq %r12, %rdx
movl %ebx, %ecx
movq %r15, %r8
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x30f462
callq 0x8fb14
callq 0x8fb4d
callq 0x8fadb
callq 0x173b0