// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/match/eis-blockcomp.c
// Function: blockCompSeqRangeRank
static void
blockCompSeqRangeRank(struct encIdxSeq *eSeqIdx, AlphabetRangeID range,
                      GtUword pos, GtUword *rankCounts,
                      union EISHint *hint)
{
  struct blockCompositionSeq *seqIdx;
  gt_assert(eSeqIdx && eSeqIdx->classInfo == &blockCompositionSeqClass);
  seqIdx = encIdxSeq2blockCompositionSeq(eSeqIdx);
  gt_assert(range < MRAEncGetNumRanges(EISGetAlphabet(eSeqIdx)));
  switch (seqIdx->modes[range])
  {
  case BLOCK_COMPOSITION_INCLUDE:
    {
      BitOffset varDataMemOffset, cwIdxMemOffset;
      struct superBlock *sBlock;
      GtUword blockNum, bucketNum;
      unsigned blockSize = seqIdx->blockSize;
      bucketNum = bucketNumFromPos(seqIdx, pos);
#ifdef USE_SBLOCK_CACHE
      sBlock = cacheFetchSuperBlock(seqIdx, bucketNum,
                                    &hint->bcHint.sBlockCache);
#else
      sBlock = fetchSuperBlock(seqIdx, bucketNum, NULL);
#endif
      {
        sBlockGetPartialSymSums(sBlock, seqIdx, rankCounts);
        blockNum = blockNumFromPos(seqIdx, pos);
        walkCompIndicesPrefix(
          seqIdx, sBlock, blockNum % seqIdx->bucketBlocks, cwIdxMemOffset,
          addSymCountsFromComposition(&seqIdx->compositionTable,
                                      seqIdx->blockMapAlphabetSize, compIndex,
                                      rankCounts);,
          varDataMemOffset);
        adjustRanksForBlock(seqIdx, sBlock, pos, blockSize, rankCounts,
                            cwIdxMemOffset, varDataMemOffset);
        {
          GtUword base = bucketBasePos(seqIdx, bucketNum);
          rankCounts[seqIdx->blockEncFallback]
            -= gt_SRLAllSymbolsCountInSeqRegion(
              seqIdx->rangeEncs, base, pos, &hint->bcHint.rangeHint);
        }
      }
#ifndef USE_SBLOCK_CACHE
      deleteSuperBlock(sBlock);
#endif
    }
    break;
  case REGIONS_LIST:
    {
      AlphabetRangeSize sym,
        rangeEncNumSyms = gt_MRAEncGetSize(seqIdx->rangeMapAlphabet);
      for (sym = 0; sym < rangeEncNumSyms; ++sym)
        rankCounts[sym] = gt_SRLSymbolCountInSeqRegion(
          seqIdx->rangeEncs, 0, pos,
          MRAEncRevMapSymbol(seqIdx->rangeMapAlphabet, sym),
          &hint->bcHint.rangeHint);
    }
    break;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
testq %rdi, %rdi
je 0x30bf5d
movq %rdi, %r14
leaq 0x1ace7a(%rip), %rax    # 0x4b8bb0
cmpq %rax, (%rdi)
jne 0x30bf5d
movq 0x8(%r14), %rax
cmpl %esi, 0x4(%rax)
jbe 0x30bf62
movq %r8, %r13
movq %rcx, %r12
movq %rdx, %rbp
movq 0xa8(%r14), %rax
movl %esi, %ecx
movl (%rax,%rcx,4), %eax
cmpl $0x2, %eax
je 0x30bef4
cmpl $0x1, %eax
jne 0x30bf44
movl 0xb4(%r14), %eax
movl 0xb0(%r14), %ecx
movl %eax, 0xc(%rsp)
imull %eax, %ecx
movq %rbp, %rax
xorl %edx, %edx
divq %rcx
movq %r14, %rdi
movq %rax, 0x20(%rsp)
movq %rax, %rsi
movq %r13, 0x30(%rsp)
movq %r13, %rdx
callq 0x30cc26
movq %rax, %r15
movl 0x4(%rax), %esi
movq 0x10(%rax), %rdi
movzwl 0xc4(%r14), %edx
movl 0xe0(%r14), %ecx
movq 0xd0(%r14), %r8
movq %r12, 0x10(%rsp)
movq %r12, %r9
callq 0x2f3abd
movl 0xb4(%r14), %ecx
movq %rbp, 0x28(%rsp)
movq %rbp, %rax
xorl %edx, %edx
divq %rcx
movl (%r15), %ebx
movq %r15, 0x18(%rsp)
movl 0x4(%r15), %ecx
movl 0xc0(%r14), %edx
movl 0xe0(%r14), %esi
addq %rdx, %rsi
movl 0xb8(%r14), %r13d
addq %rsi, %r13
addq %rcx, %r13
movl 0xb0(%r14), %ecx
xorl %edx, %edx
divq %rcx
testq %rdx, %rdx
je 0x30be8e
movq %rdx, %r12
movl 0x68(%r14), %r15d
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rdi
movq %r13, %rsi
movl %r15d, %edx
callq 0x2f2688
movl %eax, %ebp
cmpq %rbp, 0x48(%r14)
jbe 0x30bf53
movzwl 0xc4(%r14), %ecx
movl 0x60(%r14), %edx
movq 0x58(%r14), %rdi
movq %rdx, %rsi
imulq %rcx, %rsi
imulq %rbp, %rsi
movq 0x10(%rsp), %r8
callq 0x2f44ef
movq 0x50(%r14), %rax
leaq (,%rbp,2), %rcx
addq %rbp, %rcx
movl 0x8(%rax,%rcx,8), %eax
addq %rax, %rbx
addq %r15, %r13
decl %r12d
jne 0x30be2b
movq %rbx, (%rsp)
movq %r14, %rdi
movq 0x18(%rsp), %rsi
movq 0x28(%rsp), %r15
movq %r15, %rdx
movl 0xc(%rsp), %ecx
movq 0x10(%rsp), %rbx
movq %rbx, %r8
movq %r13, %r9
callq 0x30d183
movl 0xb0(%r14), %eax
movl 0xb4(%r14), %ecx
movq 0x20(%rsp), %rsi
imulq %rax, %rsi
imulq %rcx, %rsi
movq 0x70(%r14), %rdi
movq 0x30(%rsp), %rcx
addq $0x20, %rcx
movq %r15, %rdx
callq 0x30f6e7
movzbl 0xc6(%r14), %ecx
subq %rax, (%rbx,%rcx,8)
jmp 0x30bf44
movq 0xa0(%r14), %rdi
callq 0x19e077
testw %ax, %ax
je 0x30bf44
addq $0x20, %r13
movzwl %ax, %ebx
xorl %r15d, %r15d
movq 0xa0(%r14), %rax
cmpl $0x1, (%rax)
jne 0x30bf58
movq 0x70(%r14), %rdi
movzbl %r15b, %ecx
movzbl 0x118(%rax,%rcx), %ecx
xorl %esi, %esi
movq %rbp, %rdx
movq %r13, %r8
callq 0x30f462
movq %rax, (%r12,%r15,8)
incq %r15
cmpq %r15, %rbx
jne 0x30bf0f
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x8fcdc
callq 0x173b0
callq 0x8fd15
callq 0x8fca3