// File: /workspace/github_cpp_makefile_star2_O3/zeeev[P]DASVC/bamtools/src/api/internal/bam/BamMultiReader_p.cpp
// Function: BamTools::Internal::BamMultiReaderPrivate::Open(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&)
bool BamMultiReaderPrivate::Open(const vector<string>& filenames) {

    m_errorString.clear();

    // put all current readers back at beginning (refreshes alignment cache)
    if ( !Rewind() ) {
        const string currentError = m_errorString;
        const string message = string("unable to rewind existing readers: \n\t") + currentError;
        SetErrorString("BamMultiReader::Open", message);
        return false;
    }

    // iterate over filenames
    bool errorsEncountered = false;
    vector<string>::const_iterator filenameIter = filenames.begin();
    vector<string>::const_iterator filenameEnd  = filenames.end();
    for ( ; filenameIter != filenameEnd; ++filenameIter ) {
        const string& filename = (*filenameIter);
        if ( filename.empty() ) continue;

        // attempt to open BamReader
        BamReader* reader = new BamReader;
        const bool readerOpened = reader->Open(filename);

        // if opened OK, store it
        if ( readerOpened )
            m_readers.push_back( MergeItem(reader, new BamAlignment) );

        // otherwise store error & clean up invalid reader
        else {
            m_errorString.append(1, '\t');
            m_errorString += string("unable to open file: ") + filename;
            m_errorString.append(1, '\n');
            errorsEncountered = true;

            delete reader;
            reader = 0;
        }
    }

    // check for errors while opening
    if ( errorsEncountered ) {
        const string currentError = m_errorString;
        const string message = string("unable to open all files: \t\n") + currentError;
        SetErrorString("BamMultiReader::Open", message);
        return false;
    }

    // check for BAM file consistency
    if ( !ValidateReaders() ) {
        const string currentError = m_errorString;
        const string message = string("unable to open inconsistent files: \t\n") + currentError;
        SetErrorString("BamMultiReader::Open", message);
        return false;
    }

    // update alignment cache
    return UpdateAlignmentCache();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %r15
movq %rdi, %rbx
movq $0x0, 0x30(%rdi)
movq 0x28(%rdi), %rax
movb $0x0, (%rax)
callq 0x29140
testb %al, %al
je 0x36783
movq (%r15), %r14
movq 0x8(%r15), %r15
cmpq %r15, %r14
je 0x368eb
leaq 0x28(%rbx), %rax
movq %rax, 0x68(%rsp)
movq $0x0, 0x70(%rsp)
leaq 0x48(%rsp), %r12
cmpq $0x0, 0x8(%r14)
je 0x366aa
movl $0x8, %edi
callq 0x276b0
movq %rax, %rbp
movq %rax, %rdi
callq 0x26f90
movq %rbp, %rdi
movq %r14, %rsi
callq 0x27f30
testb %al, %al
je 0x366b8
movl $0x158, %edi            # imm = 0x158
callq 0x276b0
movq %rax, %r13
movq %rax, %rdi
callq 0x265e0
movq %rbp, 0x28(%rsp)
movq %r13, 0x30(%rsp)
movq %rbx, %rdi
leaq 0x28(%rsp), %rsi
callq 0x272a0
addq $0x20, %r14
cmpq %r15, %r14
jne 0x36653
jmp 0x36817
movq 0x30(%rbx), %rsi
movl $0x1, %ecx
movq 0x68(%rsp), %rdi
xorl %edx, %edx
movl $0x9, %r8d
callq 0x28f20
leaq 0x58(%rsp), %rax
movq %rax, 0x48(%rsp)
movq %r12, %rdi
leaq 0x1ee11(%rip), %rsi     # 0x554f8
leaq 0x1ee1f(%rip), %rdx     # 0x5550d
callq 0x26750
leaq 0x28(%rsp), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x29120
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x68(%rsp), %rdi
callq 0x265d0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x3672b
callq 0x27560
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x3673f
callq 0x27560
movq 0x30(%rbx), %rsi
movl $0x1, %ecx
movq 0x68(%rsp), %rdi
xorl %edx, %edx
movl $0xa, %r8d
callq 0x28f20
movq %rbp, %rdi
callq 0x278c0
movq %rbp, %rdi
callq 0x27560
addq $0x20, %r14
movb $0x1, %al
movq %rax, 0x70(%rsp)
cmpq %r15, %r14
jne 0x36653
jmp 0x36822
leaq 0x38(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x28(%rbx), %rsi
movq 0x30(%rbx), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0x267c0
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1ed0c(%rip), %rsi     # 0x554bd
leaq 0x1ed2a(%rip), %rdx     # 0x554e2
leaq 0x8(%rsp), %rdi
callq 0x26750
leaq 0x48(%rsp), %rdi
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0x29120
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x367e5
callq 0x27560
leaq 0x8(%rsp), %rdi
movq %r15, (%rdi)
leaq 0x1ecef(%rip), %rsi     # 0x554e3
leaq 0x1ecfc(%rip), %rdx     # 0x554f7
callq 0x26750
leaq 0x8(%rsp), %rsi
leaq 0x48(%rsp), %rdx
movq %rbx, %rdi
callq 0x27bd0
jmp 0x36993
testb $0x1, 0x70(%rsp)
je 0x368eb
leaq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
movq %rax, (%rdi)
movq 0x28(%rbx), %rsi
movq 0x30(%rbx), %rdx
addq %rsi, %rdx
callq 0x267c0
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1ecbf(%rip), %rsi     # 0x5550e
leaq 0x1ecd4(%rip), %rdx     # 0x5552a
leaq 0x8(%rsp), %rdi
callq 0x26750
leaq 0x48(%rsp), %rdi
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0x29120
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x36883
callq 0x27560
leaq 0x8(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x1ec51(%rip), %rsi     # 0x554e3
leaq 0x1ec5e(%rip), %rdx     # 0x554f7
callq 0x26750
leaq 0x8(%rsp), %rsi
leaq 0x48(%rsp), %rdx
movq %rbx, %rdi
callq 0x27bd0
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x368bf
callq 0x27560
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x368d3
callq 0x27560
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
jne 0x369bf
jmp 0x369c4
movq %rbx, %rdi
callq 0x28f60
testb %al, %al
je 0x36904
movq %rbx, %rdi
callq 0x26060
jmp 0x369c6
leaq 0x38(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x28(%rbx), %rsi
movq 0x30(%rbx), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0x267c0
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1ebf9(%rip), %rsi     # 0x5552b
leaq 0x1ec17(%rip), %rdx     # 0x55550
leaq 0x8(%rsp), %rdi
callq 0x26750
leaq 0x48(%rsp), %rdi
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0x29120
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x36966
callq 0x27560
leaq 0x8(%rsp), %rdi
movq %r15, (%rdi)
leaq 0x1eb6e(%rip), %rsi     # 0x554e3
leaq 0x1eb7b(%rip), %rdx     # 0x554f7
callq 0x26750
leaq 0x8(%rsp), %rsi
leaq 0x48(%rsp), %rdx
movq %rbx, %rdi
callq 0x27bd0
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x369a2
callq 0x27560
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x369b5
callq 0x27560
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x369c4
callq 0x27560
xorl %eax, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x369ec
callq 0x27560
jmp 0x369ec
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
jne 0x36a0a
jmp 0x36a14
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x36a14
callq 0x27560
jmp 0x36a14
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
jmp 0x36a53
jmp 0x36a5c
jmp 0x36a70
jmp 0x36a83
jmp 0x36a97
jmp 0x36ab3
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x36a49
callq 0x27560
jmp 0x36a49
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
jne 0x36ab9
jmp 0x36abe
jmp 0x36aa6
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x36a73
callq 0x27560
jmp 0x36a73
movq %rax, %rbx
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x36a90
jmp 0x36a9a
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x36a9a
callq 0x27560
jmp 0x36a9a
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
jne 0x36ab9
jmp 0x36abe
movq %rax, %rbx
jmp 0x36abe
movq %rax, %rbx
movq %r13, %rdi
jmp 0x36ab9
movq %rax, %rbx
movq %rbp, %rdi
callq 0x27560
movq %rbx, %rdi
callq 0x28c10