// File: /workspace/github_c_makefile_star2_O2/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 $0x58, %rsp
testq %rdi, %rdi
je 0x2aa771
movq %rdi, %r12
leaq 0x18d653(%rip), %rax    # 0x437b80
cmpq %rax, (%rdi)
jne 0x2aa771
movq %rcx, %r14
movq %rdx, %r15
movl %esi, %ebx
movq %r12, %rdi
callq 0x2abb6e
movq 0x8(%r12), %rdi
movq 0xa8(%r12), %rcx
movzbl %bl, %ebx
pushq $0x1
popq %rdx
movl %ebx, %esi
callq 0x1493cf
testl %eax, %eax
js 0x2aa79f
movq 0x8(%r12), %rdi
movq 0xa8(%r12), %rcx
pushq $0x1
popq %rdx
movl %ebx, %esi
callq 0x1493cf
testl %eax, %eax
je 0x2aa74b
movq 0x98(%r12), %rdi
movl %ebx, %esi
callq 0x2a8b86
movl %eax, %ebx
movl 0x68(%r12), %eax
movq %rax, 0x30(%rsp)
movl 0xb4(%r12), %eax
leaq 0x48(%r12), %rcx
movq %rcx, 0x48(%rsp)
movl 0xb0(%r12), %ecx
movl %eax, 0xc(%rsp)
imull %eax, %ecx
movq %r15, %rax
xorl %edx, %edx
divq %rcx
movq %r12, %rdi
movq %rax, 0x20(%rsp)
movq %rax, %rsi
movq %r14, 0x28(%rsp)
movq %r14, %rdx
callq 0x2abbb7
movq %rax, %r14
movb %bl, 0x7(%rsp)
movzbl %bl, %esi
movq %rax, %rdi
movl %esi, 0x8(%rsp)
movq %r12, %rdx
callq 0x2abdb4
movq %rax, %r9
movl 0xb4(%r12), %ecx
movq %r15, 0x38(%rsp)
movq %r15, %rax
xorl %edx, %edx
divq %rcx
movl (%r14), %ebp
movq %r14, 0x10(%rsp)
movl 0x4(%r14), %ecx
movl 0xe0(%r12), %edx
movl 0xc0(%r12), %esi
addq %rdx, %rsi
movl 0xb8(%r12), %r15d
addq %rsi, %r15
addq %rcx, %r15
movl 0x68(%r12), %ecx
movq %rcx, 0x40(%rsp)
movq %r12, 0x18(%rsp)
movl 0xb0(%r12), %ecx
xorl %edx, %edx
divq %rcx
movq %rdx, %r12
movq 0x40(%rsp), %rbx
movq 0x18(%rsp), %r14
subl $0x1, %r12d
jb 0x2aa6c4
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rdi
movq %r15, %rsi
movl %ebx, %edx
movq %r9, 0x50(%rsp)
callq 0x28c984
movl %eax, %r13d
movzwl 0xc4(%r14), %esi
movq 0x48(%rsp), %rdi
movl %eax, %edx
movl 0x8(%rsp), %ecx
callq 0x2abdde
movq 0x50(%rsp), %r9
movl %eax, %eax
addq %rax, %r9
movq 0x50(%r14), %rax
movl %r13d, %ecx
imulq $0x18, %rcx, %rcx
movl 0x8(%rax,%rcx), %eax
addq %rax, %rbp
addq %rbx, %r15
jmp 0x2aa66a
subq $0x8, %rsp
movq 0x20(%rsp), %r13
movq %r13, %rdi
movq 0x18(%rsp), %rsi
movq 0x40(%rsp), %r12
movq %r12, %rdx
movl 0x10(%rsp), %ecx
movl 0x14(%rsp), %r8d
pushq 0x38(%rsp)
pushq %rbp
pushq %r15
callq 0x2abe6e
addq $0x20, %rsp
movq %rax, %rbx
movb 0x7(%rsp), %al
cmpb 0xc6(%r13), %al
jne 0x2aa739
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 %r12, %rdx
callq 0x2ae7ee
subq %rax, %rbx
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x70(%r12), %rdi
addq $0x20, %r14
xorl %esi, %esi
movq %r15, %rdx
movl %ebx, %ecx
movq %r14, %r8
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2ae5ea
movq 0x18d7f0(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x3a891(%rip), %rsi     # 0x2e5013
leaq 0xd6e52(%rip), %rdx     # 0x3815db
leaq 0xd6e86(%rip), %rcx     # 0x381616
leaq 0xd65e9(%rip), %r8      # 0x380d80
movl $0x492, %r9d            # imm = 0x492
jmp 0x2aa7cb
movq 0x18d7c2(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x3a863(%rip), %rsi     # 0x2e5013
leaq 0xd6e70(%rip), %rdx     # 0x381627
leaq 0xd6e58(%rip), %rcx     # 0x381616
leaq 0xd65bb(%rip), %r8      # 0x380d80
movl $0x496, %r9d            # imm = 0x496
xorl %eax, %eax
callq 0x17a50
callq 0x17390