// File: zeeev[P]DASVC/bamtools/src/api/internal/bam/BamReader_p.cpp
// Function: BamTools::Internal::BamReaderPrivate::Open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool BamReaderPrivate::Open(const string& filename) {

    try {

        // make sure we're starting with fresh state
        Close();

        // open BgzfStream
        m_stream.Open(filename, IBamIODevice::ReadOnly);

        // load BAM metadata
        LoadHeaderData();
        LoadReferenceData();

        // store filename & offset of first alignment
        m_filename = filename;
        m_alignmentsBeginOffset = m_stream.Tell();

        // return success
        return true;

    } catch ( BamException& e ) {
        const string error = e.what();
        const string message = string("could not open file: ") + filename +
                               "\n\t" + error;
        SetErrorString("BamReader::Open", message);
        return false;
    }
}

// Assembly:
subq $0x138, %rsp            # imm = 0x138
movq %rdi, 0x128(%rsp)
movq %rsi, 0x120(%rsp)
movq 0x128(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x78150
jmp 0xab87b
movq 0x28(%rsp), %rdi
addq $0x1e8, %rdi            # imm = 0x1E8
movq 0x120(%rsp), %rsi
movl $0x1, %edx
callq 0x7b1a0
jmp 0xab89b
movq 0x28(%rsp), %rdi
callq 0x73050
jmp 0xab8a7
movq 0x28(%rsp), %rdi
callq 0x7a300
jmp 0xab8b3
movq 0x28(%rsp), %rdi
movq 0x120(%rsp), %rsi
addq $0x8, %rdi
callq 0x71240
jmp 0xab8cb
movq 0x28(%rsp), %rdi
addq $0x1e8, %rdi            # imm = 0x1E8
callq 0x77c50
movq %rax, 0x20(%rsp)
jmp 0xab8e3
movq 0x28(%rsp), %rax
movq 0x20(%rsp), %rcx
movq %rcx, (%rax)
movb $0x1, 0x137(%rsp)
jmp 0xabc14
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
movl 0x114(%rsp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0xabc25
movq 0x118(%rsp), %rdi
callq 0x72fc0
movq %rax, 0x108(%rsp)
movq 0x108(%rsp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, 0x10(%rsp)
leaq 0xe7(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x7b5f0
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
leaq 0xe8(%rsp), %rdi
callq 0x78e70
jmp 0xab97b
leaq 0xe7(%rsp), %rdi
callq 0x76f80
leaq 0x5f(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x7b5f0
movq 0x8(%rsp), %rdx
leaq 0x3ee18(%rip), %rsi     # 0xea7bb
leaq 0x60(%rsp), %rdi
callq 0x78e70
jmp 0xab9af
movq 0x120(%rsp), %rdx
leaq 0x80(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x7c720
jmp 0xab9cb
leaq 0x3f305(%rip), %rdx     # 0xeacd7
leaq 0xa0(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x785a0
jmp 0xab9e9
leaq 0xc0(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
leaq 0xe8(%rsp), %rdx
callq 0x7c720
jmp 0xaba08
leaq 0xa0(%rsp), %rdi
callq 0x7cce8
jmp 0xaba17
leaq 0x80(%rsp), %rdi
callq 0x7cce8
jmp 0xaba26
leaq 0x60(%rsp), %rdi
callq 0x7cce8
jmp 0xaba32
leaq 0x5f(%rsp), %rdi
callq 0x76f80
leaq 0x37(%rsp), %rdi
movq %rdi, (%rsp)
callq 0x7b5f0
movq (%rsp), %rdx
leaq 0x3f329(%rip), %rsi     # 0xead7e
leaq 0x38(%rsp), %rdi
callq 0x78e70
jmp 0xaba61
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rsi
leaq 0xc0(%rsp), %rdx
callq 0x774d0
jmp 0xaba7a
leaq 0x38(%rsp), %rdi
callq 0x7cce8
jmp 0xaba86
leaq 0x37(%rsp), %rdi
callq 0x76f80
movb $0x0, 0x137(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x7cce8
jmp 0xabbb6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
leaq 0xe7(%rsp), %rdi
callq 0x76f80
jmp 0xabc0b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
jmp 0xabb56
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
jmp 0xabb48
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
jmp 0xabb37
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x7cce8
jmp 0xabb35
jmp 0xabb37
leaq 0x80(%rsp), %rdi
callq 0x7cce8
jmp 0xabb46
jmp 0xabb48
leaq 0x60(%rsp), %rdi
callq 0x7cce8
jmp 0xabb54
jmp 0xabb56
leaq 0x5f(%rsp), %rdi
callq 0x76f80
jmp 0xabbfa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
jmp 0xabb9d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
leaq 0x38(%rsp), %rdi
callq 0x7cce8
jmp 0xabb9b
jmp 0xabb9d
leaq 0x37(%rsp), %rdi
callq 0x76f80
leaq 0xc0(%rsp), %rdi
callq 0x7cce8
jmp 0xabbdb
leaq 0xe8(%rsp), %rdi
callq 0x7cce8
jmp 0xabbdd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
jmp 0xabbfa
jmp 0xabbfa
callq 0x7a790
jmp 0xabc14
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x118(%rsp)
movl %eax, 0x114(%rsp)
jmp 0xabc0b
leaq 0xe8(%rsp), %rdi
callq 0x7cce8
jmp 0xabc09
jmp 0xabc0b
callq 0x7a790
jmp 0xabc12
jmp 0xabc25
movb 0x137(%rsp), %al
andb $0x1, %al
addq $0x138, %rsp            # imm = 0x138
retq
movq 0x118(%rsp), %rdi
callq 0x7b550
movq %rax, %rdi
callq 0x88ef0
nopw (%rax,%rax)