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

    // clear out flag
    *hasAlignmentsInRegion = false;

    // skip if invalid reader or not open
    if ( m_reader == 0 || !m_reader->IsOpen() ) {
        SetErrorString("BamStandardIndex::Jump", "could not jump: reader is not open");
        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;
    }

    // if region has alignments, return success/fail of seeking there
    if ( *hasAlignmentsInRegion )
        return m_reader->Seek(offset);

    // otherwise, simply return true (but hasAlignmentsInRegion flag has been set to false)
    // (this is OK, BamReader will check this flag before trying to load data)
    return true;
}

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0x98(%rsp)
movq %rsi, 0x90(%rsp)
movq %rdx, 0x88(%rsp)
movq 0x98(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x88(%rsp), %rcx
movb $0x0, (%rcx)
cmpq $0x0, 0x8(%rax)
je 0xb4254
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x77980
testb $0x1, %al
jne 0xb4352
leaq 0x67(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x7b5f0
movq 0x8(%rsp), %rdx
leaq 0x3705c(%rip), %rsi     # 0xeb2cb
leaq 0x68(%rsp), %rdi
callq 0x78e70
jmp 0xb427b
leaq 0x2f(%rsp), %rdi
movq %rdi, (%rsp)
callq 0x7b5f0
movq (%rsp), %rdx
leaq 0x3704e(%rip), %rsi     # 0xeb2e2
leaq 0x30(%rsp), %rdi
callq 0x78e70
jmp 0xb42a0
movq 0x10(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x71d90
jmp 0xb42b6
leaq 0x30(%rsp), %rdi
callq 0x7cce8
jmp 0xb42c2
leaq 0x2f(%rsp), %rdi
callq 0x76f80
leaq 0x68(%rsp), %rdi
callq 0x7cce8
jmp 0xb42d8
leaq 0x67(%rsp), %rdi
callq 0x76f80
movb $0x0, 0xa7(%rsp)
jmp 0xb441d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x58(%rsp)
movl %eax, 0x54(%rsp)
jmp 0xb4343
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x58(%rsp)
movl %eax, 0x54(%rsp)
jmp 0xb432b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x58(%rsp)
movl %eax, 0x54(%rsp)
leaq 0x30(%rsp), %rdi
callq 0x7cce8
jmp 0xb4329
jmp 0xb432b
leaq 0x2f(%rsp), %rdi
callq 0x76f80
leaq 0x68(%rsp), %rdi
callq 0x7cce8
jmp 0xb4341
jmp 0xb4343
leaq 0x67(%rsp), %rdi
callq 0x76f80
jmp 0xb442e
movq 0x10(%rsp), %rdi
movq 0x90(%rsp), %rsi
movq 0x88(%rsp), %rcx
leaq 0x20(%rsp), %rdx
callq 0x769d0
jmp 0xb4373
jmp 0xb43ea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x58(%rsp)
movl %eax, 0x54(%rsp)
movl 0x54(%rsp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0xb442e
movq 0x58(%rsp), %rdi
callq 0x72fc0
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq 0x10(%rsp), %rdi
movq %rax, %rsi
addq $0x10, %rdi
callq 0x78d10
jmp 0xb43c4
movb $0x0, 0xa7(%rsp)
callq 0x7a790
jmp 0xb441d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x58(%rsp)
movl %eax, 0x54(%rsp)
callq 0x7a790
jmp 0xb43e8
jmp 0xb442e
movq 0x88(%rsp), %rax
testb $0x1, (%rax)
je 0xb4415
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rdi
leaq 0x20(%rsp), %rsi
callq 0x76a30
andb $0x1, %al
movb %al, 0xa7(%rsp)
jmp 0xb441d
movb $0x1, 0xa7(%rsp)
movb 0xa7(%rsp), %al
andb $0x1, %al
addq $0xa8, %rsp
retq
movq 0x58(%rsp), %rdi
callq 0x7b550
movq %rax, %rdi
callq 0x88ef0