// File: /workspace/github_cpp_makefile_star2_O3/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 %r12
pushq %rbx
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rdi, %rbx
xorps %xmm0, %xmm0
movq %rsp, %rsi
movaps %xmm0, (%rsi)
movq $0x0, 0x10(%rsi)
callq 0x47f68
testb %al, %al
je 0x4960b
leaq 0x30(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x2d3a7(%rip), %rdx     # 0x76817
leaq 0x20(%rsp), %rdi
movq %rdx, %rsi
callq 0x2f1a0
leaq 0xc0(%rsp), %rdi
callq 0x46342
leaq 0x120(%rsp), %rdi
leaq 0x20(%rsp), %rsi
leaq 0xc0(%rsp), %rdx
callq 0x4cdfa
leaq 0x40(%rsp), %rdi
leaq 0x120(%rsp), %rsi
callq 0x4ac0a
leaq 0x8(%rbx), %rdi
leaq 0x40(%rsp), %rsi
callq 0x4ce8c
leaq 0x90(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x4b57c
leaq 0x78(%rsp), %rdi
callq 0x4a984
leaq 0x50(%rsp), %r15
movq -0x10(%r15), %rdi
cmpq %r15, %rdi
je 0x494f2
callq 0x27560
leaq 0x170(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x4b57c
leaq 0x158(%rsp), %rdi
callq 0x4a984
leaq 0x130(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x49526
callq 0x27560
leaq 0xf0(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x4b57c
leaq 0xd8(%rsp), %rdi
callq 0x4a984
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x49553
callq 0x27560
movq (%rbx), %rsi
cmpb $0x1, 0x5(%rsi)
jne 0x49594
addq $0x50, %rsi
leaq 0x466e9(%rip), %rdx     # 0x8fc50
leaq 0x40(%rsp), %rdi
callq 0x4aed0
movq (%rbx), %rdi
addq $0x70, %rdi
leaq 0x40(%rsp), %rsi
callq 0x27350
movq 0x40(%rsp), %rdi
cmpq %r15, %rdi
je 0x49591
callq 0x27560
movq (%rbx), %rsi
cmpb $0x1, (%rsi)
jne 0x496b1
movq %rbx, %rdi
callq 0x483e4
testb %al, %al
je 0x49746
movq %rbx, %rdi
callq 0x498e2
movb $0x1, %bpl
testb %al, %al
jne 0x4978a
movq 0x45a19(%rip), %rdi     # 0x8efe0
leaq 0x2a5e0(%rip), %rsi     # 0x73bae
movl $0x35, %edx
callq 0x276b0
movq (%rbx), %rax
movq 0x50(%rax), %rsi
movq 0x58(%rax), %rdx
movq 0x459f6(%rip), %rdi     # 0x8efe0
callq 0x276b0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x27590
jmp 0x49775
movq 0x459ce(%rip), %rbx     # 0x8efe0
leaq 0x2a537(%rip), %rsi     # 0x73b50
movl $0x2b, %edx
movq %rbx, %rdi
callq 0x276b0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x27590
movsbl %al, %esi
movq 0x4599c(%rip), %rdi     # 0x8efe0
callq 0x27040
movq %rax, %rdi
callq 0x27410
movq (%rsp), %r15
movq 0x8(%rsp), %r12
cmpq %r12, %r15
je 0x49788
movq 0x45976(%rip), %rbx     # 0x8efe0
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x276b0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x27590
movsbl %al, %esi
movq %r14, %rdi
callq 0x27040
movq %rax, %rdi
callq 0x27410
addq $0x20, %r15
cmpq %r12, %r15
jne 0x4966a
jmp 0x49788
cmpb $0x1, 0x1(%rsi)
jne 0x496d1
movq %rbx, %rdi
callq 0x48c94
testb %al, %al
je 0x497a4
movq %rbx, %rdi
callq 0x48ff6
jmp 0x49731
movq %rbx, %rdi
callq 0x483e4
testb %al, %al
je 0x49746
movq (%rbx), %rax
cmpb $0x1, 0x5(%rax)
jne 0x49729
movq %rbx, %rdi
callq 0x498e2
testb %al, %al
jne 0x49729
movq 0x458e7(%rip), %rdi     # 0x8efe0
leaq 0x2a54a(%rip), %rsi     # 0x73c4a
movl $0x37, %edx
callq 0x276b0
movq (%rbx), %rax
movq 0x50(%rax), %rsi
movq 0x58(%rax), %rdx
movq 0x458c4(%rip), %rdi     # 0x8efe0
callq 0x276b0
movq %rax, %rdi
callq 0x27310
movq %rbx, %rdi
callq 0x48ff6
movb $0x1, %bpl
testb %al, %al
jne 0x4978a
movl $0x30, %edx
leaq 0x2a4d5(%rip), %rsi     # 0x73c19
jmp 0x49752
movl $0x31, %edx
leaq 0x2a42a(%rip), %rsi     # 0x73b7c
movq 0x45887(%rip), %rbx     # 0x8efe0
movq %rbx, %rdi
callq 0x276b0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x27590
movsbl %al, %esi
movq %rbx, %rdi
callq 0x27040
movq %rax, %rdi
callq 0x27410
xorl %ebp, %ebp
movq %rsp, %rdi
callq 0x2f0c0
movl %ebp, %eax
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x45835(%rip), %rdi     # 0x8efe0
leaq 0x2a432(%rip), %rsi     # 0x73be4
movl $0x34, %edx
callq 0x276b0
movq (%rbx), %rax
movq 0x50(%rax), %rsi
movq 0x58(%rax), %rdx
movq 0x45812(%rip), %rdi     # 0x8efe0
callq 0x276b0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x27590
jmp 0x49775
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r15, %rdi
jne 0x498be
jmp 0x498ca
jmp 0x498c7
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x4a984
jmp 0x498b4
jmp 0x498da
movq %rax, %rbx
jmp 0x49836
movq %rax, %rbx
leaq 0x158(%rsp), %rdi
callq 0x4a984
leaq 0x130(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x498a0
callq 0x27560
jmp 0x498a0
jmp 0x498da
movq %rax, %rbx
jmp 0x49865
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x4a984
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4988e
callq 0x27560
jmp 0x4988e
jmp 0x498da
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x4ac9a
jmp 0x4988e
movq %rax, %rbx
leaq 0x120(%rsp), %rdi
callq 0x4ad06
jmp 0x498a0
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x4ad72
jmp 0x498b4
jmp 0x498c7
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x498ca
callq 0x27560
jmp 0x498ca
jmp 0x498c7
movq %rax, %rbx
movq %rsp, %rdi
callq 0x2f0c0
movq %rbx, %rdi
callq 0x27b10
movq %rax, %rdi
callq 0x2e1cd