// File: /workspace/github_cpp_makefile_star2_O3/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)
movq 0x18(%rdi), %rdi
testq %rdi, %rdi
je 0x37dfd
leaq 0x20(%rsp), %r14
movq %rsp, %r15
movq (%rdi), %rax
callq *0x28(%rax)
testb %al, %al
jne 0x37de6
movq 0x18(%rbx), %rsi
movq (%rsi), %rax
movq %r14, %rdi
callq *0x40(%rax)
movq %r15, %rdi
movq %r14, %rsi
callq 0x272a0
movq 0x18(%rbx), %rdi
jmp 0x37dbe
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x37df5
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 0x37e49
movq (%rsp), %r15
movq 0x8(%rsp), %r13
cmpq %r13, %r15
je 0x37ec0
leaq 0x60(%rsp), %r12
movq 0x18(%rbx), %rdi
movups (%r15), %xmm0
movaps %xmm0, 0x60(%rsp)
movq (%rdi), %rax
movq %r12, %rsi
callq *0x10(%rax)
addq $0x10, %r15
cmpq %r13, %r15
jne 0x37e28
jmp 0x37ebc
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1d7d8(%rip), %rsi     # 0x55631
leaq 0x1d7f6(%rip), %rdx     # 0x55656
leaq 0x20(%rsp), %rdi
callq 0x26750
leaq 0x50(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x1d7dc(%rip), %rsi     # 0x55657
leaq 0x1d7f4(%rip), %rdx     # 0x55676
leaq 0x40(%rsp), %rdi
callq 0x26750
leaq 0x20(%rsp), %rsi
leaq 0x40(%rsp), %rdx
movq %rbx, %rdi
callq 0x27bd0
movq 0x40(%rsp), %rdi
cmpq %r12, %rdi
je 0x37ead
callq 0x27560
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x37ebc
callq 0x27560
movq (%rsp), %r15
testq %r15, %r15
je 0x37ecd
movq %r15, %rdi
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 0x37ef8
callq 0x27560
jmp 0x37ef8
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x37f16
callq 0x27560
jmp 0x37f16
jmp 0x37f13
jmp 0x37f13
jmp 0x37f13
jmp 0x37f13
jmp 0x37f13
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x37f24
callq 0x27560
movq %rbx, %rdi
callq 0x28c10