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

    bool errorsEncountered = false;
    m_errorString.clear();

    // iterate over readers
    vector<MergeItem>::iterator itemIter = m_readers.begin();
    vector<MergeItem>::iterator itemEnd  = m_readers.end();
    for ( ; itemIter != itemEnd; ++itemIter ) {
        MergeItem& item = (*itemIter);
        BamReader* reader = item.Reader;
        if ( reader == 0 ) continue;

        // if reader doesn't have an index, create one
        if ( !reader->HasIndex() ) {
            if ( !reader->CreateIndex(type) ) {
                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 creating index files: ") + "\n" + currentError;
        SetErrorString("BamMultiReader::CreateIndexes", message);
        return false;
    } else
        return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, 0x10(%rsp)
leaq 0x28(%rdi), %r14
andq $0x0, 0x30(%rdi)
movq 0x28(%rdi), %rax
movb $0x0, (%rax)
movq (%rdi), %r12
movq %rdi, 0x8(%rsp)
movq 0x8(%rdi), %rbp
xorl %r13d, %r13d
leaq 0x38(%rsp), %r15
cmpq %rbp, %r12
je 0x3f66a
movq (%r12), %rbx
testq %rbx, %rbx
je 0x3f664
movq %rbx, %rdi
callq 0x31340
testb %al, %al
jne 0x3f664
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
callq 0x34f00
testb %al, %al
jne 0x3f664
movq %r14, %rdi
pushq $0x1
popq %r13
movq %r13, %rsi
pushq $0x9
popq %rdx
callq 0x333e0
movq %r15, %rdi
movq %rbx, %rsi
callq 0x32330
movq %r14, %rdi
movq %r15, %rsi
callq 0x35680
movq %r15, %rdi
callq 0x33a00
movq %r14, %rdi
movq %r13, %rsi
pushq $0xa
popq %rdx
callq 0x333e0
movb $0x1, %r13b
addq $0x10, %r12
jmp 0x3f5f8
testb $0x1, %r13b
je 0x3f71d
leaq 0x38(%rsp), %rdi
movq %r14, %rsi
callq 0x33ff0
leaq 0x1bdf6(%rip), %rsi     # 0x5b47e
leaq 0x58(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x31b30
leaq 0x1bed0(%rip), %rdx     # 0x5b56e
leaq 0x18(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x33c40
leaq 0x78(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x38(%rsp), %rdx
callq 0x355e0
leaq 0x18(%rsp), %rdi
callq 0x33a00
leaq 0x58(%rsp), %rdi
callq 0x33a00
leaq 0x1bdc5(%rip), %rsi     # 0x5b4a1
leaq 0x18(%rsp), %rdi
leaq 0x58(%rsp), %rdx
callq 0x31b30
leaq 0x18(%rsp), %rsi
leaq 0x78(%rsp), %rdx
movq 0x8(%rsp), %rdi
callq 0x338e0
leaq 0x18(%rsp), %rdi
callq 0x33a00
leaq 0x78(%rsp), %rdi
callq 0x33a00
leaq 0x38(%rsp), %rdi
callq 0x33a00
notb %r13b
andb $0x1, %r13b
movl %r13d, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3f768
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x33a00
jmp 0x3f75c
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x33a00
jmp 0x3f770
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x33a00
jmp 0x3f77a
movq %rax, %rbx
jmp 0x3f77a
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x33a00
leaq 0x38(%rsp), %rdi
callq 0x33a00
jmp 0x3f793
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x33a00
movq %rbx, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f
nop