// File: /workspace/github_cpp_makefile_star2_O3/mshabbirhasan[P]ups-indel/include/seqan/seq_io/fai_index.h
// Function: int seqan::readRegion<seqan::SimpleType<unsigned char, seqan::Dna5_>, seqan::Alloc<void>>(seqan::String<seqan::SimpleType<unsigned char, seqan::Dna5_>, seqan::Alloc<void>>&, seqan::FaiIndex const&, unsigned int, unsigned int, unsigned int)
inline int readRegion(String<TValue, TSpec> & str,
                      FaiIndex const & index,
                      unsigned refId,
                      unsigned beginPos,
                      unsigned endPos)
{
    // Limit region to the infix, make sure that beginPos < endPos, compute character to read.
    unsigned seqLen = index.indexEntryStore[refId].sequenceLength;;
    beginPos = std::min(beginPos, seqLen);
    endPos = std::min(std::max(beginPos, endPos), seqLen);
    unsigned toRead = endPos - beginPos;

    typedef typename Iterator<String<char, MMap<> > const, Standard>::Type TSourceIter;
    typedef typename Iterator<String<TValue, TSpec>, Standard>::Type TTargetIter;
    TSourceIter itSource = begin(index.mmapString, Standard());
    __uint64 offset = index.indexEntryStore[refId].offset;
    // First, compute offset of the completely filled lines.
    unsigned numLines = beginPos / index.indexEntryStore[refId].lineLength;
    unsigned numBytes = numLines * index.indexEntryStore[refId].overallLineLength;
    // Then, compute overall offset by adding remaining bytes, too.
    numBytes += beginPos % index.indexEntryStore[refId].lineLength;
    offset += numBytes;
    // Advance iterator in MMap file.
    itSource += offset;

    // Copy out the characters from FASTA file and convert via iterator assignment to target string's type.
    resize(str, toRead, TValue());
    TTargetIter itTarget = begin(str, Standard());
    for (unsigned i = 0; i < toRead; )
    {
        if (isspace(*itSource))
        {
            ++itSource;
            continue;  // Skip spaces.
        }
        *itTarget = *itSource;
        ++itTarget;
        ++itSource;
        ++i;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r8d, %r14d
movl %ecx, %r15d
movq %rsi, %r12
movq %rdi, -0x38(%rbp)
movl %edx, %ebx
leaq -0x48(%rbp), %rdx
movq %rbx, (%rdx)
movq 0x38(%rsi), %rax
subq 0x30(%rsi), %rax
sarq $0x4, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
leaq -0x40(%rbp), %r8
movq %rax, (%r8)
leaq 0x11f1(%rip), %rax      # 0x113a9
movq %rax, (%rsp)
leaq 0x1180(%rip), %rdi      # 0x11343
leaq 0x119e(%rip), %rcx      # 0x11368
leaq 0x11b4(%rip), %r9       # 0x11385
movl $0x1fd, %esi            # imm = 0x1FD
xorl %eax, %eax
callq 0xa00e
testb %al, %al
je 0x10524
leaq (%rbx,%rbx,2), %r13
shlq $0x4, %r13
movq 0x30(%r12), %rax
movl 0x18(%rax,%r13), %ecx
cmpl %r15d, %ecx
cmovbl %ecx, %r15d
cmpl %r14d, %r15d
movl %r15d, -0x30(%rbp)
cmoval %r15d, %r14d
movq 0xe0(%r12), %r15
cmpl %ecx, %r14d
cmovael %ecx, %r14d
leaq -0x48(%rbp), %rdx
movq %rbx, (%rdx)
movq 0x38(%r12), %rcx
subq %rax, %rcx
sarq $0x4, %rcx
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rcx
leaq -0x40(%rbp), %r8
movq %rcx, (%r8)
leaq 0x1162(%rip), %rax      # 0x113a9
movq %rax, (%rsp)
leaq 0x10f1(%rip), %rdi      # 0x11343
leaq 0x110f(%rip), %rcx      # 0x11368
leaq 0x1125(%rip), %r9       # 0x11385
movl $0x1fd, %esi            # imm = 0x1FD
xorl %eax, %eax
callq 0xa00e
testb %al, %al
je 0x10524
movq 0x30(%r12), %rax
movq 0x20(%rax,%r13), %rcx
movq %rcx, -0x68(%rbp)
leaq -0x48(%rbp), %rdx
movq %rbx, (%rdx)
movq 0x38(%r12), %rcx
subq %rax, %rcx
sarq $0x4, %rcx
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rcx
leaq -0x40(%rbp), %r8
movq %rcx, (%r8)
leaq 0x10f8(%rip), %rax      # 0x113a9
movq %rax, (%rsp)
leaq 0x1087(%rip), %rdi      # 0x11343
leaq 0x10a5(%rip), %rcx      # 0x11368
leaq 0x10bb(%rip), %r9       # 0x11385
movl $0x1fd, %esi            # imm = 0x1FD
xorl %eax, %eax
callq 0xa00e
testb %al, %al
je 0x10524
movq 0x30(%r12), %rax
movl 0x28(%rax,%r13), %ecx
movl %ecx, -0x2c(%rbp)
leaq -0x48(%rbp), %rdx
movq %rbx, (%rdx)
movq 0x38(%r12), %rcx
subq %rax, %rcx
sarq $0x4, %rcx
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rcx
leaq -0x40(%rbp), %r8
movq %rcx, (%r8)
leaq 0x108f(%rip), %rax      # 0x113a9
movq %rax, (%rsp)
leaq 0x101e(%rip), %rdi      # 0x11343
leaq 0x103c(%rip), %rcx      # 0x11368
leaq 0x1052(%rip), %r9       # 0x11385
movl $0x1fd, %esi            # imm = 0x1FD
xorl %eax, %eax
callq 0xa00e
testb %al, %al
je 0x10524
movq 0x30(%r12), %rax
movl 0x2c(%rax,%r13), %ecx
movl %ecx, -0x54(%rbp)
leaq -0x48(%rbp), %rdx
movq %rbx, (%rdx)
movq 0x38(%r12), %rcx
subq %rax, %rcx
sarq $0x4, %rcx
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rcx
leaq -0x40(%rbp), %r8
movq %rcx, (%r8)
leaq 0x1026(%rip), %rax      # 0x113a9
movq %rax, (%rsp)
leaq 0xfb5(%rip), %rdi       # 0x11343
leaq 0xfd3(%rip), %rcx       # 0x11368
leaq 0xfe9(%rip), %r9        # 0x11385
movl $0x1fd, %esi            # imm = 0x1FD
xorl %eax, %eax
callq 0xa00e
testb %al, %al
je 0x10524
movl %r14d, %edi
movl -0x30(%rbp), %esi
movl %esi, %eax
xorl %edx, %edx
divl -0x2c(%rbp)
movl %eax, %r8d
movq 0x30(%r12), %rcx
movl %esi, %eax
xorl %edx, %edx
divl 0x28(%rcx,%r13)
movl %edx, %r9d
subl %esi, %edi
movl %edi, -0x2c(%rbp)
movl %edi, %ebx
movq -0x38(%rbp), %rsi
movq (%rsi), %r12
movq 0x8(%rsi), %rax
movq %rax, %r13
subq %r12, %r13
cmpq %rbx, %r13
ja 0x10490
cmpq %rbx, 0x10(%rsi)
movq %r9, -0x60(%rbp)
jae 0x10504
movl %r8d, -0x4c(%rbp)
movl %r14d, -0x50(%rbp)
movl %ebx, %eax
shrl %eax
addq %rbx, %rax
cmpl $0x20, -0x2c(%rbp)
movl $0x20, %r14d
cmovaeq %rax, %r14
leaq 0x1(%r14), %rdi
callq 0x3340
movq -0x38(%rbp), %rsi
movq %rax, (%rsi)
movq %r14, 0x10(%rsi)
testq %r12, %r12
je 0x10457
movq %rax, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x3530
movq %r12, %rdi
callq 0x32f0
movq -0x38(%rbp), %rsi
movq (%rsi), %rax
movq 0x10(%rsi), %r14
cmpq %rbx, %r14
cmovbq %r14, %rbx
movq %rbx, %rdx
movq %rax, %r12
subq %r13, %rdx
movl -0x50(%rbp), %r14d
movl -0x4c(%rbp), %r8d
movq -0x60(%rbp), %r9
jle 0x10490
addq %r12, %r13
movq %r13, %rdi
xorl %esi, %esi
movl %r8d, %r13d
callq 0x31d0
movq -0x60(%rbp), %r9
movl %r13d, %r8d
movq -0x38(%rbp), %rsi
addq %r12, %rbx
movq %rbx, 0x8(%rsi)
cmpl -0x30(%rbp), %r14d
jne 0x104ae
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
imull -0x54(%rbp), %r8d
addl %r8d, %r9d
addq -0x68(%rbp), %r15
addq %r9, %r15
xorl %r14d, %r14d
movb $0x1, %r13b
incq %r15
movsbl -0x1(%r15), %ebx
movl %ebx, %edi
callq 0x3060
testl %eax, %eax
je 0x104e1
incq %r15
testb $0x1, %r13b
jne 0x104c6
jmp 0x1049d
movzbl %bl, %eax
leaq 0x1465(%rip), %rcx      # 0x11950
movb (%rax,%rcx), %al
movb %al, (%r12)
incq %r12
incl %r14d
cmpl -0x2c(%rbp), %r14d
setb %r13b
jne 0x104c3
jmp 0x1049d
cmpq %rbx, %r13
setae %cl
leaq (%r12,%rbx), %rdx
subq %rax, %rdx
testq %rdx, %rdx
setle %al
orb %cl, %al
je 0x10475
jmp 0x10490
callq 0x31e0