// File: /workspace/github_cpp_makefile_star2_O3/zeeev[P]DASVC/bamtools/src/api/internal/bam/BamRandomAccessController_p.cpp
// Function: BamTools::Internal::BamRandomAccessController::OpenIndex(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, BamTools::Internal::BamReaderPrivate*)
bool BamRandomAccessController::OpenIndex(const string& indexFilename, BamReaderPrivate* reader) {

    // attempt create new index of type based on filename
    BamIndex* index = BamIndexFactory::CreateIndexFromFilename(indexFilename, reader);
    if ( index == 0 ) {
        const string message = string("could not open index file: ") + indexFilename;
        SetErrorString("BamRandomAccessController::OpenIndex", message);
        return false;
    }

    // attempt to load data from index file
    if ( !index->Load(indexFilename) ) {
        const string indexError = index->GetErrorString();
        const string message = string("could not load index data from file: ") + indexFilename +
                               "\n\t" + indexError;
        SetErrorString("BamRandomAccessController::OpenIndex", message);
        return false;
    }

    // save new index & return success
    SetIndex(index);
    return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
movq %rdx, %rsi
callq 0x29080
testq %rax, %rax
je 0x3a1ef
movq %rax, %r15
movq (%rax), %rax
movq %r15, %rdi
movq %r14, %rsi
callq *0x28(%rax)
testb %al, %al
je 0x3a291
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x3a1e5
movq (%rdi), %rax
callq *0x8(%rax)
movq %r15, (%rbx)
movb $0x1, %al
jmp 0x3a282
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1b796(%rip), %rsi     # 0x55995
leaq 0x1b7aa(%rip), %rdx     # 0x559b0
leaq 0x8(%rsp), %rdi
callq 0x26750
leaq 0x48(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movq %r14, %rdx
callq 0x29120
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x3a231
callq 0x27560
leaq 0x8(%rsp), %rdi
movq %r15, (%rdi)
leaq 0x1b771(%rip), %rsi     # 0x559b1
leaq 0x1b78e(%rip), %rdx     # 0x559d5
callq 0x26750
leaq 0x8(%rsp), %rsi
leaq 0x48(%rsp), %rdx
movq %rbx, %rdi
callq 0x263b0
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x3a26d
callq 0x27560
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3a280
callq 0x27560
xorl %eax, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x58(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x10(%r15), %rsi
movq 0x18(%r15), %rdx
addq %rsi, %rdx
leaq 0x48(%rsp), %rdi
callq 0x267c0
leaq 0x78(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1b716(%rip), %rsi     # 0x559d6
leaq 0x1b734(%rip), %rdx     # 0x559fb
leaq 0x68(%rsp), %rdi
callq 0x26750
leaq 0x88(%rsp), %rdi
leaq 0x68(%rsp), %rsi
movq %r14, %rdx
callq 0x29120
leaq 0x38(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x88(%rsp), %rsi
movq 0x90(%rsp), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0x267c0
leaq 0x1b7dc(%rip), %rsi     # 0x55aef
leaq 0x28(%rsp), %rdi
callq 0x29090
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x29120
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x3a340
callq 0x27560
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3a356
callq 0x27560
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0x3a365
callq 0x27560
leaq 0x28(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x1b63d(%rip), %rsi     # 0x559b1
leaq 0x1b65a(%rip), %rdx     # 0x559d5
callq 0x26750
leaq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x263b0
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x3a3a1
callq 0x27560
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3a3b4
callq 0x27560
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
jne 0x3a27b
jmp 0x3a280
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x3a3de
callq 0x27560
jmp 0x3a3de
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x3a42c
jmp 0x3a436
jmp 0x3a3f0
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x3a407
callq 0x27560
jmp 0x3a407
movq %rax, %rbx
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3a422
callq 0x27560
jmp 0x3a422
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0x3a436
callq 0x27560
jmp 0x3a436
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
jne 0x3a476
jmp 0x3a47b
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x3a459
callq 0x27560
jmp 0x3a459
movq %rax, %rbx
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x3a476
jmp 0x3a47b
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x3a47b
callq 0x27560
movq %rbx, %rdi
callq 0x28c10
movq %rax, %rbx
jmp 0x3a47b