// File: /workspace/github_c_makefile_star2_O1/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 0x315b6b
movq %rdx, %r12
movq %rdi, %rdx
leaq 0x1ae2a4(%rip), %rax    # 0x4c3bc0
cmpq %rax, (%rdi)
jne 0x315b6b
movq %rcx, %r14
movq 0x8(%rdx), %rdi
movq 0xa8(%rdx), %rcx
movzbl %sil, %ebx
movl %ebx, %esi
movq %rdx, %r15
movl $0x1, %edx
callq 0x1a6a6a
testl %eax, %eax
js 0x315b70
movq 0x8(%r15), %rdi
movq 0xa8(%r15), %rcx
movl %ebx, %esi
movl $0x1, %edx
callq 0x1a6a6a
testl %eax, %eax
je 0x315b41
movq 0x98(%r15), %rax
cmpl $0x1, (%rax)
jne 0x315b75
movzbl 0x18(%rax,%rbx), %ebx
movl 0x68(%r15), %eax
movq %rax, 0x30(%rsp)
movl 0xb4(%r15), %eax
movl 0xb0(%r15), %ecx
movl %eax, 0xc(%rsp)
imull %eax, %ecx
movq %r12, %rax
movq %r15, %r13
xorl %edx, %edx
divq %rcx
movq %r15, %rdi
movq %rax, 0x20(%rsp)
movq %rax, %rsi
movq %r14, 0x28(%rsp)
movq %r14, %rdx
callq 0x316e82
movq %rax, %r14
movq 0x10(%rax), %rdi
movq 0xd0(%r15), %rax
movq 0xd8(%r15), %rcx
movq %rbx, 0x10(%rsp)
movl %ebx, %edx
shll $0x2, %edx
movl 0x4(%r14), %esi
addl (%rcx,%rdx), %esi
movl (%rax,%rdx), %edx
callq 0x2fcc2c
movq %rax, %rbp
movl 0xb4(%r15), %ecx
movq %r12, 0x38(%rsp)
movq %r12, %rax
xorl %edx, %edx
divq %rcx
movl (%r14), %r10d
movq %r14, 0x18(%rsp)
movl 0x4(%r14), %ecx
movl 0xe0(%r15), %edx
movl 0xc0(%r15), %esi
addq %rdx, %rsi
movl 0xb8(%r15), %r11d
addq %rsi, %r11
addq %rcx, %r11
movl 0xb0(%r15), %ecx
xorl %edx, %edx
divq %rcx
testq %rdx, %rdx
je 0x315abb
movq %rdx, %rbx
movl 0x68(%r13), %edx
movq %r10, 0x40(%rsp)
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rdi
movq %r11, %rsi
movq %rdx, %r15
movq %r11, %r14
callq 0x2fba84
movl %eax, %r12d
cmpq %r12, 0x48(%r13)
jbe 0x315b66
movzwl 0xc4(%r13), %esi
movl 0x60(%r13), %edx
movq 0x58(%r13), %rdi
imulq %r12, %rsi
addq 0x10(%rsp), %rsi
imulq %rdx, %rsi
callq 0x2fba84
movl %eax, %eax
addq %rax, %rbp
movq 0x50(%r13), %rax
leaq (%r12,%r12,2), %rcx
movl 0x8(%rax,%rcx,8), %eax
movq 0x40(%rsp), %r10
addq %rax, %r10
movq %r15, %rdx
addq %r15, %r14
decl %ebx
movq %r14, %r11
jne 0x315a4a
subq $0x8, %rsp
movq %r13, %rdi
movq 0x20(%rsp), %rsi
movq 0x40(%rsp), %r14
movq %r14, %rdx
movq 0x18(%rsp), %r12
movl %r12d, %ecx
movl 0x14(%rsp), %r8d
movq %rbp, %r9
pushq 0x38(%rsp)
pushq %r10
pushq %r11
callq 0x3171bc
addq $0x20, %rsp
movq %rax, %rbx
cmpb 0xc6(%r13), %r12b
jne 0x315b2f
movl 0xb0(%r13), %eax
movq 0x20(%rsp), %rcx
imulq %rax, %rcx
movl 0xb4(%r13), %esi
imulq %rcx, %rsi
movq 0x70(%r13), %rdi
movq 0x28(%rsp), %rcx
addq $0x20, %rcx
movq %r14, %rdx
callq 0x319873
subq %rax, %rbx
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x70(%r15), %rdi
addq $0x20, %r14
xorl %esi, %esi
movq %r12, %rdx
movl %ebx, %ecx
movq %r14, %r8
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3195ee
callq 0x9189c
callq 0x918d5
callq 0x91863
callq 0x173b0