// File: /workspace/github_c_makefile_star2_O2/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 $0x78, %rsp
testq %rdi, %rdi
je 0x2aabc2
leaq 0x18d38b(%rip), %rax    # 0x437b80
cmpq %rax, (%rdi)
jne 0x2aabc2
movq %rcx, %r12
movq %rdx, %r15
movq %rdi, 0x10(%rsp)
cmpq %rcx, %rdx
ja 0x2aabf0
movq %r8, %r14
movl %esi, %ebx
movq 0x10(%rsp), %r13
movq %r13, %rdi
callq 0x2abb6e
movq 0x8(%r13), %rdi
movq 0xa8(%r13), %rcx
movzbl %bl, %ebx
pushq $0x1
popq %rdx
movl %ebx, %esi
callq 0x1493cf
testl %eax, %eax
js 0x2aac1e
movl 0xb4(%r13), %ecx
imull 0xb0(%r13), %ecx
movq %r15, %rax
xorl %edx, %edx
divq %rcx
movq %rax, %rbp
movq %r12, %rax
xorl %edx, %edx
divq %rcx
cmpq %rax, %rbp
jne 0x2aa9eb
movq 0x8(%r13), %rdi
movq 0xa8(%r13), %rcx
pushq $0x1
popq %rdx
movl %ebx, %esi
callq 0x1493cf
testl %eax, %eax
je 0x2aab7d
movl 0xb4(%r13), %ecx
movq %r15, 0x30(%rsp)
movq %r15, %rax
xorl %edx, %edx
divq %rcx
movq %rax, %r15
movq %r12, 0x40(%rsp)
movq %r12, %rax
xorl %edx, %edx
divq %rcx
movq %rax, 0x8(%rsp)
movq 0x98(%r13), %rdi
movl %ebx, %esi
callq 0x2a8b86
movl %eax, %r12d
movl 0xb4(%r13), %eax
movl %eax, 0x1c(%rsp)
leaq 0x48(%r13), %rax
movq %rax, 0x48(%rsp)
movl 0x68(%r13), %eax
movq %rax, 0x38(%rsp)
movl 0xb0(%r13), %ecx
movq %r15, %rax
xorl %edx, %edx
divq %rcx
movq %rdx, %rbx
movq 0x8(%rsp), %rax
xorl %edx, %edx
divq %rcx
movq %rdx, 0x70(%rsp)
movq %r13, %rdi
movq %rbp, 0x50(%rsp)
movq %rbp, %rsi
movq %r14, 0x58(%rsp)
movq %r14, %rdx
callq 0x2abbb7
movq %rax, %r14
movb %r12b, 0x3(%rsp)
movzbl %r12b, %esi
movq %rax, %rdi
movl %esi, 0x4(%rsp)
movq %r13, %rdx
callq 0x2abdb4
movq %rax, %r9
movl (%r14), %r10d
movq %r14, 0x8(%rsp)
movl 0x4(%r14), %eax
movl 0xe0(%r13), %ecx
movl 0xc0(%r13), %edx
addq %rcx, %rdx
movl 0x68(%r13), %ecx
movq %rcx, 0x20(%rsp)
movl 0xb8(%r13), %ebp
addq %rdx, %rbp
addq %rax, %rbp
movq %rbx, 0x60(%rsp)
movl %ebx, %r14d
movq 0x10(%rsp), %r12
subl $0x1, %r14d
jb 0x2aaa13
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rdi
movq %rbp, %r15
movq %rbp, %rsi
movq 0x20(%rsp), %rbp
movl %ebp, %edx
movq %r10, 0x28(%rsp)
movq %r9, %rbx
callq 0x28c984
movl %eax, %r13d
movzwl 0xc4(%r12), %esi
movq 0x48(%rsp), %rdi
movl %eax, %edx
movl 0x4(%rsp), %ecx
callq 0x2abdde
movq %rbx, %r9
movq 0x28(%rsp), %r10
movl %eax, %eax
addq %rax, %r9
movq 0x50(%r12), %rax
movl %r13d, %ecx
imulq $0x18, %rcx, %rcx
movl 0x8(%rax,%rcx), %eax
addq %rax, %r10
addq %rbp, %r15
movq %r15, %rbp
jmp 0x2aa97a
movq %r13, %rdi
movl %ebx, %esi
movq %r15, %rdx
movq %r14, %rcx
callq 0x2aa50c
movq %rax, %rbp
movq %r13, %rdi
movl %ebx, %esi
movq %r12, %rdx
movq %r14, %rcx
callq 0x2aa50c
jmp 0x2aabaa
subq $0x8, %rsp
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
movq 0x38(%rsp), %rdx
movl 0xc(%rsp), %ecx
movl 0x24(%rsp), %r8d
movq %r9, %r12
pushq 0x40(%rsp)
pushq %r10
pushq %rbp
movq %r10, %r15
callq 0x2abe6e
movq %r12, %r9
movq %r15, %r12
addq $0x20, %rsp
movq %rax, 0x68(%rsp)
movq 0x70(%rsp), %rdx
subl 0x60(%rsp), %edx
movl 0x68(%rbx), %eax
movq %rax, 0x20(%rsp)
movq 0x40(%rsp), %r13
movq 0x20(%rsp), %r14
subl $0x1, %edx
jb 0x2aaae1
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rdi
movq %rbp, %r15
movq %rbp, %rsi
movq %rdx, %rbp
movl %r14d, %edx
movq %r9, %rbx
callq 0x28c984
movq %r15, 0x28(%rsp)
movl %eax, %r13d
movq 0x10(%rsp), %r15
movzwl 0xc4(%r15), %esi
movq 0x48(%rsp), %rdi
movl %eax, %edx
movl 0x4(%rsp), %ecx
callq 0x2abdde
movq %rbp, %rdx
movq %rbx, %r9
movl %eax, %eax
addq %rax, %r9
movq 0x50(%r15), %rax
movl %r13d, %ecx
movq 0x40(%rsp), %r13
movq 0x28(%rsp), %rbp
imulq $0x18, %rcx, %rcx
movl 0x8(%rax,%rcx), %eax
addq %rax, %r12
addq %r14, %rbp
jmp 0x2aaa6e
subq $0x8, %rsp
movq 0x18(%rsp), %r14
movq %r14, %rdi
movq 0x10(%rsp), %rsi
movq %r13, %rdx
movl 0xc(%rsp), %ecx
movl 0x24(%rsp), %r8d
pushq 0x40(%rsp)
pushq %r12
pushq %rbp
callq 0x2abe6e
addq $0x20, %rsp
movq %rax, %rbx
movb 0x3(%rsp), %al
cmpb 0xc6(%r14), %al
movq 0x68(%rsp), %rbp
jne 0x2aabad
movl 0xb0(%r14), %eax
movq 0x50(%rsp), %rcx
imulq %rax, %rcx
movl 0xb4(%r14), %r15d
imulq %rcx, %r15
movq 0x70(%r14), %rdi
movq %r14, %r12
movq 0x58(%rsp), %r14
addq $0x20, %r14
movq %r15, %rsi
movq 0x30(%rsp), %rdx
movq %r14, %rcx
callq 0x2ae7ee
subq %rax, %rbp
movq 0x70(%r12), %rdi
movq %r15, %rsi
movq %r13, %rdx
movq %r14, %rcx
callq 0x2ae7ee
subq %rax, %rbx
jmp 0x2aabad
movq 0x70(%r13), %rdi
addq $0x20, %r14
xorl %esi, %esi
movq %r15, %rdx
movl %ebx, %ecx
movq %r14, %r8
callq 0x2ae5ea
movq %rax, %rbp
movq 0x70(%r13), %rdi
xorl %esi, %esi
movq %r15, %rdx
movl %ebx, %ecx
movq %r14, %r8
callq 0x2ae5ea
movq %rax, %rbx
movq %rbp, %rax
movq %rbx, %rdx
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x18d39f(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x3a440(%rip), %rsi     # 0x2e5013
leaq 0xd6a01(%rip), %rdx     # 0x3815db
leaq 0xd6c11(%rip), %rcx     # 0x3817f2
leaq 0xd6198(%rip), %r8      # 0x380d80
movl $0x4ce, %r9d            # imm = 0x4CE
jmp 0x2aac4a
movq 0x18d371(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x3a412(%rip), %rsi     # 0x2e5013
leaq 0x99702(%rip), %rdx     # 0x34430a
leaq 0xd6be3(%rip), %rcx     # 0x3817f2
leaq 0xd616a(%rip), %r8      # 0x380d80
movl $0x4cf, %r9d            # imm = 0x4CF
jmp 0x2aac4a
movq 0x18d343(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x3a3e4(%rip), %rsi     # 0x2e5013
leaq 0xd69f1(%rip), %rdx     # 0x381627
leaq 0xd6bb5(%rip), %rcx     # 0x3817f2
leaq 0xd613c(%rip), %r8      # 0x380d80
movl $0x4d3, %r9d            # imm = 0x4D3
xorl %eax, %eax
callq 0x17a50
callq 0x17390