// File: ekg[P]fastahack/Fasta.cpp
// Function: FastaReference::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void FastaReference::open(string reffilename) {
    filename = reffilename;
    if (!(file = fopen(filename.c_str(), "r"))) {
        cerr << "could not open " << filename << endl;
        exit(1);
    }
    index = new FastaIndex();
    struct stat stFileInfo; 
    string indexFileName = filename + index->indexFileExtension(); 
    // if we can find an index file, use it
    if(stat(indexFileName.c_str(), &stFileInfo) == 0) { 
        index->readIndexFile(indexFileName);
    } else { // otherwise, read the reference and generate the index file in the cwd
        cerr << "index file " << indexFileName << " not found, generating..." << endl;
        index->indexReference(filename);
        index->writeIndexFile(indexFileName);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x158(%rbp)
addq $0x8, %rdi
callq 0x3050
movq -0x158(%rbp), %rdi
addq $0x8, %rdi
callq 0x3120
movq %rax, %rdi
leaq 0x94ae(%rip), %rsi      # 0xe15f
callq 0x3380
movq -0x158(%rbp), %rcx
movq %rax, 0x28(%rcx)
cmpq $0x0, %rax
jne 0x4d06
movq 0xf322(%rip), %rdi      # 0x13ff0
leaq 0x948c(%rip), %rsi      # 0xe161
callq 0x32c0
movq -0x158(%rbp), %rsi
movq %rax, %rdi
addq $0x8, %rsi
callq 0x3290
movq %rax, %rdi
movq 0xf2b1(%rip), %rsi      # 0x13fa8
callq 0x3320
movl $0x1, %edi
callq 0x33b0
movl $0x280, %edi            # imm = 0x280
callq 0x32e0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x160(%rbp)
callq 0x39b0
jmp 0x4d24
movq -0x158(%rbp), %rax
movq -0x160(%rbp), %rcx
movq %rcx, 0x40(%rax)
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0x170(%rbp)
movq 0x40(%rax), %rsi
leaq -0xf0(%rbp), %rdi
movq %rdi, -0x168(%rbp)
callq 0x4c00
movq -0x170(%rbp), %rsi
movq -0x168(%rbp), %rdx
leaq -0xd0(%rbp), %rdi
callq 0x62b0
jmp 0x4d77
leaq -0xf0(%rbp), %rdi
callq 0x31a0
leaq -0xd0(%rbp), %rdi
callq 0x3120
movq %rax, %rdi
leaq -0xb0(%rbp), %rsi
callq 0x32a0
cmpl $0x0, %eax
jne 0x4e61
movq -0x158(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x178(%rbp)
leaq -0x110(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x3130
jmp 0x4dce
movq -0x178(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x3a30
jmp 0x4de3
leaq -0x110(%rbp), %rdi
callq 0x31a0
jmp 0x4f8d
movq -0x160(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x280, %esi            # imm = 0x280
callq 0x32f0
jmp 0x4fae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x31a0
jmp 0x4fae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x4fa2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x31a0
jmp 0x4fa2
movq 0xf188(%rip), %rdi      # 0x13ff0
leaq 0x91c1(%rip), %rsi      # 0xe030
callq 0x32c0
movq %rax, -0x180(%rbp)
jmp 0x4e7d
movq -0x180(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x3290
movq %rax, -0x188(%rbp)
jmp 0x4e99
movq -0x188(%rbp), %rdi
leaq 0x92ca(%rip), %rsi      # 0xe171
callq 0x32c0
movq %rax, -0x190(%rbp)
jmp 0x4eb5
movq -0x190(%rbp), %rdi
movq 0xf0e5(%rip), %rsi      # 0x13fa8
callq 0x3320
jmp 0x4eca
movq -0x158(%rbp), %rsi
movq 0x40(%rsi), %rax
movq %rax, -0x198(%rbp)
addq $0x8, %rsi
leaq -0x130(%rbp), %rdi
callq 0x3130
jmp 0x4eee
movq -0x198(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x4210
jmp 0x4f03
leaq -0x130(%rbp), %rdi
callq 0x31a0
movq -0x158(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x1a0(%rbp)
leaq -0x150(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x3130
jmp 0x4f36
movq -0x1a0(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x4980
jmp 0x4f4b
leaq -0x150(%rbp), %rdi
callq 0x31a0
jmp 0x4f8d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x31a0
jmp 0x4fa2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x31a0
jmp 0x4fa2
leaq -0xd0(%rbp), %rdi
callq 0x31a0
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq
leaq -0xd0(%rbp), %rdi
callq 0x31a0
movq -0x18(%rbp), %rdi
callq 0x3540
nopw (%rax,%rax)