// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/internal/bam/BamRandomAccessController_p.cpp
// Function: BamTools::Internal::BamRandomAccessController::SetRegion(BamTools::BamRegion const&, int const&)
bool BamRandomAccessController::SetRegion(const BamRegion& region, const int& referenceCount) {

    // store region
    m_region = region;

    // cannot jump when no index is available
    if ( !HasIndex() ) {
        SetErrorString("BamRandomAccessController", "cannot jump if no index data available");
        return false;
    }

    // adjust region as necessary to reflect where data actually begins
    AdjustRegion(referenceCount);

    // if no data present, return true
    //   * Not an error, but future attempts to access alignments in this region will not return data
    //     Returning true is useful in a BamMultiReader setting where some BAM files may
    //     lack alignments in regions where other files still have data available.
    if ( !m_hasAlignmentsInRegion )
        return true;

    // return success/failure of jump to specified region,
    //
    //  * Index::Jump() is allowed to modify the m_hasAlignmentsInRegion flag
    //    This covers 'corner case' where a region is requested that lies beyond the last
    //    alignment on a reference. If this occurs, any subsequent calls to GetNextAlignment[Core]
    //    will not return data. BamMultiReader will still be able to successfully pull alignments
    //    from a region from other files even if this one has no data.
    if ( !m_index->Jump(m_region, &m_hasAlignmentsInRegion) ) {
        const string indexError = m_index->GetErrorString();
        const string message = string("could not set region\n\t") + indexError;
        SetErrorString("BamRandomAccessController::OpenIndex", message);
        return false;
    }
    else
        return true;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
movups (%rsi), %xmm0
movups %xmm0, 0x8(%rdi)
cmpq $0x0, (%rdi)
je 0x43a1e
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x34360
movb $0x1, %bpl
cmpb $0x1, 0x18(%rbx)
jne 0x43a72
leaq 0x8(%rbx), %rsi
leaq 0x18(%rbx), %rdx
movq (%rbx), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
testb %al, %al
jne 0x43a72
movq (%rbx), %rsi
addq $0x10, %rsi
leaq 0x48(%rsp), %rdi
callq 0x33ff0
leaq 0x180d9(%rip), %rsi     # 0x5ba82
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x31b30
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x355e0
leaq 0x8(%rsp), %rdi
callq 0x33a00
leaq 0x18019(%rip), %rsi     # 0x5b9f6
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x31b30
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %rbx, %rdi
callq 0x31560
leaq 0x8(%rsp), %rdi
callq 0x33a00
leaq 0x28(%rsp), %rdi
callq 0x33a00
leaq 0x48(%rsp), %rdi
callq 0x33a00
jmp 0x43a70
leaq 0x1801c(%rip), %rsi     # 0x5ba41
leaq 0x48(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x31b30
leaq 0x18020(%rip), %rsi     # 0x5ba5b
leaq 0x28(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x31b30
leaq 0x48(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %rbx, %rdi
callq 0x31560
leaq 0x28(%rsp), %rdi
callq 0x33a00
leaq 0x48(%rsp), %rdi
callq 0x33a00
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x68, %rsp
popq %rbx
popq %rbp
retq
jmp 0x43aaa
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x33a00
jmp 0x43a9e
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x33a00
jmp 0x43aad
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x33a00
jmp 0x43aad
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x33a00
jmp 0x43ada
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x33a00
jmp 0x43ad0
movq %rax, %rbx
jmp 0x43ada
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x33a00
movq %rbx, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f