// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
movups (%rsi), %xmm0
movups %xmm0, 0x8(%rdi)
cmpq $0x0, (%rdi)
je 0x3a58c
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x28350
movb $0x1, %bpl
cmpb $0x1, 0x18(%rbx)
jne 0x3a600
leaq 0x8(%rbx), %rsi
leaq 0x18(%rbx), %rdx
movq (%rbx), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
testb %al, %al
jne 0x3a600
movq (%rbx), %rax
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x267c0
leaq 0x38(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1b531(%rip), %rsi     # 0x55a3d
leaq 0x1b540(%rip), %rdx     # 0x55a53
leaq 0x28(%rsp), %rdi
callq 0x26750
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x29120
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x3a540
callq 0x27560
leaq 0x28(%rsp), %rdi
movq %r15, (%rdi)
leaq 0x1b462(%rip), %rsi     # 0x559b1
leaq 0x1b47f(%rip), %rdx     # 0x559d5
callq 0x26750
leaq 0x28(%rsp), %rsi
leaq 0x48(%rsp), %rdx
movq %rbx, %rdi
callq 0x263b0
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x3a57c
callq 0x27560
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x3a5ea
jmp 0x3a5ef
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1b460(%rip), %rsi     # 0x559fc
leaq 0x1b472(%rip), %rdx     # 0x55a15
leaq 0x8(%rsp), %rdi
callq 0x26750
leaq 0x58(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1b459(%rip), %rsi     # 0x55a16
leaq 0x1b478(%rip), %rdx     # 0x55a3c
leaq 0x48(%rsp), %rdi
callq 0x26750
leaq 0x8(%rsp), %rsi
leaq 0x48(%rsp), %rdx
movq %rbx, %rdi
callq 0x263b0
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x3a5ef
callq 0x27560
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x3a5fe
callq 0x27560
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x68, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x3a624
callq 0x27560
jmp 0x3a624
movq %rax, %rbx
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x3a64d
jmp 0x3a657
movq %rax, %rbx
movq 0x28(%rsp), %rdi
jmp 0x3a648
jmp 0x3a654
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x3a657
callq 0x27560
jmp 0x3a657
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x3a66b
callq 0x27560
jmp 0x3a66b
movq %rax, %rbx
movq %rbx, %rdi
callq 0x28c10