// File: /workspace/github_cpp_makefile_star2_O1/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 -0x50(%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 -0x48(%rbp), %r8
movq %rax, (%r8)
leaq 0xabe(%rip), %rax       # 0x113a9
movq %rax, (%rsp)
leaq 0xa4d(%rip), %rdi       # 0x11343
leaq 0xa6b(%rip), %rcx       # 0x11368
leaq 0xa81(%rip), %r9        # 0x11385
movl $0x1fd, %esi            # imm = 0x1FD
xorl %eax, %eax
callq 0xa0ea
testb %al, %al
je 0x10c5d
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, -0x40(%rbp)
cmoval %r15d, %r14d
movq 0xe0(%r12), %r15
cmpl %ecx, %r14d
cmovael %ecx, %r14d
leaq -0x50(%rbp), %rdx
movq %rbx, (%rdx)
movq 0x38(%r12), %rcx
subq %rax, %rcx
sarq $0x4, %rcx
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rcx
leaq -0x48(%rbp), %r8
movq %rcx, (%r8)
leaq 0xa2f(%rip), %rax       # 0x113a9
movq %rax, (%rsp)
leaq 0x9be(%rip), %rdi       # 0x11343
leaq 0x9dc(%rip), %rcx       # 0x11368
leaq 0x9f2(%rip), %r9        # 0x11385
movl $0x1fd, %esi            # imm = 0x1FD
xorl %eax, %eax
callq 0xa0ea
testb %al, %al
je 0x10c5d
movq 0x30(%r12), %rax
movq 0x20(%rax,%r13), %rcx
movq %rcx, -0x68(%rbp)
leaq -0x50(%rbp), %rdx
movq %rbx, (%rdx)
movq 0x38(%r12), %rcx
subq %rax, %rcx
sarq $0x4, %rcx
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rcx
leaq -0x48(%rbp), %r8
movq %rcx, (%r8)
leaq 0x9c5(%rip), %rax       # 0x113a9
movq %rax, (%rsp)
leaq 0x954(%rip), %rdi       # 0x11343
leaq 0x972(%rip), %rcx       # 0x11368
leaq 0x988(%rip), %r9        # 0x11385
movl $0x1fd, %esi            # imm = 0x1FD
xorl %eax, %eax
callq 0xa0ea
testb %al, %al
je 0x10c5d
movq 0x30(%r12), %rax
movl 0x28(%rax,%r13), %ecx
movl %ecx, -0x2c(%rbp)
leaq -0x50(%rbp), %rdx
movq %rbx, (%rdx)
movq 0x38(%r12), %rcx
subq %rax, %rcx
sarq $0x4, %rcx
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rcx
leaq -0x48(%rbp), %r8
movq %rcx, (%r8)
leaq 0x95c(%rip), %rax       # 0x113a9
movq %rax, (%rsp)
leaq 0x8eb(%rip), %rdi       # 0x11343
leaq 0x909(%rip), %rcx       # 0x11368
leaq 0x91f(%rip), %r9        # 0x11385
movl $0x1fd, %esi            # imm = 0x1FD
xorl %eax, %eax
callq 0xa0ea
testb %al, %al
je 0x10c5d
movq 0x30(%r12), %rax
movl 0x2c(%rax,%r13), %ecx
movl %ecx, -0x58(%rbp)
leaq -0x50(%rbp), %rdx
movq %rbx, (%rdx)
movq 0x38(%r12), %rcx
subq %rax, %rcx
sarq $0x4, %rcx
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rcx
leaq -0x48(%rbp), %r8
movq %rcx, (%r8)
leaq 0x8f3(%rip), %rax       # 0x113a9
movq %rax, (%rsp)
leaq 0x882(%rip), %rdi       # 0x11343
leaq 0x8a0(%rip), %rcx       # 0x11368
leaq 0x8b6(%rip), %r9        # 0x11385
movl $0x1fd, %esi            # imm = 0x1FD
xorl %eax, %eax
callq 0xa0ea
testb %al, %al
je 0x10c5d
movl %r14d, %edi
movl -0x40(%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), %rcx
movq (%rcx), %r12
movq 0x8(%rcx), %rax
movq %rax, %r13
subq %r12, %r13
cmpq %rbx, %r13
ja 0x10be7
cmpq %rbx, 0x10(%rcx)
jae 0x10bb9
movq %r9, -0x60(%rbp)
movl %r8d, -0x3c(%rbp)
movl %r14d, -0x54(%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), %rcx
movq %rax, (%rcx)
movq %r14, 0x10(%rcx)
testq %r12, %r12
je 0x10b83
movq %rax, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x3530
movq %r12, %rdi
callq 0x32f0
movq -0x38(%rbp), %rcx
movq 0x10(%rcx), %rax
movq (%rcx), %rdi
addq %r13, %rdi
movq %rdi, 0x8(%rcx)
cmpq %rbx, %rax
cmovbq %rax, %rbx
movq %rbx, %rdx
subq %r13, %rdx
movl -0x54(%rbp), %r14d
jle 0x10baf
xorl %esi, %esi
callq 0x31d0
movq -0x38(%rbp), %rcx
movl -0x3c(%rbp), %r8d
movq -0x60(%rbp), %r9
jmp 0x10be7
cmpq %rbx, %r13
jae 0x10be7
leaq (%r12,%rbx), %rdx
subq %rax, %rdx
testq %rdx, %rdx
jle 0x10be7
addq %r13, %r12
movq %r12, %rdi
xorl %esi, %esi
movl %r8d, %r12d
movq %r9, %r13
callq 0x31d0
movq %r13, %r9
movl %r12d, %r8d
movq -0x38(%rbp), %rcx
movq (%rcx), %r12
addq %r12, %rbx
movq %rbx, 0x8(%rcx)
cmpl -0x40(%rbp), %r14d
setne %r14b
je 0x10c4c
imull -0x58(%rbp), %r8d
addl %r8d, %r9d
addq -0x68(%rbp), %r15
addq %r9, %r15
xorl %r13d, %r13d
incq %r15
movsbl -0x1(%r15), %ebx
movl %ebx, %edi
callq 0x3060
testl %eax, %eax
je 0x10c2b
incq %r15
testb $0x1, %r14b
jne 0x10c10
jmp 0x10c4c
movzbl %bl, %eax
leaq 0xd5b(%rip), %rcx       # 0x11990
movb (%rax,%rcx), %al
movb %al, (%r12)
incq %r12
incl %r13d
cmpl -0x2c(%rbp), %r13d
setb %r14b
jne 0x10c0d
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x31e0