// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/bam/BamMultiReader_p.cpp
// Function: BamTools::Internal::BamMultiReaderPrivate::LocateIndexes(BamTools::BamIndex::IndexType const&)
bool BamMultiReaderPrivate::LocateIndexes(const BamIndex::IndexType& preferredType) {

    bool errorsEncountered = false;
    m_errorString.clear();

    // iterate over readers
    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;
        if ( reader == 0 ) continue;

        // if reader has no index, try to locate one
        if ( !reader->HasIndex() ) {
            if ( !reader->LocateIndex(preferredType) ) {
                m_errorString.append(1, '\t');
                m_errorString.append(reader->GetErrorString());
                m_errorString.append(1, '\n');
                errorsEncountered = true;
            }
        }
    }

    // check for errors encountered before returning success/fail
    if ( errorsEncountered ) {
        const string currentError = m_errorString;
        const string message = string("error while locating index files: ") + "\n" + currentError;
        SetErrorString("BamMultiReader::LocatingIndexes", message);
        return false;
    } else
        return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdi, %rbx
movq $0x0, 0x30(%rdi)
movq 0x28(%rdi), %rax
movb $0x0, (%rax)
movq (%rdi), %r13
movq 0x8(%rdi), %r14
cmpq %r14, %r13
je 0x36473
movq %rsi, %r15
movq %rbx, (%rsp)
leaq 0x28(%rbx), %r12
xorl %ebx, %ebx
movq (%r13), %rbp
testq %rbp, %rbp
je 0x3645d
movq %rbp, %rdi
callq 0x26230
testb %al, %al
jne 0x3645d
movq %rbp, %rdi
movq %r15, %rsi
callq 0x26650
testb %al, %al
jne 0x3645d
movq (%rsp), %rbx
movq 0x30(%rbx), %rsi
movl $0x1, %ecx
movq %r12, %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 %r12, %rdi
callq 0x265d0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x36442
callq 0x27560
movq 0x30(%rbx), %rsi
movl $0x1, %ecx
movq %r12, %rdi
xorl %edx, %edx
movl $0xa, %r8d
callq 0x28f30
movb $0x1, %bl
addq $0x10, %r13
cmpq %r14, %r13
jne 0x363ca
movq %rbx, %r13
movq (%rsp), %rbx
jmp 0x36476
xorl %r13d, %r13d
testb $0x1, %r13b
je 0x36581
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 0x58(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1efcc(%rip), %rsi     # 0x5547a
leaq 0x1efe7(%rip), %rdx     # 0x5549c
leaq 0x48(%rsp), %rdi
callq 0x26750
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0x267c0
leaq 0x1f042(%rip), %rsi     # 0x55529
leaq 0x28(%rsp), %rdi
callq 0x290a0
leaq 0x68(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x29130
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x36514
callq 0x27560
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x36523
callq 0x27560
leaq 0x28(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x1ef6b(%rip), %rsi     # 0x5549d
leaq 0x1ef83(%rip), %rdx     # 0x554bc
callq 0x26750
leaq 0x28(%rsp), %rsi
leaq 0x68(%rsp), %rdx
movq %rbx, %rdi
callq 0x27be0
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x3655f
callq 0x27560
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x36572
callq 0x27560
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x36581
callq 0x27560
notb %r13b
andb $0x1, %r13b
movl %r13d, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x365b4
callq 0x27560
jmp 0x365b4
movq %rax, %rbx
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x365e7
jmp 0x365f1
jmp 0x365c6
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x365dd
callq 0x27560
jmp 0x365dd
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x365f1
callq 0x27560
jmp 0x365f1
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
jne 0x3660f
jmp 0x36614
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x36614
callq 0x27560
movq %rbx, %rdi
callq 0x28c20