// File: /workspace/github_c_makefile_star2_O1/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 0x315f57
movq %rdi, %r14
leaq 0x1ae025(%rip), %rax    # 0x4c3bc0
cmpq %rax, (%rdi)
jne 0x315f57
movq %rcx, %r15
movq %rdx, %rbp
cmpq %rcx, %rdx
ja 0x315f5c
movq %r8, %r13
movq 0x8(%r14), %rdi
movq 0xa8(%r14), %rcx
movzbl %sil, %ebx
movl %ebx, %esi
movl $0x1, %edx
callq 0x1a6a6a
testl %eax, %eax
js 0x315f61
movl 0xb4(%r14), %ecx
imull 0xb0(%r14), %ecx
movq %rbp, %rax
xorl %edx, %edx
divq %rcx
movq %rax, %rsi
movq %r15, 0x20(%rsp)
movq %r15, %rax
xorl %edx, %edx
divq %rcx
movq %rax, %r12
cmpq %r12, %rsi
je 0x315c37
movq %r14, %rdi
movq %rsi, %r15
movl %ebx, %esi
movq %rbp, %rdx
movq %r13, %rcx
callq 0x3158f8
movq %rax, (%rsp)
movq %r14, %rdi
movl %ebx, %esi
movq 0x20(%rsp), %rdx
movq %r13, %rcx
callq 0x3158f8
movq %r15, %rsi
movq %rax, %r15
cmpq %r12, %rsi
jne 0x315f37
movq %rsi, 0x48(%rsp)
movq 0x8(%r14), %rdi
movq 0xa8(%r14), %rcx
movl %ebx, %esi
movl $0x1, %edx
callq 0x1a6a6a
testl %eax, %eax
je 0x315f06
movq 0x98(%r14), %rsi
cmpl $0x1, (%rsi)
jne 0x315f66
movl 0xb4(%r14), %edi
movq 0x20(%rsp), %rax
xorl %edx, %edx
divq %rdi
movq %rax, %rcx
movq %rbp, 0x30(%rsp)
movq %rbp, %rax
xorl %edx, %edx
movq %rdi, 0x40(%rsp)
divq %rdi
movzbl 0x18(%rsi,%rbx), %ebx
movl 0x68(%r14), %edx
movq %rdx, 0x38(%rsp)
movl 0xb0(%r14), %esi
xorl %edx, %edx
divq %rsi
movq %rdx, %r12
movq %rcx, %rax
xorl %edx, %edx
divq %rsi
movq %rdx, 0x60(%rsp)
movq %r14, %rdi
movq 0x48(%rsp), %rsi
movq %r13, 0x50(%rsp)
movq %r13, %rdx
callq 0x316e82
movq %rax, %r15
movq 0x10(%rax), %rdi
movq 0xd0(%r14), %rax
movq 0xd8(%r14), %rcx
movq %rbx, 0x10(%rsp)
movl %ebx, %edx
shll $0x2, %edx
movl 0x4(%r15), %esi
addl (%rcx,%rdx), %esi
movl (%rax,%rdx), %edx
callq 0x2fcc2c
movq %rax, 0x8(%rsp)
movl (%r15), %ebx
movq %r15, 0x18(%rsp)
movl 0x4(%r15), %eax
movl 0xe0(%r14), %ecx
movl 0xc0(%r14), %edx
addq %rcx, %rdx
movl 0xb8(%r14), %r15d
addq %rdx, %r15
addq %rax, %r15
testq %r12, %r12
movq %r12, 0x58(%rsp)
movq %r14, 0x28(%rsp)
je 0x315dbd
movl 0x68(%r14), %edx
movl %r12d, %ebp
movq %rbx, %r13
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rdi
movq %r15, %rsi
movq %rdx, %r14
callq 0x2fba84
movl %eax, %r12d
movq 0x28(%rsp), %rax
cmpq %r12, 0x48(%rax)
jbe 0x315f4d
movq 0x28(%rsp), %rbx
movzwl 0xc4(%rbx), %esi
movl 0x60(%rbx), %edx
movq 0x58(%rbx), %rdi
imulq %r12, %rsi
addq 0x10(%rsp), %rsi
imulq %rdx, %rsi
callq 0x2fba84
movl %eax, %eax
addq %rax, 0x8(%rsp)
movq 0x50(%rbx), %rax
leaq (%r12,%r12,2), %rcx
movl 0x8(%rax,%rcx,8), %eax
movq %r13, %rbx
addq %rax, %rbx
movq %r14, %rdx
addq %r14, %r15
decl %ebp
jne 0x315d4c
subq $0x8, %rsp
movq 0x30(%rsp), %r13
movq %r13, %rdi
movq 0x20(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq 0x18(%rsp), %rcx
movq 0x48(%rsp), %r8
movq 0x10(%rsp), %r9
pushq 0x40(%rsp)
pushq %rbx
pushq %r15
callq 0x3171bc
addq $0x20, %rsp
movq %rax, (%rsp)
movq 0x60(%rsp), %rbp
subl 0x58(%rsp), %ebp
je 0x315e68
movl 0x68(%r13), %edx
movq 0x18(%rsp), %rax
movq 0x10(%rax), %rdi
movq %r15, %rsi
movq %rdx, %r14
callq 0x2fba84
movl %eax, %r12d
cmpq %r12, 0x48(%r13)
jbe 0x315f52
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, 0x8(%rsp)
movq 0x50(%r13), %rax
leaq (%r12,%r12,2), %rcx
movl 0x8(%rax,%rcx,8), %eax
addq %rax, %rbx
movq %r14, %rdx
addq %r14, %r15
decl %ebp
jne 0x315e05
subq $0x8, %rsp
movq %r13, %rdi
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %r12
movq %r12, %rdx
movq 0x18(%rsp), %rbp
movl %ebp, %ecx
movq 0x48(%rsp), %r8
movq 0x10(%rsp), %r9
pushq 0x40(%rsp)
pushq %rbx
pushq %r15
callq 0x3171bc
addq $0x20, %rsp
movq %rax, %r15
cmpb 0xc6(%r13), %bpl
jne 0x315f37
movq %r13, %r14
movl 0xb0(%r13), %eax
movq 0x48(%rsp), %rcx
imulq %rax, %rcx
movl 0xb4(%r13), %ebx
imulq %rcx, %rbx
movq 0x70(%r13), %rdi
movq %r12, %r13
movq 0x50(%rsp), %r12
addq $0x20, %r12
movq %rbx, %rsi
movq 0x30(%rsp), %rdx
movq %r12, %rcx
callq 0x319873
subq %rax, (%rsp)
movq 0x70(%r14), %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x319873
subq %rax, %r15
jmp 0x315f37
movq 0x70(%r14), %rdi
addq $0x20, %r13
xorl %esi, %esi
movq %rbp, %rdx
movl %ebx, %ecx
movq %r13, %r8
callq 0x3195ee
movq %rax, (%rsp)
movq 0x70(%r14), %rdi
xorl %esi, %esi
movq %rbp, %rdx
movl %ebx, %ecx
movq %r13, %r8
callq 0x3195ee
movq %rax, %r15
movq (%rsp), %rax
movq %r15, %rdx
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x91947
callq 0x91980
callq 0x919f2
callq 0x919b9
callq 0x9190e
callq 0x173b0