// File: 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
subq $0x320, %rsp            # imm = 0x320
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x13240
movq -0x10(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x132a0
movq -0x10(%rbp), %rdi
addq $0x18, %rdi
leaq -0x20(%rbp), %rsi
callq 0x132a0
movq -0x10(%rbp), %rax
testb $0x1, 0x118(%rax)
je 0x12b2b
movq -0x10(%rbp), %rdi
addq $0xe0, %rdi
callq 0x13310
movq -0x10(%rbp), %rax
addq $0xe0, %rax
movq %rax, -0x2d8(%rbp)
movq -0x18(%rbp), %rdi
callq 0x12a90
movq -0x2d8(%rbp), %rdi
movq %rax, %rsi
movl $0x1, %edx
callq 0x13380
testb $0x1, %al
jne 0x12b69
movl $0x1, -0x4(%rbp)
jmp 0x1321f
movq -0x10(%rbp), %rax
movb $0x1, 0x118(%rax)
movq -0x10(%rbp), %rdi
addq $0x18, %rdi
callq 0xf9c0
movq %rax, -0x2e8(%rbp)
movl $0x4, %edi
movl $0x8, %esi
callq 0x9ee0
movq -0x2e8(%rbp), %rsi
movl %eax, %edx
leaq -0x228(%rbp), %rdi
callq 0x47f0
movq -0x228(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x228(%rbp,%rax), %rdi
callq 0x4720
movb %al, -0x2d9(%rbp)
jmp 0x12bcc
movb -0x2d9(%rbp), %al
testb $0x1, %al
jne 0x12c05
jmp 0x12bd8
movl $0x1, -0x4(%rbp)
movl $0x1, -0x238(%rbp)
jmp 0x13203
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0x13211
leaq -0x288(%rbp), %rdi
leaq -0x228(%rbp), %rsi
callq 0x133f0
jmp 0x12c1a
leaq -0x2a0(%rbp), %rdi
callq 0xb3a0
jmp 0x12c28
jmp 0x12c2a
leaq -0x288(%rbp), %rdi
callq 0x134a0
movb %al, -0x2e9(%rbp)
jmp 0x12c3e
movb -0x2e9(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x12c4f
jmp 0x131ac
leaq -0x2d0(%rbp), %rdi
callq 0x13500
jmp 0x12c5d
leaq -0x2d0(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0x13550
movl %eax, -0x2f0(%rbp)
jmp 0x12c78
movl -0x2f0(%rbp), %eax
cmpl $0x0, %eax
je 0x12cea
movl $0x1, -0x4(%rbp)
movl $0x1, -0x238(%rbp)
jmp 0x1318f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0x131f5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
jmp 0x131e9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x230(%rbp)
movl %eax, -0x234(%rbp)
leaq -0x2d0(%rbp), %rdi
callq 0x12a20
jmp 0x131e9
movq -0x10(%rbp), %rdi
addq $0x48, %rdi
leaq -0x2d0(%rbp), %rsi
callq 0x13580
jmp 0x12d00
leaq -0x288(%rbp), %rdi
callq 0x134a0
movb %al, -0x2f1(%rbp)
jmp 0x12d14
movb -0x2f1(%rbp), %al
testb $0x1, %al
jne 0x12d42
jmp 0x12d20
leaq -0x288(%rbp), %rdi
callq 0x135b0
movb %al, -0x2f2(%rbp)
jmp 0x12d34
movb -0x2f2(%rbp), %al
movsbl %al, %eax
cmpl $0x9, %eax
je 0x12d58
movl $0x1, -0x4(%rbp)
movl $0x1, -0x238(%rbp)
jmp 0x1318f
leaq -0x288(%rbp), %rdi
movl $0x9, %esi
callq 0x13610
jmp 0x12d6b
leaq -0x2a0(%rbp), %rdi
callq 0x13670
jmp 0x12d79
leaq -0x2a0(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0x13550
movl %eax, -0x2f8(%rbp)
jmp 0x12d94
movl -0x2f8(%rbp), %eax
cmpl $0x0, %eax
je 0x12db5
movl $0x1, -0x4(%rbp)
movl $0x1, -0x238(%rbp)
jmp 0x1318f
leaq -0x2b8(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
callq 0x136c0
movb %al, -0x2f9(%rbp)
jmp 0x12dd0
movb -0x2f9(%rbp), %al
testb $0x1, %al
jne 0x12df2
jmp 0x12ddc
movl $0x1, -0x4(%rbp)
movl $0x1, -0x238(%rbp)
jmp 0x1318f
leaq -0x288(%rbp), %rdi
callq 0x134a0
movb %al, -0x2fa(%rbp)
jmp 0x12e06
movb -0x2fa(%rbp), %al
testb $0x1, %al
jne 0x12e34
jmp 0x12e12
leaq -0x288(%rbp), %rdi
callq 0x135b0
movb %al, -0x2fb(%rbp)
jmp 0x12e26
movb -0x2fb(%rbp), %al
movsbl %al, %eax
cmpl $0x9, %eax
je 0x12e4a
movl $0x1, -0x4(%rbp)
movl $0x1, -0x238(%rbp)
jmp 0x1318f
leaq -0x288(%rbp), %rdi
movl $0x9, %esi
callq 0x13610
jmp 0x12e5d
leaq -0x2a0(%rbp), %rdi
callq 0x13670
jmp 0x12e6b
leaq -0x2a0(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0x13550
movl %eax, -0x300(%rbp)
jmp 0x12e86
movl -0x300(%rbp), %eax
cmpl $0x0, %eax
je 0x12ea7
movl $0x1, -0x4(%rbp)
movl $0x1, -0x238(%rbp)
jmp 0x1318f
leaq -0x2b0(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
callq 0x136c0
movb %al, -0x301(%rbp)
jmp 0x12ec2
movb -0x301(%rbp), %al
testb $0x1, %al
jne 0x12ee4
jmp 0x12ece
movl $0x1, -0x4(%rbp)
movl $0x1, -0x238(%rbp)
jmp 0x1318f
leaq -0x288(%rbp), %rdi
callq 0x134a0
movb %al, -0x302(%rbp)
jmp 0x12ef8
movb -0x302(%rbp), %al
testb $0x1, %al
jne 0x12f26
jmp 0x12f04
leaq -0x288(%rbp), %rdi
callq 0x135b0
movb %al, -0x303(%rbp)
jmp 0x12f18
movb -0x303(%rbp), %al
movsbl %al, %eax
cmpl $0x9, %eax
je 0x12f3c
movl $0x1, -0x4(%rbp)
movl $0x1, -0x238(%rbp)
jmp 0x1318f
leaq -0x288(%rbp), %rdi
movl $0x9, %esi
callq 0x13610
jmp 0x12f4f
leaq -0x2a0(%rbp), %rdi
callq 0x13670
jmp 0x12f5d
leaq -0x2a0(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0x13550
movl %eax, -0x308(%rbp)
jmp 0x12f78
movl -0x308(%rbp), %eax
cmpl $0x0, %eax
je 0x12f99
movl $0x1, -0x4(%rbp)
movl $0x1, -0x238(%rbp)
jmp 0x1318f
leaq -0x2a8(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
callq 0x137b0
movb %al, -0x309(%rbp)
jmp 0x12fb4
movb -0x309(%rbp), %al
testb $0x1, %al
jne 0x12fd6
jmp 0x12fc0
movl $0x1, -0x4(%rbp)
movl $0x1, -0x238(%rbp)
jmp 0x1318f
leaq -0x288(%rbp), %rdi
callq 0x134a0
movb %al, -0x30a(%rbp)
jmp 0x12fea
movb -0x30a(%rbp), %al
testb $0x1, %al
jne 0x13018
jmp 0x12ff6
leaq -0x288(%rbp), %rdi
callq 0x135b0
movb %al, -0x30b(%rbp)
jmp 0x1300a
movb -0x30b(%rbp), %al
movsbl %al, %eax
cmpl $0x9, %eax
je 0x1302e
movl $0x1, -0x4(%rbp)
movl $0x1, -0x238(%rbp)
jmp 0x1318f
leaq -0x288(%rbp), %rdi
movl $0x9, %esi
callq 0x13610
jmp 0x13041
leaq -0x2a0(%rbp), %rdi
callq 0x13670
jmp 0x1304f
leaq -0x2a0(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0x13550
movl %eax, -0x310(%rbp)
jmp 0x1306a
movl -0x310(%rbp), %eax
cmpl $0x0, %eax
je 0x1308b
movl $0x1, -0x4(%rbp)
movl $0x1, -0x238(%rbp)
jmp 0x1318f
leaq -0x2a4(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
callq 0x137b0
movb %al, -0x311(%rbp)
jmp 0x130a6
movb -0x311(%rbp), %al
testb $0x1, %al
jne 0x130c8
jmp 0x130b2
movl $0x1, -0x4(%rbp)
movl $0x1, -0x238(%rbp)
jmp 0x1318f
leaq -0x288(%rbp), %rdi
callq 0x134a0
movb %al, -0x312(%rbp)
jmp 0x130dc
movb -0x312(%rbp), %al
testb $0x1, %al
jne 0x1313f
jmp 0x130e8
leaq -0x288(%rbp), %rdi
callq 0x135b0
movb %al, -0x313(%rbp)
jmp 0x130fc
movb -0x313(%rbp), %al
movsbl %al, %eax
cmpl $0xd, %eax
je 0x1313f
leaq -0x288(%rbp), %rdi
callq 0x135b0
movb %al, -0x314(%rbp)
jmp 0x1311e
movb -0x314(%rbp), %al
movsbl %al, %eax
cmpl $0xa, %eax
je 0x1313f
movl $0x1, -0x4(%rbp)
movl $0x1, -0x238(%rbp)
jmp 0x1318f
leaq -0x288(%rbp), %rdi
callq 0x134a0
movb %al, -0x315(%rbp)
jmp 0x13153
movb -0x315(%rbp), %al
testb $0x1, %al
jne 0x1316f
jmp 0x1315f
leaq -0x288(%rbp), %rdi
callq 0x138a0
jmp 0x1316d
jmp 0x1316f
movq -0x10(%rbp), %rdi
addq $0x30, %rdi
leaq -0x2d0(%rbp), %rsi
callq 0x13900
jmp 0x13185
movl $0x0, -0x238(%rbp)
leaq -0x2d0(%rbp), %rdi
callq 0x12a20
movl -0x238(%rbp), %eax
testl %eax, %eax
jne 0x131cf
jmp 0x131a7
jmp 0x12c2a
movq -0x10(%rbp), %rdi
addq $0x88, %rdi
callq 0x13930
jmp 0x131be
movl $0x0, -0x4(%rbp)
movl $0x1, -0x238(%rbp)
leaq -0x2a0(%rbp), %rdi
callq 0xb7b0
leaq -0x288(%rbp), %rdi
callq 0x139a0
jmp 0x13203
leaq -0x2a0(%rbp), %rdi
callq 0xb7b0
leaq -0x288(%rbp), %rdi
callq 0x139a0
jmp 0x13211
leaq -0x228(%rbp), %rdi
callq 0x4140
jmp 0x1321f
leaq -0x228(%rbp), %rdi
callq 0x4140
jmp 0x1322b
movl -0x4(%rbp), %eax
addq $0x320, %rsp            # imm = 0x320
popq %rbp
retq
movq -0x230(%rbp), %rdi
callq 0x4770
nopw (%rax,%rax)