// File: zeeev[P]DASVC/bamtools/src/api/internal/bam/BamReader_p.cpp
// Function: BamTools::Internal::BamReaderPrivate::Close()
bool BamReaderPrivate::Close(void) {

    // clear BAM metadata
    m_references.clear();
    m_header.Clear();

    // clear filename
    m_filename.clear();

    // close random access controller
    m_randomAccessController.Close();

    // if stream is open, attempt close
    if ( IsOpen() ) {
        try {
            m_stream.Close();
        } catch ( BamException& e ) {
            const string streamError = e.what();
            const string message = string("encountered error closing BAM file: \n\t") + streamError;
            SetErrorString("BamReader::Close", message);
            return false;
        }
    }

    // return success
    return true;
}

// Assembly:
subq $0xe8, %rsp
movq %rdi, 0xd8(%rsp)
movq 0xd8(%rsp), %rdi
movq %rdi, 0x20(%rsp)
addq $0x28, %rdi
callq 0x73a80
movq 0x20(%rsp), %rdi
addq $0x50, %rdi
callq 0x7b350
movq 0x20(%rsp), %rdi
addq $0x8, %rdi
callq 0x78800
movq 0x20(%rsp), %rdi
addq $0x1a8, %rdi            # imm = 0x1A8
callq 0x77170
movq 0x20(%rsp), %rdi
callq 0x77980
testb $0x1, %al
jne 0xa9cc5
jmp 0xa9f41
movq 0x20(%rsp), %rdi
addq $0x1e8, %rdi            # imm = 0x1E8
callq 0x75340
jmp 0xa9cd8
jmp 0xa9f3f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd0(%rsp)
movl %eax, 0xcc(%rsp)
movl 0xcc(%rsp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0xa9f5a
movq 0xd0(%rsp), %rdi
callq 0x72fc0
movq %rax, 0xc0(%rsp)
movq 0xc0(%rsp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, 0x10(%rsp)
leaq 0x9f(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x7b5f0
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
leaq 0xa0(%rsp), %rdi
callq 0x78e70
jmp 0xa9d5b
leaq 0x9f(%rsp), %rdi
callq 0x76f80
leaq 0x57(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x7b5f0
movq 0x8(%rsp), %rdx
leaq 0x40eb9(%rip), %rsi     # 0xeac3c
leaq 0x58(%rsp), %rdi
callq 0x78e70
jmp 0xa9d8f
leaq 0x78(%rsp), %rdi
leaq 0x58(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
callq 0x7c720
jmp 0xa9da8
leaq 0x58(%rsp), %rdi
callq 0x7cce8
jmp 0xa9db4
leaq 0x57(%rsp), %rdi
callq 0x76f80
leaq 0x2f(%rsp), %rdi
movq %rdi, (%rsp)
callq 0x7b5f0
movq (%rsp), %rdx
leaq 0x40e8c(%rip), %rsi     # 0xeac63
leaq 0x30(%rsp), %rdi
callq 0x78e70
jmp 0xa9de3
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x78(%rsp), %rdx
callq 0x774d0
jmp 0xa9df9
leaq 0x30(%rsp), %rdi
callq 0x7cce8
jmp 0xa9e05
leaq 0x2f(%rsp), %rdi
callq 0x76f80
movb $0x0, 0xe7(%rsp)
leaq 0x78(%rsp), %rdi
callq 0x7cce8
jmp 0xa9ee1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd0(%rsp)
movl %eax, 0xcc(%rsp)
leaq 0x9f(%rsp), %rdi
callq 0x76f80
jmp 0xa9f36
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd0(%rsp)
movl %eax, 0xcc(%rsp)
jmp 0xa9e84
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd0(%rsp)
movl %eax, 0xcc(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x7cce8
jmp 0xa9e82
jmp 0xa9e84
leaq 0x57(%rsp), %rdi
callq 0x76f80
jmp 0xa9f25
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd0(%rsp)
movl %eax, 0xcc(%rsp)
jmp 0xa9ecb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd0(%rsp)
movl %eax, 0xcc(%rsp)
leaq 0x30(%rsp), %rdi
callq 0x7cce8
jmp 0xa9ec9
jmp 0xa9ecb
leaq 0x2f(%rsp), %rdi
callq 0x76f80
leaq 0x78(%rsp), %rdi
callq 0x7cce8
jmp 0xa9f06
leaq 0xa0(%rsp), %rdi
callq 0x7cce8
jmp 0xa9f08
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd0(%rsp)
movl %eax, 0xcc(%rsp)
jmp 0xa9f25
jmp 0xa9f25
callq 0x7a790
jmp 0xa9f49
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd0(%rsp)
movl %eax, 0xcc(%rsp)
jmp 0xa9f36
leaq 0xa0(%rsp), %rdi
callq 0x7cce8
jmp 0xa9f34
jmp 0xa9f36
callq 0x7a790
jmp 0xa9f3d
jmp 0xa9f5a
jmp 0xa9f41
movb $0x1, 0xe7(%rsp)
movb 0xe7(%rsp), %al
andb $0x1, %al
addq $0xe8, %rsp
retq
movq 0xd0(%rsp), %rdi
callq 0x7b550
movq %rax, %rdi
callq 0x88ef0
nop