// File: 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:
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rdi, 0x198(%rsp)
movq %rsi, 0x190(%rsp)
movq %rdx, 0x188(%rsp)
movq 0x198(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x190(%rsp), %rdi
movq 0x188(%rsp), %rsi
callq 0x7c530
movq %rax, 0x180(%rsp)
cmpq $0x0, 0x180(%rsp)
jne 0xa9068
leaq 0x13f(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x7b5f0
movq 0x20(%rsp), %rdx
leaq 0x41c74(%rip), %rsi     # 0xeab6a
leaq 0x140(%rsp), %rdi
callq 0x78e70
jmp 0xa8f05
movq 0x190(%rsp), %rdx
leaq 0x160(%rsp), %rdi
leaq 0x140(%rsp), %rsi
callq 0x7c720
jmp 0xa8f24
leaq 0x140(%rsp), %rdi
callq 0x7cce8
jmp 0xa8f33
leaq 0x13f(%rsp), %rdi
callq 0x76f80
leaq 0x107(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x7b5f0
movq 0x18(%rsp), %rdx
leaq 0x41c28(%rip), %rsi     # 0xeab86
leaq 0x108(%rsp), %rdi
callq 0x78e70
jmp 0xa8f6d
movq 0x28(%rsp), %rdi
leaq 0x108(%rsp), %rsi
leaq 0x160(%rsp), %rdx
callq 0x71e80
jmp 0xa8f89
leaq 0x108(%rsp), %rdi
callq 0x7cce8
jmp 0xa8f98
leaq 0x107(%rsp), %rdi
callq 0x76f80
movb $0x0, 0x1a7(%rsp)
leaq 0x160(%rsp), %rdi
callq 0x7cce8
jmp 0xa92f4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x130(%rsp)
movl %eax, 0x12c(%rsp)
jmp 0xa8ffa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x130(%rsp)
movl %eax, 0x12c(%rsp)
leaq 0x140(%rsp), %rdi
callq 0x7cce8
jmp 0xa8ff8
jmp 0xa8ffa
leaq 0x13f(%rsp), %rdi
callq 0x76f80
jmp 0xa9305
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x130(%rsp)
movl %eax, 0x12c(%rsp)
jmp 0xa9047
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x130(%rsp)
movl %eax, 0x12c(%rsp)
leaq 0x108(%rsp), %rdi
callq 0x7cce8
jmp 0xa9045
jmp 0xa9047
leaq 0x107(%rsp), %rdi
callq 0x76f80
leaq 0x160(%rsp), %rdi
callq 0x7cce8
jmp 0xa9063
jmp 0xa9305
movq 0x180(%rsp), %rdi
movq 0x190(%rsp), %rsi
movq (%rdi), %rax
callq *0x28(%rax)
testb $0x1, %al
jne 0xa92da
movq 0x180(%rsp), %rsi
leaq 0xe0(%rsp), %rdi
callq 0x7c320
leaq 0x5f(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x7b5f0
movq 0x10(%rsp), %rdx
leaq 0x41af5(%rip), %rsi     # 0xeabab
leaq 0x60(%rsp), %rdi
callq 0x78e70
jmp 0xa90c2
movq 0x190(%rsp), %rdx
leaq 0x80(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x7c720
jmp 0xa90de
leaq 0x41bf2(%rip), %rdx     # 0xeacd7
leaq 0xa0(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x785a0
jmp 0xa90fc
leaq 0xc0(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
leaq 0xe0(%rsp), %rdx
callq 0x7c720
jmp 0xa911b
leaq 0xa0(%rsp), %rdi
callq 0x7cce8
jmp 0xa912a
leaq 0x80(%rsp), %rdi
callq 0x7cce8
jmp 0xa9139
leaq 0x60(%rsp), %rdi
callq 0x7cce8
jmp 0xa9145
leaq 0x5f(%rsp), %rdi
callq 0x76f80
leaq 0x37(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x7b5f0
movq 0x8(%rsp), %rdx
leaq 0x41a1c(%rip), %rsi     # 0xeab86
leaq 0x38(%rsp), %rdi
callq 0x78e70
jmp 0xa9176
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rsi
leaq 0xc0(%rsp), %rdx
callq 0x71e80
jmp 0xa918f
leaq 0x38(%rsp), %rdi
callq 0x7cce8
jmp 0xa919b
leaq 0x37(%rsp), %rdi
callq 0x76f80
movb $0x0, 0x1a7(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x7cce8
jmp 0xa92a2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x130(%rsp)
movl %eax, 0x12c(%rsp)
jmp 0xa9245
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x130(%rsp)
movl %eax, 0x12c(%rsp)
jmp 0xa9237
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x130(%rsp)
movl %eax, 0x12c(%rsp)
jmp 0xa9226
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x130(%rsp)
movl %eax, 0x12c(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x7cce8
jmp 0xa9224
jmp 0xa9226
leaq 0x80(%rsp), %rdi
callq 0x7cce8
jmp 0xa9235
jmp 0xa9237
leaq 0x60(%rsp), %rdi
callq 0x7cce8
jmp 0xa9243
jmp 0xa9245
leaq 0x5f(%rsp), %rdi
callq 0x76f80
jmp 0xa92c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x130(%rsp)
movl %eax, 0x12c(%rsp)
jmp 0xa9289
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x130(%rsp)
movl %eax, 0x12c(%rsp)
leaq 0x38(%rsp), %rdi
callq 0x7cce8
jmp 0xa9287
jmp 0xa9289
leaq 0x37(%rsp), %rdi
callq 0x76f80
leaq 0xc0(%rsp), %rdi
callq 0x7cce8
jmp 0xa92c7
leaq 0xe0(%rsp), %rdi
callq 0x7cce8
jmp 0xa92f4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x130(%rsp)
movl %eax, 0x12c(%rsp)
jmp 0xa92c9
jmp 0xa92c9
leaq 0xe0(%rsp), %rdi
callq 0x7cce8
jmp 0xa92d8
jmp 0xa9305
movq 0x28(%rsp), %rdi
movq 0x180(%rsp), %rsi
callq 0x77bf0
movb $0x1, 0x1a7(%rsp)
movb 0x1a7(%rsp), %al
andb $0x1, %al
addq $0x1a8, %rsp            # imm = 0x1A8
retq
movq 0x130(%rsp), %rdi
callq 0x7b550
movq %rax, %rdi
callq 0x88ef0
nopw (%rax,%rax)