// File: /workspace/github_cpp_makefile_star2_O1/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 0x29090
testq %rax, %rax
je 0x3a27a
movq %rax, %r15
movq (%rax), %rax
movq %r15, %rdi
movq %r14, %rsi
callq *0x28(%rax)
testb %al, %al
je 0x3a31c
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x3a270
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, (%rbx)
movq %r15, (%rbx)
movb $0x1, %al
jmp 0x3a30d
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1b70b(%rip), %rsi     # 0x55995
leaq 0x1b71f(%rip), %rdx     # 0x559b0
leaq 0x8(%rsp), %rdi
callq 0x26750
leaq 0x48(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movq %r14, %rdx
callq 0x29130
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x3a2bc
callq 0x27560
leaq 0x8(%rsp), %rdi
movq %r15, (%rdi)
leaq 0x1b6e6(%rip), %rsi     # 0x559b1
leaq 0x1b703(%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 0x3a2f8
callq 0x27560
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3a30b
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 0x1b68b(%rip), %rsi     # 0x559d6
leaq 0x1b6a9(%rip), %rdx     # 0x559fb
leaq 0x68(%rsp), %rdi
callq 0x26750
leaq 0x88(%rsp), %rdi
leaq 0x68(%rsp), %rsi
movq %r14, %rdx
callq 0x29130
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 0x1b751(%rip), %rsi     # 0x55aef
leaq 0x28(%rsp), %rdi
callq 0x290a0
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x29130
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x3a3cb
callq 0x27560
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3a3e1
callq 0x27560
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0x3a3f0
callq 0x27560
leaq 0x28(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x1b5b2(%rip), %rsi     # 0x559b1
leaq 0x1b5cf(%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 0x3a42c
callq 0x27560
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3a43f
callq 0x27560
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
jne 0x3a306
jmp 0x3a30b
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x3a469
callq 0x27560
jmp 0x3a469
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x3a4b7
jmp 0x3a4c1
jmp 0x3a47b
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x3a492
callq 0x27560
jmp 0x3a492
movq %rax, %rbx
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3a4ad
callq 0x27560
jmp 0x3a4ad
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0x3a4c1
callq 0x27560
jmp 0x3a4c1
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
jne 0x3a501
jmp 0x3a506
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x3a4e4
callq 0x27560
jmp 0x3a4e4
movq %rax, %rbx
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x3a501
jmp 0x3a506
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x3a506
callq 0x27560
movq %rbx, %rdi
callq 0x28c20
movq %rax, %rbx
jmp 0x3a506
nop