// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_stats.cpp
// Function: BamTools::StatsTool::StatsToolPrivate::Run()
bool StatsTool::StatsToolPrivate::Run() {
  
    // set to default input if none provided
    if ( !m_settings->HasInput && !m_settings->HasInputFilelist )
        m_settings->InputFiles.push_back(Options::StandardIn());

    // add files in the filelist to the input file list
    if ( m_settings->HasInputFilelist ) {

        ifstream filelist(m_settings->InputFilelist.c_str(), ios::in);
        if ( !filelist.is_open() ) {
            cerr << "bamtools stats ERROR: could not open input BAM file list... Aborting." << endl;
            return false;
        }

        string line;
        while ( getline(filelist, line) )
            m_settings->InputFiles.push_back(line);
    }

    // open the BAM files
    BamMultiReader reader;
    if ( !reader.Open(m_settings->InputFiles) ) {
        cerr << "bamtools stats ERROR: could not open input BAM file(s)... Aborting." << endl;
        reader.Close();
        return false;
    }
    
    // plow through alignments, keeping track of stats
    BamAlignment al;
    while ( reader.GetNextAlignmentCore(al) )
        ProcessAlignment(al);
    reader.Close();
    
    // print stats & exit
    PrintStats();
    return true; 
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x230, %rsp            # imm = 0x230
movq %rdi, %rbx
movq (%rdi), %r14
cmpb $0x0, (%r14)
jne 0x60852
cmpb $0x0, 0x1(%r14)
jne 0x60852
addq $0x8, %r14
callq 0x646e2
movq %r14, %rdi
movq %rax, %rsi
callq 0x2e1b0
movq (%rbx), %rax
cmpb $0x1, 0x1(%rax)
jne 0x60952
movq 0x20(%rax), %rsi
leaq 0x28(%rsp), %r14
movq %r14, %rdi
movl $0x8, %edx
callq 0x27ba0
leaq 0xa0(%rsp), %rdi
callq 0x27130
movl %eax, %ebp
testb %al, %al
je 0x608e8
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
movq $0x0, -0x8(%r12)
movb $0x0, (%r12)
leaq 0x8(%rsp), %r15
movq 0x28(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x27590
movsbl %al, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x27bb0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x60930
movq (%rbx), %rdi
addq $0x8, %rdi
movq %r15, %rsi
callq 0x2e1b0
jmp 0x608a5
movq 0x2f6f1(%rip), %r14     # 0x8ffe0
leaq 0x15c74(%rip), %rsi     # 0x7656a
movl $0x45, %edx
movq %r14, %rdi
callq 0x276c0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x27590
movsbl %al, %esi
movq 0x2f6bf(%rip), %rdi     # 0x8ffe0
callq 0x27040
movq %rax, %rdi
callq 0x27410
jmp 0x6093f
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x6093f
callq 0x27560
leaq 0x28(%rsp), %rdi
callq 0x27170
testb %bpl, %bpl
je 0x60a1e
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x27b40
movq (%rbx), %rsi
addq $0x8, %rsi
movq %r14, %rdi
callq 0x273c0
movl %eax, %ebp
testb %al, %al
je 0x609a4
leaq 0x28(%rsp), %rdi
callq 0x27220
leaq 0x8(%rsp), %r14
leaq 0x28(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x27140
testb %al, %al
je 0x609f6
movq %rbx, %rdi
movq %r15, %rsi
callq 0x60714
jmp 0x60988
movq 0x2f635(%rip), %rbx     # 0x8ffe0
leaq 0x15bfe(%rip), %rsi     # 0x765b0
movl $0x43, %edx
movq %rbx, %rdi
callq 0x276c0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x27590
movsbl %al, %esi
movq 0x2f603(%rip), %rdi     # 0x8ffe0
callq 0x27040
movq %rax, %rdi
callq 0x27410
leaq 0x8(%rsp), %rdi
callq 0x27190
jmp 0x60a12
leaq 0x8(%rsp), %rdi
callq 0x27190
movq %rbx, %rdi
callq 0x5fe0c
leaq 0x28(%rsp), %rdi
callq 0x27930
leaq 0x8(%rsp), %rdi
callq 0x27110
jmp 0x60a20
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x230, %rsp            # imm = 0x230
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x60a40
jmp 0x60a3b
movq %rax, %rbx
jmp 0x60a6b
movq %rax, %rbx
jmp 0x60a4d
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x27930
leaq 0x8(%rsp), %rdi
callq 0x27110
jmp 0x60a75
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x60a6b
callq 0x27560
leaq 0x28(%rsp), %rdi
callq 0x27170
movq %rbx, %rdi
callq 0x27b20
movq %rax, %rdi
callq 0x2e1ed
nop