// File: /workspace/github_cpp_makefile_star2_O3/ekg[P]fastahack/Fasta.cpp
// Function: FastaIndex::readIndexFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void FastaIndex::readIndexFile(string fname) {
    string line;
    long long linenum = 0;
    indexFile.open(fname.c_str(), ifstream::in);
    if (indexFile.is_open()) {
        while (getline (indexFile, line)) {
            ++linenum;
            // the fai format defined in samtools is tab-delimited, every line being:
            // fai->name[i], (int)x.len, (long long)x.offset, (int)x.line_blen, (int)x.line_len
            vector<string> fields = split(line, '\t');
            if (fields.size() == 5) {  // if we don't get enough fields then there is a problem with the file
                // note that fields[0] is the sequence name
                char* end;
                string name = split(fields[0], " \t").at(0);  // key by first token of name
                sequenceNames.push_back(name);
                this->insert(make_pair(name, FastaIndexEntry(fields[0], atoi(fields[1].c_str()),
                                                    strtoll(fields[2].c_str(), &end, 10),
                                                    atoi(fields[3].c_str()),
                                                    atoi(fields[4].c_str()))));
            } else {
                cerr << "Warning: malformed fasta index file " << fname << 
                    "does not have enough fields @ line " << linenum << endl;
                cerr << line << endl;
                exit(1);
            }
        }
    } else {
        cerr << "could not open index file " << fname << endl;
        exit(1);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x60(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x78(%rdi), %r14
movq (%rsi), %rsi
movq %r14, %rdi
movl $0x8, %edx
callq 0x31b0
movq %r14, 0xd0(%rsp)
movq %rbx, (%rsp)
leaq 0xf0(%r15), %rdi
callq 0x30a0
testb %al, %al
je 0x3d09
leaq 0xe8(%rsp), %r13
leaq 0x40(%rsp), %r14
movq %r15, 0xc0(%rsp)
leaq 0x30(%r15), %rax
movq %rax, 0xc8(%rsp)
leaq 0x20(%rsp), %rbp
movl $0x1, %ebx
leaq 0xd8(%rsp), %r12
movq 0xd0(%rsp), %r15
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %edx
movq %r15, %rdi
leaq 0x50(%rsp), %rsi
callq 0x34c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x3c4e
movq %rbx, 0x8(%rsp)
leaq 0x70(%rsp), %rdi
leaq 0x50(%rsp), %rsi
movl $0x9, %edx
callq 0x8836
movq 0x70(%rsp), %rbx
movq 0x78(%rsp), %rax
subq %rbx, %rax
cmpq $0xa0, %rax
leaq 0x88(%rsp), %r15
jne 0x3c7c
movq %r13, 0xd8(%rsp)
movq %r12, %rdi
leaq 0x55ca(%rip), %rsi      # 0x9004
leaq 0x55c5(%rip), %rdx      # 0x9006
callq 0x5620
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x895c
movq 0x88(%rsp), %rax
cmpq %rax, 0x90(%rsp)
je 0x3cf7
movq %r14, 0x30(%rsp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x30(%rsp), %rdi
callq 0x558a
movq %r15, %rdi
callq 0x51f6
movq 0xd8(%rsp), %rdi
cmpq %r13, %rdi
je 0x3aa8
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0xc8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x5254
movq 0x70(%rsp), %rax
movq %rbp, 0x10(%rsp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %rdi
callq 0x558a
movq 0x70(%rsp), %rbx
movq 0x20(%rbx), %rdi
callq 0x3400
movl %eax, %ebp
movq 0x40(%rbx), %rdi
leaq 0x130(%rsp), %rsi
movl $0xa, %edx
callq 0x3070
movq %rax, %rbx
movq 0x70(%rsp), %r13
movq 0x60(%r13), %rdi
callq 0x3400
movl %eax, %r14d
movq 0x80(%r13), %rdi
callq 0x3400
movl %eax, %r13d
leaq 0x98(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
addq %rsi, %rdx
leaq 0x88(%rsp), %r15
movq %r15, %rdi
callq 0x558a
movl %ebp, 0xa8(%rsp)
movq %rbx, 0xb0(%rsp)
movl %r14d, 0xb8(%rsp)
movl %r13d, 0xbc(%rsp)
movq %r12, %rbx
movq %r12, %rdi
leaq 0x30(%rsp), %rsi
movq %r15, %rdx
callq 0x5516
movq 0xc0(%rsp), %rdi
movq %rbx, %rsi
leaq 0x40(%rsp), %r14
leaq 0x20(%rsp), %rbp
callq 0x58c2
leaq 0xe8(%rsp), %r13
movq 0x8(%rsp), %rbx
movq 0xf8(%rsp), %rdi
leaq 0x108(%rsp), %rax
cmpq %rax, %rdi
je 0x3bcc
movq 0x108(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0xd8(%rsp), %rdi
cmpq %r13, %rdi
je 0x3be9
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x3c0e
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x3c25
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x3c3c
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x32d0
leaq 0x70(%rsp), %rdi
callq 0x51f6
incq %rbx
jmp 0x39b0
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x3c6a
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x32d0
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x936d(%rip), %rdi      # 0xcff0
leaq 0x537d(%rip), %rsi      # 0x9007
movl $0x24, %edx
callq 0x3320
movq (%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq 0x934a(%rip), %rdi      # 0xcff0
callq 0x3320
movq %rax, %rbx
leaq 0x5377(%rip), %rsi      # 0x902c
movl $0x23, %edx
movq %rax, %rdi
callq 0x3320
movq %rbx, %rdi
movq 0x8(%rsp), %rsi
callq 0x3120
movq %rax, %rdi
callq 0x3150
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
movq 0x9308(%rip), %rdi      # 0xcff0
callq 0x3320
movq %rax, %rdi
callq 0x3150
jmp 0x3d40
leaq 0x54c9(%rip), %rdi      # 0x91c7
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x33d0
movq 0x92e0(%rip), %rdi      # 0xcff0
leaq 0x5339(%rip), %rsi      # 0x9050
movl $0x1a, %edx
callq 0x3320
movq (%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq 0x92bd(%rip), %rdi      # 0xcff0
callq 0x3320
movq %rax, %rdi
callq 0x3150
movl $0x1, %edi
callq 0x3360
jmp 0x3e24
jmp 0x3d51
movq %rax, %rbx
jmp 0x3e18
jmp 0x3e24
jmp 0x3d68
movq %rax, %rbx
jmp 0x3e01
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x51f6
jmp 0x3d8f
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x5292
jmp 0x3db6
movq %rax, %rbx
movq 0xd8(%rsp), %rdi
leaq 0xe8(%rsp), %rax
cmpq %rax, %rdi
je 0x3e18
movq 0xe8(%rsp), %rsi
jmp 0x3e10
movq %rax, %rbx
jmp 0x3ddb
movq %rax, %rbx
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x3ddb
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x3dfc
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32d0
jmp 0x3dfc
movq %rax, %rbx
leaq 0x40(%rsp), %r14
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x3e18
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x32d0
leaq 0x70(%rsp), %rdi
callq 0x51f6
jmp 0x3e27
movq %rax, %rbx
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x3e43
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x32d0
movq %rbx, %rdi
callq 0x3490