// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/bam/BamMultiReader_p.cpp
// Function: BamTools::Internal::BamMultiReaderPrivate::OpenIndexes(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::OpenIndexes(const vector<string>& indexFilenames) {

    // TODO: This needs to be cleaner - should not assume same order.
    //       And either way, shouldn't start at first reader.  Should start at
    //       first reader without an index?

    // make sure same number of index filenames as readers
    if ( m_readers.size() != indexFilenames.size() ) {
        const string message("size of index file list does not match current BAM file count");
        SetErrorString("BamMultiReader::OpenIndexes", message);
        return false;
    }

    bool errorsEncountered = false;
    m_errorString.clear();

    // iterate over BamReaders
    vector<string>::const_iterator indexFilenameIter = indexFilenames.begin();
    vector<string>::const_iterator indexFilenameEnd  = indexFilenames.end();
    vector<MergeItem>::iterator readerIter = m_readers.begin();
    vector<MergeItem>::iterator readerEnd  = m_readers.end();
    for ( ; readerIter != readerEnd; ++readerIter ) {
        MergeItem& item = (*readerIter);
        BamReader* reader = item.Reader;

        // open index filename on reader
        if ( reader ) {
            const string& indexFilename = (*indexFilenameIter);
            if ( !reader->OpenIndex(indexFilename) ) {
                m_errorString.append(1, '\t');
                m_errorString += reader->GetErrorString();
                m_errorString.append(1, '\n');
                errorsEncountered = true;
            }
        }

        // increment filename iterator, skip if no more index files to open
        if ( ++indexFilenameIter == indexFilenameEnd )
            break;
    }

    // return success/fail
    if ( errorsEncountered ) {
        const string currentError = m_errorString;
        const string message = string("could not open all index files: \n\t") + currentError;
        SetErrorString("BamMultiReader::OpenIndexes", message);
        return false;
    } else
        return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
movq 0x8(%rdi), %rax
subq (%rdi), %rax
sarq $0x4, %rax
movq 0x8(%rsi), %rcx
subq (%rsi), %rcx
sarq $0x5, %rcx
cmpq %rcx, %rax
jne 0x37ab9
movq $0x0, 0x30(%rbx)
movq 0x28(%rbx), %rax
movb $0x0, (%rax)
movq (%rbx), %r14
movq 0x8(%rbx), %r13
cmpq %r13, %r14
je 0x37b33
movq %rbx, 0x28(%rsp)
leaq 0x28(%rbx), %r15
movq 0x8(%rsi), %rbx
movq (%rsi), %r12
addq $0x10, %r14
movq $0x0, 0x30(%rsp)
movq -0x10(%r14), %rbp
testq %rbp, %rbp
je 0x37a94
movq %rbp, %rdi
movq %r12, %rsi
callq 0x279b0
testb %al, %al
jne 0x37a94
movq 0x28(%rsp), %rax
movq 0x30(%rax), %rsi
movl $0x1, %ecx
movq %r15, %rdi
xorl %edx, %edx
movl $0x9, %r8d
callq 0x28f30
leaq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x26d30
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r15, %rdi
callq 0x265d0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x37a6f
callq 0x27560
movq 0x28(%rsp), %rax
movq 0x30(%rax), %rsi
movl $0x1, %ecx
movq %r15, %rdi
xorl %edx, %edx
movl $0xa, %r8d
callq 0x28f30
movb $0x1, %al
movq %rax, 0x30(%rsp)
addq $0x20, %r12
cmpq %rbx, %r12
je 0x37aad
leaq 0x10(%r14), %rax
cmpq %r13, %r14
movq %rax, %r14
jne 0x37a02
movq 0x28(%rsp), %rbx
movq 0x30(%rsp), %r12
jmp 0x37b36
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1dab7(%rip), %rsi     # 0x55580
leaq 0x1daed(%rip), %rdx     # 0x555bd
leaq 0x8(%rsp), %rdi
callq 0x26750
leaq 0x68(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1dad4(%rip), %rsi     # 0x555be
leaq 0x1dae8(%rip), %rdx     # 0x555d9
leaq 0x58(%rsp), %rdi
callq 0x26750
leaq 0x58(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x27be0
movq 0x58(%rsp), %rdi
cmpq %r15, %rdi
je 0x37b1c
callq 0x27560
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x37b2b
callq 0x27560
xorl %r12d, %r12d
jmp 0x37c04
xorl %r12d, %r12d
testb $0x1, %r12b
je 0x37c00
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x28(%rbx), %rsi
movq 0x30(%rbx), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x267c0
leaq 0x48(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1da6c(%rip), %rsi     # 0x555da
leaq 0x1da87(%rip), %rdx     # 0x555fc
leaq 0x38(%rsp), %rdi
callq 0x26750
leaq 0x58(%rsp), %rdi
leaq 0x38(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x29130
movq 0x38(%rsp), %rdi
cmpq %r14, %rdi
je 0x37ba2
callq 0x27560
leaq 0x38(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x1da0d(%rip), %rsi     # 0x555be
leaq 0x1da21(%rip), %rdx     # 0x555d9
callq 0x26750
leaq 0x38(%rsp), %rsi
leaq 0x58(%rsp), %rdx
movq %rbx, %rdi
callq 0x27be0
movq 0x38(%rsp), %rdi
cmpq %r14, %rdi
je 0x37bde
callq 0x27560
leaq 0x68(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x37bf1
callq 0x27560
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x37c00
callq 0x27560
xorb $0x1, %r12b
andb $0x1, %r12b
movl %r12d, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x38(%rsp), %rdi
cmpq %r14, %rdi
je 0x37c31
callq 0x27560
jmp 0x37c31
movq %rax, %rbx
leaq 0x68(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x37c4e
jmp 0x37c58
movq %rax, %rbx
movq 0x38(%rsp), %rdi
cmpq %r14, %rdi
je 0x37c58
callq 0x27560
jmp 0x37c58
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
jne 0x37c9e
jmp 0x37ca3
movq %rax, %rbx
movq 0x58(%rsp), %rdi
cmpq %r15, %rdi
je 0x37c7b
callq 0x27560
jmp 0x37c7b
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
jne 0x37c9e
jmp 0x37ca3
movq %rax, %rbx
jmp 0x37ca3
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x37ca3
callq 0x27560
movq %rbx, %rdi
callq 0x28c20
nop