// File: /workspace/github_c_makefile_star2_O1/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 0x3161b3
movq %rdi, %r14
leaq 0x1adc34(%rip), %rax    # 0x4c3bc0
cmpq %rax, (%rdi)
jne 0x3161b3
movq 0x8(%r14), %rax
cmpl %esi, 0x4(%rax)
jbe 0x3161b8
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 0x31614a
cmpl $0x1, %eax
jne 0x31619a
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 0x316e82
movq %rax, %r15
movq 0x10(%rax), %rdi
movl 0x4(%rax), %esi
movzwl 0xc4(%r14), %edx
movl 0xe0(%r14), %ecx
movq 0xd0(%r14), %r8
movq %r12, 0x10(%rsp)
movq %r12, %r9
callq 0x2fcf78
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 0xe0(%r14), %edx
movl 0xc0(%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 0x3160e4
movq %rdx, %r12
movl 0x68(%r14), %r15d
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rdi
movq %r13, %rsi
movl %r15d, %edx
callq 0x2fba84
movl %eax, %ebp
cmpq %rbp, 0x48(%r14)
jbe 0x3161a9
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 0x2fd986
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 0x316081
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 0x317393
movl 0xb0(%r14), %eax
movq 0x20(%rsp), %rcx
imulq %rax, %rcx
movl 0xb4(%r14), %esi
imulq %rcx, %rsi
movq 0x70(%r14), %rdi
movq 0x30(%rsp), %rcx
addq $0x20, %rcx
movq %r15, %rdx
callq 0x319873
movzbl 0xc6(%r14), %ecx
subq %rax, (%rbx,%rcx,8)
jmp 0x31619a
movq 0xa0(%r14), %rdi
callq 0x1a67a7
testw %ax, %ax
je 0x31619a
addq $0x20, %r13
movzwl %ax, %ebx
xorl %r15d, %r15d
movq 0xa0(%r14), %rax
cmpl $0x1, (%rax)
jne 0x3161ae
movq 0x70(%r14), %rdi
movzbl %r15b, %ecx
movzbl 0x118(%rax,%rcx), %ecx
xorl %esi, %esi
movq %rbp, %rdx
movq %r13, %r8
callq 0x3195ee
movq %rax, (%r12,%r15,8)
incq %r15
cmpq %r15, %rbx
jne 0x316165
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x91a64
callq 0x173b0
callq 0x91a9d
callq 0x91a2b