// File: /workspace/github_cpp_makefile_star2_O1/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 0x3a618
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x28360
movb $0x1, %bpl
cmpb $0x1, 0x18(%rbx)
jne 0x3a68c
leaq 0x8(%rbx), %rsi
leaq 0x18(%rbx), %rdx
movq (%rbx), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
testb %al, %al
jne 0x3a68c
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 0x1b4a5(%rip), %rsi     # 0x55a3d
leaq 0x1b4b4(%rip), %rdx     # 0x55a53
leaq 0x28(%rsp), %rdi
callq 0x26750
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x29130
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x3a5cc
callq 0x27560
leaq 0x28(%rsp), %rdi
movq %r15, (%rdi)
leaq 0x1b3d6(%rip), %rsi     # 0x559b1
leaq 0x1b3f3(%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 0x3a608
callq 0x27560
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x3a676
jmp 0x3a67b
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1b3d4(%rip), %rsi     # 0x559fc
leaq 0x1b3e6(%rip), %rdx     # 0x55a15
leaq 0x8(%rsp), %rdi
callq 0x26750
leaq 0x58(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1b3cd(%rip), %rsi     # 0x55a16
leaq 0x1b3ec(%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 0x3a67b
callq 0x27560
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x3a68a
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 0x3a6b0
callq 0x27560
jmp 0x3a6b0
movq %rax, %rbx
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x3a6d9
jmp 0x3a6e3
movq %rax, %rbx
movq 0x28(%rsp), %rdi
jmp 0x3a6d4
jmp 0x3a6e0
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x3a6e3
callq 0x27560
jmp 0x3a6e3
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x3a6f7
callq 0x27560
jmp 0x3a6f7
movq %rax, %rbx
movq %rbx, %rdi
callq 0x28c20