// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/bam/BamMultiReader_p.cpp
// Function: BamTools::Internal::BamMultiReaderPrivate::SetExplicitMergeOrder(BamTools::BamMultiReader::MergeOrder)
bool BamMultiReaderPrivate::SetExplicitMergeOrder(BamMultiReader::MergeOrder order) {

    // set new merge flags
    m_hasUserMergeOrder = true;
    m_mergeOrder = order;

    // remove any existing merger (storing any existing data sitting in the cache)
    vector<MergeItem> currentCacheData;
    if ( m_alignmentCache ) {        
        while ( !m_alignmentCache->IsEmpty() )
            currentCacheData.push_back( m_alignmentCache->TakeFirst() );
        delete m_alignmentCache;
        m_alignmentCache = 0;
    }

    // create new cache using the new merge flags
    m_alignmentCache = CreateAlignmentCache();
    if ( m_alignmentCache == 0 ) {
        SetErrorString("BamMultiReader::SetExplicitMergeOrder", "requested order is unrecognized");
        return false;
    }

    // push current data onto new cache
    vector<MergeItem>::const_iterator readerIter = currentCacheData.begin();
    vector<MergeItem>::const_iterator readerEnd  = currentCacheData.end();
    for ( ; readerIter != readerEnd; ++readerIter ) {
        const MergeItem& item = (*readerIter);
        m_alignmentCache->Add(item);
    }

    // return success
    return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x70, %rsp
movq %rdi, %rbx
movb $0x1, 0x20(%rdi)
movl %esi, 0x24(%rdi)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
cmpq $0x0, 0x18(%rdi)
je 0x37e61
leaq 0x20(%rsp), %r14
movq %rsp, %r15
movq 0x18(%rbx), %rdi
movq (%rdi), %rax
callq *0x28(%rax)
testb %al, %al
jne 0x37e4a
movq 0x18(%rbx), %rsi
movq (%rsi), %rax
movq %r14, %rdi
callq *0x40(%rax)
movq %r15, %rdi
movq %r14, %rsi
callq 0x272a0
jmp 0x37e22
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x37e59
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, 0x18(%rbx)
movq %rbx, %rdi
callq 0x26ff0
movq %rax, %r14
movq %rax, 0x18(%rbx)
testq %rax, %rax
je 0x37eae
movq (%rsp), %r12
movq 0x8(%rsp), %r13
cmpq %r13, %r12
je 0x37f21
leaq 0x60(%rsp), %r15
movq 0x18(%rbx), %rdi
movups (%r12), %xmm0
movaps %xmm0, 0x60(%rsp)
movq (%rdi), %rax
movq %r15, %rsi
callq *0x10(%rax)
addq $0x10, %r12
cmpq %r13, %r12
jne 0x37e8c
jmp 0x37f21
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1d773(%rip), %rsi     # 0x55631
leaq 0x1d791(%rip), %rdx     # 0x55656
leaq 0x20(%rsp), %rdi
callq 0x26750
leaq 0x50(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1d777(%rip), %rsi     # 0x55657
leaq 0x1d78f(%rip), %rdx     # 0x55676
leaq 0x40(%rsp), %rdi
callq 0x26750
leaq 0x20(%rsp), %rsi
leaq 0x40(%rsp), %rdx
movq %rbx, %rdi
callq 0x27be0
movq 0x40(%rsp), %rdi
cmpq %r12, %rdi
je 0x37f12
callq 0x27560
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x37f21
callq 0x27560
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x37f2f
callq 0x27560
testq %r14, %r14
setne %al
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r12, %rdi
je 0x37f5a
callq 0x27560
jmp 0x37f5a
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x37f78
callq 0x27560
jmp 0x37f78
jmp 0x37f75
jmp 0x37f75
jmp 0x37f75
jmp 0x37f75
jmp 0x37f75
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x37f86
callq 0x27560
movq %rbx, %rdi
callq 0x28c20