// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/eis-blockcomp.c
// Function: blockCompSeqPosPairRangeRank
static void
blockCompSeqPosPairRangeRank(struct encIdxSeq *eSeqIdx, AlphabetRangeID range,
                             GtUword posA, GtUword posB,
                             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;
      AlphabetRangeSize rsize = MRAEncGetRangeSize(eSeqIdx->alphabet, range);
      /* Only when both positions are in same bucket, special treatment
       * makes sense. */
      GtUword bucketNum = bucketNumFromPos(seqIdx, posA);
      if (bucketNum != bucketNumFromPos(seqIdx, posB))
      {
        blockCompSeqRangeRank(eSeqIdx, range, posA, rankCounts, hint);
        blockCompSeqRangeRank(eSeqIdx, range, posB, rankCounts + rsize, hint);
        return;
      }
#ifdef USE_SBLOCK_CACHE
      sBlock = cacheFetchSuperBlock(seqIdx, bucketNum,
                                    &hint->bcHint.sBlockCache);
#else
      sBlock = fetchSuperBlock(seqIdx, bucketNum, NULL);
#endif
      {
        GtUword blockNumA = blockNumFromPos(seqIdx, posA),
          blockNumB = blockNumFromPos(seqIdx, posB);
        unsigned blockSize = seqIdx->blockSize,
          inBucketBlockNumA = blockNumA % seqIdx->bucketBlocks,
          inBucketBlockNumB = blockNumB % seqIdx->bucketBlocks;
        sBlockGetPartialSymSums(sBlock, seqIdx, rankCounts);
        walkCompIndicesPrefix(
          seqIdx, sBlock, inBucketBlockNumA, cwIdxMemOffset,
          addSymCountsFromComposition(&seqIdx->compositionTable,
                                      seqIdx->blockMapAlphabetSize, compIndex,
                                      rankCounts);,
          varDataMemOffset);
        memcpy(rankCounts + rsize, rankCounts, rsize * sizeof (rankCounts[0]));
        adjustRanksForBlock(seqIdx, sBlock, posA, blockSize, rankCounts,
                            cwIdxMemOffset, varDataMemOffset);
        walkCompIndices(
          seqIdx, sBlock, inBucketBlockNumB - inBucketBlockNumA, cwIdxMemOffset,
          addSymCountsFromComposition(&seqIdx->compositionTable,
                                      seqIdx->blockMapAlphabetSize, compIndex,
                                      rankCounts + rsize);,
          varDataMemOffset);
        adjustRanksForBlock(seqIdx, sBlock, posB, blockSize,
                            rankCounts + rsize,
                            cwIdxMemOffset, varDataMemOffset);
        {
          GtUword base = bucketBasePos(seqIdx, bucketNum);
          rankCounts[seqIdx->blockEncFallback]
            -= gt_SRLAllSymbolsCountInSeqRegion(
              seqIdx->rangeEncs, base, posA, &hint->bcHint.rangeHint);
          rankCounts[rsize + seqIdx->blockEncFallback]
            -= gt_SRLAllSymbolsCountInSeqRegion(
              seqIdx->rangeEncs, base, posB, &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, posA,
          MRAEncRevMapSymbol(seqIdx->rangeMapAlphabet, sym),
          &hint->bcHint.rangeHint);
      for (sym = 0; sym < rangeEncNumSyms; ++sym)
        rankCounts[sym + rangeEncNumSyms]
          = gt_SRLSymbolCountInSeqRegion(
            seqIdx->rangeEncs, 0, posB,
            MRAEncRevMapSymbol(seqIdx->rangeMapAlphabet, sym),
            &hint->bcHint.rangeHint);
    }
    break;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %r9, 0x20(%rsp)
movq %r8, 0x18(%rsp)
testq %rdi, %rdi
je 0x2ab2a1
movq %rdi, %r14
leaq 0x18cc7a(%rip), %rax    # 0x437b80
cmpq %rax, (%rdi)
jne 0x2ab2a1
movq %rcx, %rbx
movq %rdx, %r12
movl %esi, %ebp
movq %r14, %rdi
callq 0x2abb6e
movq 0x8(%r14), %rdi
cmpl %ebp, 0x4(%rdi)
jbe 0x2ab2cf
movq %rbx, 0x38(%rsp)
movq 0xa8(%r14), %rax
movl %ebp, %ecx
movl (%rax,%rcx,4), %eax
cmpl $0x2, %eax
je 0x2ab087
cmpl $0x1, %eax
jne 0x2ab292
movl %ebp, %esi
callq 0x2a8adf
movl %eax, %r13d
movl 0xb4(%r14), %ecx
imull 0xb0(%r14), %ecx
movq %r12, %rax
xorl %edx, %edx
divq %rcx
movq %rax, %rsi
movq 0x38(%rsp), %r15
movq %r15, %rax
xorl %edx, %edx
divq %rcx
cmpq %rax, %rsi
jne 0x2ab12a
movw %r13w, 0x16(%rsp)
movq %r14, %rdi
movq %rsi, 0x60(%rsp)
movq 0x20(%rsp), %rdx
callq 0x2abbb7
movq %rax, %rbx
movl 0xb0(%r14), %edi
movl 0xb4(%r14), %esi
movq %r12, 0x48(%rsp)
movq %r12, %rax
xorl %edx, %edx
divq %rsi
movq %rax, %rcx
movq %r15, %rax
xorl %edx, %edx
movq %rsi, 0x40(%rsp)
divq %rsi
movq %rax, %rsi
movq %rcx, %rax
xorl %edx, %edx
divq %rdi
movq %rdx, %r12
movq %rsi, %rax
xorl %edx, %edx
divq %rdi
movq %rdx, %r15
movq %rbx, %rdi
movq %r14, %rsi
movq 0x18(%rsp), %rdx
callq 0x2ac140
movl (%rbx), %eax
movq %rax, 0x28(%rsp)
movq %rbx, 0x30(%rsp)
movl 0x4(%rbx), %eax
movl 0xe0(%r14), %ecx
movl 0xc0(%r14), %edx
addq %rcx, %rdx
movl 0x68(%r14), %ebp
movl 0xb8(%r14), %r13d
addq %rdx, %r13
addq %rax, %r13
leaq 0x48(%r14), %rax
movq %rax, 0x50(%rsp)
movq %r12, 0x58(%rsp)
subl $0x1, %r12d
jb 0x2ab16d
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rdi
movq %r13, %rsi
movl %ebp, %edx
callq 0x28c984
movl %eax, %ebx
movzwl 0xc4(%r14), %esi
movq 0x50(%rsp), %rdi
movl %eax, %edx
movq 0x18(%rsp), %rcx
callq 0x2ac16a
movq 0x50(%r14), %rax
movl %ebx, %ecx
imulq $0x18, %rcx, %rcx
movl 0x8(%rax,%rcx), %eax
addq %rax, 0x28(%rsp)
addq %rbp, %r13
jmp 0x2ab037
movq %r12, %r13
movq 0xa0(%r14), %rdi
callq 0x14906a
addq $0x20, 0x20(%rsp)
movzwl %ax, %r15d
xorl %r12d, %r12d
movq 0x18(%rsp), %rbp
cmpq %r12, %r15
je 0x2ab0e0
movq 0x70(%r14), %rbx
movq 0xa0(%r14), %rdi
movzbl %r12b, %esi
callq 0x2ac265
movzbl %al, %ecx
movq %rbx, %rdi
xorl %esi, %esi
movq %r13, %rdx
movq 0x20(%rsp), %r8
callq 0x2ae5ea
movq %rax, (%rbp,%r12,8)
incq %r12
jmp 0x2ab0a8
movq %rbp, %rax
movq 0x20(%rsp), %rbp
leaq (%rax,%r15,8), %r12
xorl %r13d, %r13d
cmpq %r13, %r15
je 0x2ab292
movq 0x70(%r14), %rbx
movq 0xa0(%r14), %rdi
movzbl %r13b, %esi
callq 0x2ac265
movzbl %al, %ecx
movq %rbx, %rdi
xorl %esi, %esi
movq 0x38(%rsp), %rdx
movq %rbp, %r8
callq 0x2ae5ea
movq %rax, (%r12,%r13,8)
incq %r13
jmp 0x2ab0ef
movq %r14, %rdi
movl %ebp, %esi
movq %r12, %rdx
movq 0x18(%rsp), %r12
movq %r12, %rcx
movq 0x20(%rsp), %rbx
movq %rbx, %r8
callq 0x2aac56
movzwl %r13w, %eax
leaq (%r12,%rax,8), %rcx
movq %r14, %rdi
movl %ebp, %esi
movq %r15, %rdx
movq %rbx, %r8
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2aac56
movzwl 0x16(%rsp), %edx
shll $0x3, %edx
movq 0x18(%rsp), %rbx
leaq (%rbx,%rdx), %rdi
movq %rdi, %r12
movq %rbx, %rsi
callq 0x17630
movq 0x28(%rsp), %rax
movq %rax, (%rsp)
movq %r14, %rdi
movq 0x30(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq 0x40(%rsp), %rcx
movq %rbx, %r8
movq %r13, %r9
callq 0x2ac1f9
subl 0x58(%rsp), %r15d
movl 0x68(%r14), %ebp
subl $0x1, %r15d
jb 0x2ab202
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rdi
movq %r13, %rsi
movl %ebp, %edx
callq 0x28c984
movl %eax, %ebx
movzwl 0xc4(%r14), %esi
movq 0x50(%rsp), %rdi
movl %eax, %edx
movq %r12, %rcx
callq 0x2ac16a
movq 0x50(%r14), %rax
movl %ebx, %ecx
imulq $0x18, %rcx, %rcx
movl 0x8(%rax,%rcx), %eax
addq %rax, 0x28(%rsp)
addq %rbp, %r13
jmp 0x2ab1b8
movq 0x28(%rsp), %rax
movq %rax, (%rsp)
movq %r14, %rdi
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rbp
movq %rbp, %rdx
movq 0x40(%rsp), %rcx
movq %r12, %r8
movq %r13, %r9
callq 0x2ac1f9
movl 0xb0(%r14), %eax
movq 0x60(%rsp), %rcx
imulq %rax, %rcx
movl 0xb4(%r14), %ebx
imulq %rcx, %rbx
movq 0x70(%r14), %rdi
movq 0x20(%rsp), %r15
addq $0x20, %r15
movq %rbx, %rsi
movq 0x48(%rsp), %rdx
movq %r15, %rcx
callq 0x2ae7ee
movzbl 0xc6(%r14), %ecx
movq 0x18(%rsp), %rdx
subq %rax, (%rdx,%rcx,8)
movq 0x70(%r14), %rdi
movq %rbx, %rsi
movq %rbp, %rdx
movq %r15, %rcx
callq 0x2ae7ee
movzbl 0xc6(%r14), %ecx
subq %rax, (%r12,%rcx,8)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x18ccc0(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x39d61(%rip), %rsi     # 0x2e5013
leaq 0xd6322(%rip), %rdx     # 0x3815db
leaq 0xd65b0(%rip), %rcx     # 0x381870
leaq 0xd5ab9(%rip), %r8      # 0x380d80
movl $0x5be, %r9d            # imm = 0x5BE
jmp 0x2ab2fb
movq 0x18cc92(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x39d33(%rip), %rsi     # 0x2e5013
leaq 0xd6539(%rip), %rdx     # 0x381820
leaq 0xd6582(%rip), %rcx     # 0x381870
leaq 0xd5a8b(%rip), %r8      # 0x380d80
movl $0x5c0, %r9d            # imm = 0x5C0
xorl %eax, %eax
callq 0x17a50
callq 0x17390