// File: zeeev[P]DASVC/bamtools/src/api/internal/index/BamToolsIndex_p.cpp
// Function: BamTools::Internal::BamToolsIndex::Jump(BamTools::BamRegion const&, bool*)
bool BamToolsIndex::Jump(const BamTools::BamRegion& region, bool* hasAlignmentsInRegion) {

    // clear flag
    *hasAlignmentsInRegion = false;

    // skip if invalid reader or not open
    if ( m_reader == 0 || !m_reader->IsOpen() ) {
        SetErrorString("BamToolsIndex::Jump", "could not jump: reader is not open");
        return false;
    }

    // make sure left-bound position is valid
    const RefVector& references = m_reader->GetReferenceData();
    if ( region.LeftPosition > references.at(region.LeftRefID).RefLength ) {
        SetErrorString("BamToolsIndex::Jump", "could not create index: invalid region requested");
        return false;
    }

    // calculate nearest offset to jump to
    int64_t offset;
    try {
        GetOffset(region, offset, hasAlignmentsInRegion);
    } catch ( BamException& e ) {
        m_errorString = e.what();
        return false;
    }

    // return success/failure of seek
    return m_reader->Seek(offset);
}

// Assembly:
subq $0x118, %rsp            # imm = 0x118
movq %rdi, 0x108(%rsp)
movq %rsi, 0x100(%rsp)
movq %rdx, 0xf8(%rsp)
movq 0x108(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0xf8(%rsp), %rcx
movb $0x0, (%rcx)
cmpq $0x0, 0x8(%rax)
je 0xc2a84
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x77980
testb $0x1, %al
jne 0xc2bc0
leaq 0xd7(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x7b5f0
movq 0x20(%rsp), %rdx
leaq 0x28e45(%rip), %rsi     # 0xeb8e7
leaq 0xd8(%rsp), %rdi
callq 0x78e70
jmp 0xc2ab1
leaq 0x9f(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x7b5f0
movq 0x18(%rsp), %rdx
leaq 0x28813(%rip), %rsi     # 0xeb2e2
leaq 0xa0(%rsp), %rdi
callq 0x78e70
jmp 0xc2ade
movq 0x28(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
callq 0x71d90
jmp 0xc2afa
leaq 0xa0(%rsp), %rdi
callq 0x7cce8
jmp 0xc2b09
leaq 0x9f(%rsp), %rdi
callq 0x76f80
leaq 0xd8(%rsp), %rdi
callq 0x7cce8
jmp 0xc2b25
leaq 0xd7(%rsp), %rdi
callq 0x76f80
movb $0x0, 0x117(%rsp)
jmp 0xc2de6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc8(%rsp)
movl %eax, 0xc4(%rsp)
jmp 0xc2bae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc8(%rsp)
movl %eax, 0xc4(%rsp)
jmp 0xc2b90
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc8(%rsp)
movl %eax, 0xc4(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x7cce8
jmp 0xc2b8e
jmp 0xc2b90
leaq 0x9f(%rsp), %rdi
callq 0x76f80
leaq 0xd8(%rsp), %rdi
callq 0x7cce8
jmp 0xc2bac
jmp 0xc2bae
leaq 0xd7(%rsp), %rdi
callq 0x76f80
jmp 0xc2df7
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x77d80
movq %rax, 0x90(%rsp)
movq 0x100(%rsp), %rax
movl 0x4(%rax), %eax
movl %eax, 0x14(%rsp)
movq 0x90(%rsp), %rdi
movq 0x100(%rsp), %rax
movslq (%rax), %rsi
callq 0x7aa10
movq %rax, %rcx
movl 0x14(%rsp), %eax
cmpl 0x20(%rcx), %eax
jle 0xc2d1d
leaq 0x6f(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x7b5f0
movq 0x8(%rsp), %rdx
leaq 0x28cbf(%rip), %rsi     # 0xeb8e7
leaq 0x70(%rsp), %rdi
callq 0x78e70
jmp 0xc2c34
leaq 0x47(%rsp), %rdi
movq %rdi, (%rsp)
callq 0x7b5f0
movq (%rsp), %rdx
leaq 0x28cae(%rip), %rsi     # 0xeb8fb
leaq 0x48(%rsp), %rdi
callq 0x78e70
jmp 0xc2c59
movq 0x28(%rsp), %rdi
leaq 0x70(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x71d90
jmp 0xc2c6f
leaq 0x48(%rsp), %rdi
callq 0x7cce8
jmp 0xc2c7b
leaq 0x47(%rsp), %rdi
callq 0x76f80
leaq 0x70(%rsp), %rdi
callq 0x7cce8
jmp 0xc2c91
leaq 0x6f(%rsp), %rdi
callq 0x76f80
movb $0x0, 0x117(%rsp)
jmp 0xc2de6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc8(%rsp)
movl %eax, 0xc4(%rsp)
jmp 0xc2d0e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc8(%rsp)
movl %eax, 0xc4(%rsp)
jmp 0xc2cf6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc8(%rsp)
movl %eax, 0xc4(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x7cce8
jmp 0xc2cf4
jmp 0xc2cf6
leaq 0x47(%rsp), %rdi
callq 0x76f80
leaq 0x70(%rsp), %rdi
callq 0x7cce8
jmp 0xc2d0c
jmp 0xc2d0e
leaq 0x6f(%rsp), %rdi
callq 0x76f80
jmp 0xc2df7
movq 0x28(%rsp), %rdi
movq 0x100(%rsp), %rsi
movq 0xf8(%rsp), %rcx
leaq 0x38(%rsp), %rdx
callq 0x788e0
jmp 0xc2d3e
jmp 0xc2dca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc8(%rsp)
movl %eax, 0xc4(%rsp)
movl 0xc4(%rsp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0xc2df7
movq 0xc8(%rsp), %rdi
callq 0x72fc0
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq 0x28(%rsp), %rdi
movq %rax, %rsi
addq $0x10, %rdi
callq 0x78d10
jmp 0xc2d9e
movb $0x0, 0x117(%rsp)
callq 0x7a790
jmp 0xc2de6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc8(%rsp)
movl %eax, 0xc4(%rsp)
callq 0x7a790
jmp 0xc2dc8
jmp 0xc2df7
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rdi
leaq 0x38(%rsp), %rsi
callq 0x76a30
andb $0x1, %al
movb %al, 0x117(%rsp)
movb 0x117(%rsp), %al
andb $0x1, %al
addq $0x118, %rsp            # imm = 0x118
retq
movq 0xc8(%rsp), %rdi
callq 0x7b550
movq %rax, %rdi
callq 0x88ef0
nopl (%rax)