// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/match/eis-blockcomp.c
// Function: blockCompSeqPosPairRank
static GtUwordPair
blockCompSeqPosPairRank(struct encIdxSeq *eSeqIdx, Symbol eSym,
                        GtUword posA, GtUword posB,
                        union EISHint *hint)
{
  struct blockCompositionSeq *seqIdx;
  GtUwordPair rankCounts;
  GtUword bucketNum;
  gt_assert(eSeqIdx && eSeqIdx->classInfo == &blockCompositionSeqClass);
  gt_assert(posA <= posB);
  seqIdx = encIdxSeq2blockCompositionSeq(eSeqIdx);
  gt_assert(gt_MRAEncSymbolIsInSelectedRanges(seqIdx->baseClass.alphabet,
                                        eSym, BLOCK_COMPOSITION_INCLUDE,
                                        seqIdx->modes) >= 0);
  /* Only when both positions are in same bucket, special treatment
   * makes sense. */
  {
    GtUword bucketNumA, bucketNumB;
    bucketNumA = bucketNumFromPos(seqIdx, posA);
    bucketNumB = bucketNumFromPos(seqIdx, posB);
    if (bucketNumA != bucketNumB)
    {
      rankCounts.a = blockCompSeqRank(eSeqIdx, eSym, posA, hint);
      rankCounts.b = blockCompSeqRank(eSeqIdx, eSym, posB, hint);
      return rankCounts;
    }
    bucketNum = bucketNumA;
  }
  if (gt_MRAEncSymbolIsInSelectedRanges(seqIdx->baseClass.alphabet, eSym,
                                     BLOCK_COMPOSITION_INCLUDE, seqIdx->modes))
  {
    BitOffset varDataMemOffset, cwIdxMemOffset;
    struct superBlock *sBlock;
    GtUword blockNumA = blockNumFromPos(seqIdx, posA),
      blockNumB = blockNumFromPos(seqIdx, posB);
    Symbol bSym = MRAEncMapSymbol(seqIdx->blockMapAlphabet, eSym);
    unsigned blockSize = seqIdx->blockSize, bitsPerCompositionIdx
      = seqIdx->compositionTable.compositionIdxBits,
      inBucketBlockNumA = blockNumA % seqIdx->bucketBlocks,
      inBucketBlockNumB = blockNumB % seqIdx->bucketBlocks;
#ifdef USE_SBLOCK_CACHE
    sBlock = cacheFetchSuperBlock(seqIdx, bucketNum,
                                  &hint->bcHint.sBlockCache);
#else
    sBlock = fetchSuperBlock(seqIdx, bucketNum, NULL);
#endif
    rankCounts.a = sBlockGetPartialSymSum(sBlock, bSym, seqIdx);
    walkCompIndicesPrefix(
      seqIdx, sBlock, inBucketBlockNumA, cwIdxMemOffset,
      rankCounts.a += symCountFromComposition(
        &seqIdx->compositionTable, seqIdx->blockMapAlphabetSize, compIndex,
        bSym),
      varDataMemOffset);
    rankCounts.b = rankCounts.a;
    rankCounts.a =
      adjustPosRankForBlock(seqIdx, sBlock, posA, bSym, blockSize,
                            rankCounts.a, cwIdxMemOffset, varDataMemOffset,
                            bitsPerCompositionIdx);
    walkCompIndices(
      seqIdx, sBlock, inBucketBlockNumB - inBucketBlockNumA, cwIdxMemOffset,
      rankCounts.b += symCountFromComposition(
        &seqIdx->compositionTable, seqIdx->blockMapAlphabetSize, compIndex,
        bSym),
      varDataMemOffset);
    rankCounts.b =
      adjustPosRankForBlock(seqIdx, sBlock, posB, bSym, blockSize,
                            rankCounts.b, cwIdxMemOffset, varDataMemOffset,
                            bitsPerCompositionIdx);
    if (bSym == seqIdx->blockEncFallback)
    {
      GtUword base = bucketBasePos(seqIdx, bucketNum);
      rankCounts.a -= gt_SRLAllSymbolsCountInSeqRegion(
        seqIdx->rangeEncs, base, posA, &hint->bcHint.rangeHint);
      rankCounts.b -= gt_SRLAllSymbolsCountInSeqRegion(
        seqIdx->rangeEncs, base, posB, &hint->bcHint.rangeHint);
    }
#ifndef USE_SBLOCK_CACHE
    deleteSuperBlock(sBlock);
#endif
  }
  else
  {
    rankCounts.a = gt_SRLSymbolCountInSeqRegion(seqIdx->rangeEncs, 0, posA,
                                                eSym, &hint->bcHint.rangeHint);
    rankCounts.b = gt_SRLSymbolCountInSeqRegion(seqIdx->rangeEncs, 0, posA,
                                                eSym, &hint->bcHint.rangeHint);
  }
  return rankCounts;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
testq %rdi, %rdi
je 0x30bd01
movq %rdi, %r14
leaq 0x1ad26a(%rip), %rax    # 0x4b8bb0
cmpq %rax, (%rdi)
jne 0x30bd01
movq %rcx, %r12
movq %rdx, %r13
cmpq %rcx, %rdx
ja 0x30bd06
movq %r8, %r15
movq 0x8(%r14), %rdi
movq 0xa8(%r14), %rcx
movzbl %sil, %ebx
movl %ebx, %esi
movl $0x1, %edx
callq 0x19e32c
testl %eax, %eax
js 0x30bd0b
movl 0xb4(%r14), %ecx
imull 0xb0(%r14), %ecx
movq %r13, %rax
xorl %edx, %edx
divq %rcx
movq %rax, %rbp
movq %r12, %rax
xorl %edx, %edx
divq %rcx
cmpq %rax, %rbp
jne 0x30bc86
movq 0x8(%r14), %rdi
movq 0xa8(%r14), %rcx
movl %ebx, %esi
movl $0x1, %edx
callq 0x19e32c
testl %eax, %eax
je 0x30bcab
movq 0x98(%r14), %rsi
cmpl $0x1, (%rsi)
jne 0x30bd10
movl 0xb4(%r14), %edi
movq %r12, 0x50(%rsp)
movq %r12, %rax
xorl %edx, %edx
divq %rdi
movq %rax, %rcx
movq %r13, 0x28(%rsp)
movq %r13, %rax
xorl %edx, %edx
movq %rdi, 0x38(%rsp)
divq %rdi
movzbl 0x18(%rsi,%rbx), %ebx
movl 0x68(%r14), %edx
movq %rdx, 0x30(%rsp)
movl 0xb0(%r14), %esi
xorl %edx, %edx
divq %rsi
movq %rdx, %r13
movq %rcx, %rax
xorl %edx, %edx
divq %rsi
movq %rdx, 0x60(%rsp)
movq %r14, %rdi
movq %rbp, 0x40(%rsp)
movq %rbp, %rsi
movq %r15, 0x48(%rsp)
movq %r15, %rdx
callq 0x30cc26
movq %rax, %r12
movq 0x10(%rax), %rdi
movq 0xd0(%r14), %rax
movq 0xd8(%r14), %rcx
movq %rbx, 0x8(%rsp)
movl %ebx, %edx
shll $0x2, %edx
movl (%rcx,%rdx), %esi
addl 0x4(%r12), %esi
movl (%rax,%rdx), %edx
callq 0x2f37dc
movq %rax, (%rsp)
movl (%r12), %ebx
movq %r12, 0x10(%rsp)
movl 0x4(%r12), %eax
movl 0xc0(%r14), %ecx
movl 0xe0(%r14), %edx
addq %rcx, %rdx
movl 0xb8(%r14), %r12d
addq %rdx, %r12
addq %rax, %r12
testq %r13, %r13
movq %r13, 0x58(%rsp)
movq %r14, 0x18(%rsp)
je 0x30bb35
movl 0x68(%r14), %edx
movl %r13d, %ebp
movq %rbx, %r15
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rdi
movq %r12, %rsi
movq %rdx, %r14
callq 0x2f2688
movl %eax, %r13d
movq 0x18(%rsp), %rax
cmpq %r13, 0x48(%rax)
jbe 0x30bcf7
movq 0x18(%rsp), %rbx
movzwl 0xc4(%rbx), %esi
movl 0x60(%rbx), %edx
movq 0x58(%rbx), %rdi
imulq %r13, %rsi
addq 0x8(%rsp), %rsi
imulq %rdx, %rsi
callq 0x2f2688
movl %eax, %eax
addq %rax, (%rsp)
movq 0x50(%rbx), %rax
leaq (,%r13,2), %rcx
addq %r13, %rcx
movl 0x8(%rax,%rcx,8), %eax
movq %r15, %rbx
addq %rax, %rbx
movq %r14, %rdx
addq %r14, %r12
decl %ebp
jne 0x30babe
subq $0x8, %rsp
movq 0x20(%rsp), %r15
movq %r15, %rdi
movq 0x18(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x10(%rsp), %rcx
movq 0x40(%rsp), %r8
movq 0x8(%rsp), %r9
pushq 0x38(%rsp)
pushq %rbx
pushq %r12
callq 0x30cfac
addq $0x20, %rsp
movq %rax, 0x20(%rsp)
movq 0x60(%rsp), %rbp
subl 0x58(%rsp), %ebp
je 0x30bbe7
movl 0x68(%r15), %edx
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rdi
movq %r12, %rsi
movq %rdx, %r14
callq 0x2f2688
movl %eax, %r13d
cmpq %r13, 0x48(%r15)
jbe 0x30bcfc
movzwl 0xc4(%r15), %esi
movl 0x60(%r15), %edx
movq 0x58(%r15), %rdi
imulq %r13, %rsi
addq 0x8(%rsp), %rsi
imulq %rdx, %rsi
callq 0x2f2688
movl %eax, %eax
addq %rax, (%rsp)
movq 0x50(%r15), %rax
leaq (,%r13,2), %rcx
addq %r13, %rcx
movl 0x8(%rax,%rcx,8), %eax
addq %rax, %rbx
movq %r14, %rdx
addq %r14, %r12
decl %ebp
jne 0x30bb7e
subq $0x8, %rsp
movq %r15, %rdi
movq 0x18(%rsp), %rsi
movq 0x58(%rsp), %r13
movq %r13, %rdx
movq 0x10(%rsp), %rbp
movl %ebp, %ecx
movq 0x40(%rsp), %r8
movq 0x8(%rsp), %r9
pushq 0x38(%rsp)
pushq %rbx
pushq %r12
callq 0x30cfac
addq $0x20, %rsp
movq %rax, %rbx
cmpb 0xc6(%r15), %bpl
jne 0x30bcf0
movq %r15, %r14
movl 0xb0(%r15), %eax
movl 0xb4(%r15), %ecx
movq 0x40(%rsp), %r12
imulq %rax, %r12
imulq %rcx, %r12
movq 0x70(%r15), %rdi
movq 0x48(%rsp), %r15
addq $0x20, %r15
movq %r12, %rsi
movq 0x28(%rsp), %rdx
movq %r15, %rcx
callq 0x30f6e7
movq 0x20(%rsp), %rbp
subq %rax, %rbp
movq 0x70(%r14), %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0x30f6e7
subq %rax, %rbx
jmp 0x30bcdb
movq %r14, %rdi
movl %ebx, %esi
movq %r13, %rdx
movq %r15, %rcx
callq 0x30b6a7
movq %rax, %rbp
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
movq %r15, %rcx
callq 0x30b6a7
jmp 0x30bcd8
movq 0x70(%r14), %rdi
addq $0x20, %r15
xorl %esi, %esi
movq %r13, %rdx
movl %ebx, %ecx
movq %r15, %r8
callq 0x30f462
movq %rax, %rbp
movq 0x70(%r14), %rdi
xorl %esi, %esi
movq %r13, %rdx
movl %ebx, %ecx
movq %r15, %r8
callq 0x30f462
movq %rax, %rbx
movq %rbp, %rax
movq %rbx, %rdx
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x20(%rsp), %rbp
jmp 0x30bcdb
callq 0x8fbbf
callq 0x8fbf8
callq 0x8fc6a
callq 0x8fc31
callq 0x8fb86
callq 0x173b0