// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_resolve.cpp
// Function: BamTools::ResolveTool::ResolveToolPrivate::Run()
bool ResolveTool::ResolveToolPrivate::Run(void) {

    // verify that command line settings are acceptable
    vector<string> errors;
    if ( !CheckSettings(errors) ) {
        cerr << "bamtools resolve ERROR - invalid settings: " << endl;
        vector<string>::const_iterator errorIter = errors.begin();
        vector<string>::const_iterator errorEnd  = errors.end();
        for ( ; errorIter != errorEnd; ++errorIter )
            cerr << (*errorIter) << endl;
        return false;
    }

    // initialize read group map with default (empty name) read group
    m_readGroups.insert( make_pair<string, ReadGroupResolver>("", ReadGroupResolver()) );

    // init readname filename
    // uses (adjusted) stats filename if provided (req'd for makeStats, markPairs modes; optional for twoPass)
    // else keep default filename
    if ( m_settings->HasStatsFile )
        m_settings->ReadNamesFilename = m_settings->StatsFilename + READNAME_FILE_SUFFIX;

    // -makeStats mode
    if ( m_settings->IsMakeStats ) {

        // generate stats data
        if ( !MakeStats() ) {
            cerr << "bamtools resolve ERROR - could not generate stats" << endl;
            return false;
        }

        // write stats to file
        if ( !WriteStatsFile() ) {
            cerr << "bamtools resolve ERROR - could not write stats file: "
                 << m_settings->StatsFilename << endl;
            return false;
        }
    }

    // -markPairs mode
    else if ( m_settings->IsMarkPairs ) {

        // read stats from file
        if ( !ReadStatsFile() ) {
            cerr << "bamtools resolve ERROR - could not read stats file: "
                 << m_settings->StatsFilename << endl;
            return false;
        }

        // do paired-end resolution
        if ( !ResolvePairs() ) {
            cerr << "bamtools resolve ERROR - could not resolve pairs" << endl;
            return false;
        }
    }

    // -twoPass mode
    else {

        // generate stats data
        if ( !MakeStats() ) {
            cerr << "bamtools resolve ERROR - could not generate stats" << endl;
            return false;
        }

        // if stats file requested
        if ( m_settings->HasStatsFile ) {

            // write stats to file
            // emit warning if write fails, but paired-end resolution should be allowed to proceed
            if ( !WriteStatsFile() )
                cerr << "bamtools resolve WARNING - could not write stats file: "
                     << m_settings->StatsFilename << endl;
        }

        // do paired-end resolution
        if ( !ResolvePairs() ) {
            cerr << "bamtools resolve ERROR - could not resolve pairs" << endl;
            return false;
        }
    }

    // return success
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rsi
movaps %xmm0, (%rsi)
andq $0x0, 0x10(%rsi)
callq 0x4f886
testb %al, %al
je 0x50962
leaq 0x25f89(%rip), %rsi     # 0x767f7
leaq 0x28(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x35280
leaq 0xc8(%rsp), %rdi
callq 0x4e5ce
leaq 0x128(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0xc8(%rsp), %rdx
callq 0x53bba
leaq 0x48(%rsp), %rdi
leaq 0x128(%rsp), %rsi
callq 0x51bc0
leaq 0x8(%rbx), %rdi
leaq 0x48(%rsp), %rsi
callq 0x53bf8
leaq 0x48(%rsp), %rdi
callq 0x51c02
leaq 0x128(%rsp), %rdi
callq 0x51c3c
leaq 0xc8(%rsp), %rdi
callq 0x51c76
leaq 0x28(%rsp), %rdi
callq 0x35730
movq (%rbx), %rsi
cmpb $0x1, 0x5(%rsi)
jne 0x5092e
addq $0x50, %rsi
leaq 0x4538a(%rip), %rdx     # 0x95c90
leaq 0x48(%rsp), %rdi
callq 0x51d62
movq (%rbx), %rdi
addq $0x70, %rdi
leaq 0x48(%rsp), %rsi
callq 0x35340
leaq 0x48(%rsp), %rdi
callq 0x35730
movq (%rbx), %rsi
cmpb $0x1, (%rsi)
jne 0x509b0
movq %rbx, %rdi
callq 0x4fd3c
testb %al, %al
je 0x50a33
movq %rbx, %rdi
callq 0x50b02
movb $0x1, %bpl
testb %al, %al
jne 0x50a74
leaq 0x231c7(%rip), %rsi     # 0x73b24
jmp 0x50a4f
movq 0x44677(%rip), %rdi     # 0x94fe0
leaq 0x23156(%rip), %rsi     # 0x73ac6
callq 0x355b0
movq %rax, %rdi
callq 0x35300
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %r15
movq 0x44652(%rip), %r14     # 0x94fe0
cmpq %r15, %rbx
je 0x50a72
movq %r14, %rdi
movq %rbx, %rsi
callq 0x35510
movq %rax, %rdi
callq 0x35300
addq $0x20, %rbx
jmp 0x5098e
cmpb $0x1, 0x1(%rsi)
jne 0x509d0
movq %rbx, %rdi
callq 0x502c0
testb %al, %al
je 0x50a48
movq %rbx, %rdi
callq 0x5051a
jmp 0x50a23
movq %rbx, %rdi
callq 0x4fd3c
testb %al, %al
je 0x50a33
movq (%rbx), %rax
cmpb $0x1, 0x5(%rax)
jne 0x50a1b
movq %rbx, %rdi
callq 0x50b02
testb %al, %al
jne 0x50a1b
movq 0x445e8(%rip), %rdi     # 0x94fe0
leaq 0x231c1(%rip), %rsi     # 0x73bc0
callq 0x355b0
movq (%rbx), %rsi
addq $0x50, %rsi
movq %rax, %rdi
callq 0x35510
movq %rax, %rdi
callq 0x35300
movq %rbx, %rdi
callq 0x5051a
movb $0x1, %bpl
testb %al, %al
jne 0x50a74
leaq 0x2315e(%rip), %rsi     # 0x73b8f
jmp 0x50a3a
leaq 0x230b8(%rip), %rsi     # 0x73af2
movq 0x4459f(%rip), %rdi     # 0x94fe0
callq 0x355b0
jmp 0x50a6a
leaq 0x2310b(%rip), %rsi     # 0x73b5a
movq 0x4458a(%rip), %rdi     # 0x94fe0
callq 0x355b0
movq (%rbx), %rsi
addq $0x50, %rsi
movq %rax, %rdi
callq 0x35510
movq %rax, %rdi
callq 0x35300
xorl %ebp, %ebp
leaq 0x10(%rsp), %rdi
callq 0x3abf0
movl %ebp, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x35730
jmp 0x50ae8
jmp 0x50ae5
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x51c02
jmp 0x50abd
jmp 0x50ae5
movq %rax, %rbx
jmp 0x50ad7
movq %rax, %rbx
jmp 0x50aca
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
callq 0x51c3c
leaq 0xc8(%rsp), %rdi
callq 0x51c76
leaq 0x28(%rsp), %rdi
callq 0x35730
jmp 0x50ae8
jmp 0x50ae5
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x3abf0
movq %rbx, %rdi
callq 0x35b50
movq %rax, %rdi
callq 0x3a198