// File: /workspace/github_cpp_makefile_star2_O3/zeeev[P]DASVC/bamtools/src/api/internal/index/BamStandardIndex_p.cpp
// Function: BamTools::Internal::BamStandardIndex::OpenFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, BamTools::IBamIODevice::OpenMode)
void BamStandardIndex::OpenFile(const std::string& filename, IBamIODevice::OpenMode mode) {

    // make sure any previous index file is closed
    CloseFile();

    m_resources.Device = BamDeviceFactory::CreateDevice(filename);
    if ( m_resources.Device == 0 ) {
        const string message = string("could not open file: ") + filename;
        throw BamException("BamStandardIndex::OpenFile", message);
    }

    // attempt to open file
    m_resources.Device->Open(mode);
    if ( !IsDeviceOpen() ) {
        const string message = string("could not open file: ") + filename;
        throw BamException("BamStandardIndex::OpenFile", message);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
callq 0x27da0
movq %rbx, %rdi
callq 0x272b0
movq %rax, 0x58(%r14)
testq %rax, %rax
je 0x3f761
movq (%rax), %rcx
movq %rax, %rdi
movl %ebp, %esi
callq *0x20(%rcx)
movq 0x58(%r14), %rdi
testq %rdi, %rdi
je 0x3f6c5
movq (%rdi), %rax
callq *0x50(%rax)
testb %al, %al
je 0x3f6c5
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x15e7c(%rip), %rsi     # 0x55551
leaq 0x15e8a(%rip), %rdx     # 0x55566
leaq 0x8(%rsp), %rdi
callq 0x26750
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movq %rbx, %rdx
callq 0x29120
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x3f707
callq 0x27560
movl $0x28, %edi
callq 0x269d0
movq %rax, %r14
leaq 0x8(%rsp), %rdi
movq %r15, (%rdi)
leaq 0x16995(%rip), %rsi     # 0x560b8
leaq 0x169a8(%rip), %rdx     # 0x560d2
callq 0x26750
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %r14, %rdi
callq 0x28480
xorl %ebp, %ebp
movq 0x2b7eb(%rip), %rsi     # 0x6af38
movq 0x2b824(%rip), %rdx     # 0x6af78
movq %r14, %rdi
callq 0x28a20
jmp 0x3f7f8
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x15de0(%rip), %rsi     # 0x55551
leaq 0x15dee(%rip), %rdx     # 0x55566
leaq 0x8(%rsp), %rdi
callq 0x26750
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movq %rbx, %rdx
callq 0x29120
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x3f7a3
callq 0x27560
movl $0x28, %edi
callq 0x269d0
movq %rax, %r14
leaq 0x8(%rsp), %rdi
movq %r15, (%rdi)
leaq 0x168f9(%rip), %rsi     # 0x560b8
leaq 0x1690c(%rip), %rdx     # 0x560d2
callq 0x26750
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %r14, %rdi
callq 0x28480
xorl %ebp, %ebp
movq 0x2b74f(%rip), %rsi     # 0x6af38
movq 0x2b788(%rip), %rdx     # 0x6af78
movq %r14, %rdi
callq 0x28a20
jmp 0x3f7fc
jmp 0x3f815
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x3f80e
callq 0x27560
testb %bpl, %bpl
jne 0x3f818
jmp 0x3f820
movq %rax, %rbx
movq %r14, %rdi
callq 0x27070
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x3f83f
jmp 0x3f84b
jmp 0x3f832
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x3f84b
callq 0x27560
jmp 0x3f84b
jmp 0x3f848
movq %rax, %rbx
movq %rbx, %rdi
callq 0x28c10
nop