// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/eis-bwtseq-extinfo.c
// Function: gt_BWTSeqGetRankSort
GtUword
gt_BWTSeqGetRankSort(const BWTSeq *bwtSeq, GtUword pos,
                  AlphabetRangeID range, struct extBitsRetrieval *extBits)
{
  BitOffset locVarBits;
  AlphabetRangeSize rSize;
  gt_assert(bwtSeq->rangeSort[range] == SORTMODE_RANK);
  EISRetrieveExtraBits(bwtSeq->seqIdx, pos, EBRF_RETRIEVE_CWBITS
                       | EBRF_RETRIEVE_VARBITS, extBits, bwtSeq->hint);
  locVarBits = locateVarBits(bwtSeq, extBits);
  rSize = MRAEncGetRangeSize(EISGetAlphabet(bwtSeq->seqIdx), range);
  {
    GtUword ranks[rSize * 2];
    GtUword BWTRankTotal = 0;
    AlphabetRangeSize i;
    EISPosPairRangeRank(bwtSeq->seqIdx, range, extBits->start, pos, ranks,
                        bwtSeq->hint);
    for (i = 0; i < rSize; ++i)
      BWTRankTotal += ranks[i + rSize] - ranks[i];
    return gt_bsGetUlong(extBits->varPart, extBits->varOffset + locVarBits
                       + bwtSeq->bitsPerOrigRank * BWTRankTotal,
                       bwtSeq->bitsPerOrigRank);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x48(%rdi), %rax
movl %edx, %r13d
cmpl $0x2, (%rax,%r13,4)
jne 0x145d78
movq %rcx, %rbx
movl %edx, %r12d
movq %rsi, %r15
movq %rdi, %r14
movq (%rdi), %rdi
movq 0x18(%r14), %r8
movq (%rdi), %rax
pushq $0x2
popq %rdx
callq *0x50(%rax)
movq 0x18(%rbx), %rdi
decq %rdi
callq 0x28a939
movl %eax, -0x2c(%rbp)
movq (%r14), %rax
movq 0x10(%rax), %rax
decq %rax
testb $0x4, 0x40(%r14)
movq %r13, -0x40(%rbp)
je 0x145c79
movl 0x20(%r14), %ecx
xorl %edx, %edx
divq %rcx
movq %rax, %rdi
callq 0x28a939
movl %eax, %r13d
movl 0x40(%r14), %eax
testb $0x1, %al
jne 0x145cc3
xorl %ecx, %ecx
testb $0x2, %al
je 0x145cda
movq 0x8(%rbx), %rax
movq %rax, -0x38(%rbp)
movq 0x18(%rbx), %rdi
callq 0x28a939
movl %eax, -0x30(%rbp)
movq 0x28(%rbx), %rdi
movq -0x38(%rbp), %rsi
movl %eax, %edx
callq 0x28deac
addl -0x2c(%rbp), %r13d
imull %eax, %r13d
addl -0x30(%rbp), %r13d
jmp 0x145cd7
movq 0x20(%rbx), %rdi
movq (%rbx), %rsi
movq 0x18(%rbx), %rdx
callq 0x28b16e
imull %eax, %r13d
movl %r13d, %ecx
movl %ecx, -0x2c(%rbp)
movq (%r14), %rdi
callq 0x145e06
testq %rax, %rax
je 0x145da6
cmpl %r12d, 0x4(%rax)
movq -0x40(%rbp), %rdx
jbe 0x145dd0
movq %r15, %rcx
movq 0x10(%rax), %rax
movzwl (%rax,%rdx,2), %r15d
movl %r15d, %eax
shll $0x4, %eax
movq %rsp, %r13
subq %rax, %r13
movq %r13, %rsp
movq 0x10(%rbx), %rdx
movq (%r14), %rdi
movq 0x18(%r14), %r9
movq (%rdi), %rax
movl %r12d, %esi
movq %r13, %r8
callq *0x20(%rax)
shll $0x3, %r15d
leaq (%r15,%r13), %rax
xorl %ecx, %ecx
xorl %esi, %esi
cmpq %rcx, %r15
je 0x145d4e
addq (%rax,%rcx), %rsi
subq (%r13,%rcx), %rsi
addq $0x8, %rcx
jmp 0x145d3a
movl -0x2c(%rbp), %eax
addq 0x8(%rbx), %rax
movq 0x28(%rbx), %rdi
movl 0x44(%r14), %edx
imulq %rdx, %rsi
addq %rax, %rsi
callq 0x28deac
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2f21e9(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x19f28a(%rip), %rsi    # 0x2e5013
leaq 0x1fcd1e(%rip), %rdx    # 0x342aae
leaq 0x1fcd41(%rip), %rcx    # 0x342ad8
leaq 0x1fcb42(%rip), %r8     # 0x3428e0
movl $0x327, %r9d            # imm = 0x327
jmp 0x145dfa
movq 0x2f21bb(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x19f25c(%rip), %rsi    # 0x2e5013
leaq 0x1fcf1b(%rip), %rdx    # 0x342cd9
leaq 0x1fcf1c(%rip), %rcx    # 0x342ce1
leaq 0x1fc9b9(%rip), %r8     # 0x342785
pushq $0x28
jmp 0x145df8
movq 0x2f2191(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x19f232(%rip), %rsi    # 0x2e5013
leaq 0x1fca94(%rip), %rdx    # 0x34287c
leaq 0x1fcef2(%rip), %rcx    # 0x342ce1
leaq 0x1fc98f(%rip), %r8     # 0x342785
pushq $0x29
popq %r9
xorl %eax, %eax
callq 0x17a50
callq 0x17390