// File: /workspace/github_cpp_makefile_star2_O2/mshabbirhasan[P]ups-indel/include/seqan/seq_io/fai_index.h
// Function: seqan::read(seqan::FaiIndex&, char const*, char const*)
inline int read(FaiIndex & index, char const * fastaFilename, char const * faiFilename)
{
    clear(index);  // Also clears filename, thus backup above and restore below.
    index.fastaFilename = fastaFilename;
    index.faiFilename = faiFilename;

    if (index.mmapStringOpen)
        close(index.mmapString);
    if (!open(index.mmapString, toCString(fastaFilename), OPEN_RDONLY))
        return 1;  // Could not open file.
    index.mmapStringOpen = true;

    // Open file.
    std::ifstream faiStream(toCString(index.faiFilename), std::ios::binary | std::ios::in);
    if (!faiStream.good())
        return 1;

    // Read FAI file.
    RecordReader<std::ifstream, SinglePass<> > reader(faiStream);
    CharString buffer;
    while (!atEnd(reader))
    {
        FaiIndexEntry_ entry;

        // Read REF_NAME.
        if (readUntilTabOrLineBreak(entry.name, reader) != 0)
            return 1;

        appendValue(index.refNameStore, entry.name);
        if (atEnd(reader) || value(reader) != '\t')
            return 1;  // Must be on tab.

        skipChar(reader, '\t');  // Must have been on tab, no checking.

        // Read SEQ_LENGTH.
        clear(buffer);
        if (readUntilTabOrLineBreak(buffer, reader) != 0)
            return 1;

        if (!lexicalCast2(entry.sequenceLength, buffer))
            return 1;  // Could not cast to integer.

        if (atEnd(reader) || value(reader) != '\t')
            return 1;  // Must be on tab.

        skipChar(reader, '\t');  // Must have been on tab, no checking.

        // Read OFFSET.
        clear(buffer);
        if (readUntilTabOrLineBreak(buffer, reader) != 0)
            return 1;

        if (!lexicalCast2(entry.offset, buffer))
            return 1;  // Could not cast to integer.

        if (atEnd(reader) || value(reader) != '\t')
            return 1;  // Must be on tab.

        skipChar(reader, '\t');  // Must have been on tab, no checking.

        // Read LINE_LENGTH.
        clear(buffer);
        if (readUntilTabOrLineBreak(buffer, reader) != 0)
            return 1;

        if (!lexicalCast2(entry.lineLength, buffer))
            return 1;  // Could not cast to integer.

        if (atEnd(reader) || value(reader) != '\t')
            return 1;  // Must be on tab.

        skipChar(reader, '\t');  // Must have been on tab, no checking.

        // Read OVERALL_LINE_LENGTH.
        clear(buffer);
        if (readUntilTabOrLineBreak(buffer, reader) != 0)
            return 1;

        if (!lexicalCast2(entry.overallLineLength, buffer))
            return 1;  // Could not cast to integer.

        if (!atEnd(reader) && value(reader) != '\r' && value(reader) != '\n')
            return 1;  // Must be on end of line or file.

        if (!atEnd(reader))
            skipLine(reader);  // Skip over line ending.

        appendValue(index.indexEntryStore, entry);
    }

    // Refresh name store cache.
    refresh(index.refNameStoreCache);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2c8, %rsp            # imm = 0x2C8
movq %rdi, %rbx
leaq -0x58(%rbp), %r14
movq %rsi, (%r14)
leaq -0x90(%rbp), %r12
movq %rdx, (%r12)
callq 0x9d10
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9d50
leaq 0x18(%rbx), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x9d50
cmpb $0x1, 0x118(%rbx)
jne 0x99e0
leaq 0xe0(%rbx), %rdi
callq 0x9da4
leaq 0xe0(%rbx), %rdi
movq -0x58(%rbp), %rsi
pushq $0x1
popq %r14
movl %r14d, %edx
callq 0x9df0
testb %al, %al
je 0x9c9c
movb $0x1, 0x118(%rbx)
movq %r15, %rdi
callq 0x9167
leaq -0x2e8(%rbp), %r14
pushq $0xc
popq %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x35d0
movq (%r14), %rax
movq -0x18(%rax), %rax
cmpl $0x0, -0x2c8(%rbp,%rax)
je 0x9a3d
pushq $0x1
popq %r14
jmp 0x9c90
leaq -0xe0(%rbp), %rdi
leaq -0x2e8(%rbp), %rsi
callq 0x9e3e
leaq -0x40(%rbp), %rdi
callq 0x6e2e
leaq 0x48(%rbx), %rax
movq %rax, -0x50(%rbp)
leaq 0x30(%rbx), %rax
movq %rax, -0x48(%rbp)
leaq -0xe0(%rbp), %r12
leaq -0x88(%rbp), %r15
pushq $0x9
popq %r13
leaq -0x40(%rbp), %r14
movq %r12, %rdi
callq 0x9e9c
testb %al, %al
jne 0x9cb1
movq %r15, %rdi
callq 0x9ece
movq %r15, %rdi
movq %r12, %rsi
callq 0x9eef
testl %eax, %eax
jne 0x9c6b
movq -0x50(%rbp), %rdi
movq %r15, %rsi
callq 0xa586
movq %r12, %rdi
callq 0x9e9c
testb %al, %al
jne 0x9c6b
movq %r12, %rdi
callq 0x9f06
cmpb $0x9, %al
jne 0x9c6b
movq %r12, %rdi
movl %r13d, %esi
callq 0x9f4c
movq -0x40(%rbp), %rax
movq %rax, -0x38(%rbp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x9eef
testl %eax, %eax
jne 0x9c6b
leaq -0x70(%rbp), %rdi
movq %r14, %rsi
callq 0x9f8a
testb %al, %al
je 0x9c6b
movq %r12, %rdi
callq 0x9e9c
testb %al, %al
jne 0x9c6b
movq %r12, %rdi
callq 0x9f06
cmpb $0x9, %al
jne 0x9c6b
movq %r12, %rdi
movl %r13d, %esi
callq 0x9f4c
movq -0x40(%rbp), %rax
movq %rax, -0x38(%rbp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x9eef
testl %eax, %eax
jne 0x9c6b
leaq -0x68(%rbp), %rdi
movq %r14, %rsi
callq 0x9f8a
testb %al, %al
je 0x9c6b
movq %r12, %rdi
callq 0x9e9c
testb %al, %al
jne 0x9c6b
movq %r12, %rdi
callq 0x9f06
cmpb $0x9, %al
jne 0x9c6b
movq %r12, %rdi
movl %r13d, %esi
callq 0x9f4c
movq -0x40(%rbp), %rax
movq %rax, -0x38(%rbp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x9eef
testl %eax, %eax
jne 0x9c6b
leaq -0x60(%rbp), %rdi
movq %r14, %rsi
callq 0xa01b
testb %al, %al
je 0x9c6b
movq %r12, %rdi
callq 0x9e9c
testb %al, %al
jne 0x9c6b
movq %r12, %rdi
callq 0x9f06
cmpb $0x9, %al
jne 0x9c6b
movq %r12, %rdi
movl %r13d, %esi
callq 0x9f4c
movq -0x40(%rbp), %rax
movq %rax, -0x38(%rbp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x9eef
testl %eax, %eax
jne 0x9c6b
leaq -0x5c(%rbp), %rdi
movq %r14, %rsi
callq 0xa01b
testb %al, %al
je 0x9c6b
movq %r12, %rdi
callq 0x9e9c
testb %al, %al
jne 0x9c3a
movq %r12, %rdi
callq 0x9f06
cmpb $0xd, %al
je 0x9c3a
movq %r12, %rdi
callq 0x9f06
cmpb $0xa, %al
jne 0x9c6b
movq %r12, %rdi
callq 0x9e9c
testb %al, %al
jne 0x9c4e
movq %r12, %rdi
callq 0xa0ac
movq -0x48(%rbp), %rdi
movq %r15, %rsi
callq 0xae2e
movq -0x88(%rbp), %rdi
callq 0x32e0
jmp 0x9a7f
movq -0x88(%rbp), %rdi
callq 0x32e0
pushq $0x1
popq %r14
movq -0x40(%rbp), %rdi
callq 0x32e0
movq -0xd0(%rbp), %rdi
callq 0x32e0
leaq -0x2e8(%rbp), %rdi
callq 0x30e0
movl %r14d, %eax
addq $0x2c8, %rsp            # imm = 0x2C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0x88, %rbx
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0xa0e0
jmp 0x9c7b
jmp 0x9cd3
movq %rax, %rbx
jmp 0x9cf0
movq %rax, %rbx
jmp 0x9cfc
jmp 0x9cd3
movq %rax, %rbx
jmp 0x9ce7
movq %rax, %rbx
movq -0x88(%rbp), %rdi
callq 0x32e0
movq -0x40(%rbp), %rdi
callq 0x32e0
movq -0xd0(%rbp), %rdi
callq 0x32e0
leaq -0x2e8(%rbp), %rdi
callq 0x30e0
movq %rbx, %rdi
callq 0x3590