// File: /workspace/github_cpp_makefile_star2_O1/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 0x48072
testb %al, %al
je 0x4970d
leaq 0x30(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x2e2a9(%rip), %rdx     # 0x7781b
leaq 0x20(%rsp), %rdi
movq %rdx, %rsi
callq 0x2f1b2
leaq 0xc0(%rsp), %rdi
callq 0x4645a
leaq 0x120(%rsp), %rdi
leaq 0x20(%rsp), %rsi
leaq 0xc0(%rsp), %rdx
callq 0x4cf54
leaq 0x40(%rsp), %rdi
leaq 0x120(%rsp), %rsi
callq 0x4acd8
leaq 0x8(%rbx), %rdi
leaq 0x40(%rsp), %rsi
callq 0x4cfe6
leaq 0x90(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x4b66a
leaq 0x78(%rsp), %rdi
callq 0x4aa80
leaq 0x50(%rsp), %r15
movq -0x10(%r15), %rdi
cmpq %r15, %rdi
je 0x495f4
callq 0x27560
leaq 0x170(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x4b66a
leaq 0x158(%rsp), %rdi
callq 0x4aa80
leaq 0x130(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x49628
callq 0x27560
leaq 0xf0(%rsp), %rdi
movq 0x10(%rdi), %rsi
callq 0x4b66a
leaq 0xd8(%rsp), %rdi
callq 0x4aa80
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x49655
callq 0x27560
movq (%rbx), %rsi
cmpb $0x1, 0x5(%rsi)
jne 0x49693
addq $0x50, %rsi
leaq 0x475ef(%rip), %rdx     # 0x90c58
leaq 0x40(%rsp), %rdi
callq 0x4af9e
movq (%rbx), %rdi
addq $0x70, %rdi
leaq 0x40(%rsp), %rsi
callq 0x27350
movq 0x40(%rsp), %rdi
cmpq %r15, %rdi
je 0x49693
callq 0x27560
movq (%rbx), %rax
cmpb $0x1, (%rax)
jne 0x497b3
movq %rbx, %rdi
callq 0x484e6
testb %al, %al
je 0x49848
movq %rbx, %rdi
callq 0x499e4
movb $0x1, %bpl
testb %al, %al
jne 0x4988c
movq 0x46917(%rip), %rdi     # 0x8ffe0
leaq 0x2b4c6(%rip), %rsi     # 0x74b96
movl $0x35, %edx
callq 0x276c0
movq (%rbx), %rax
movq 0x50(%rax), %rsi
movq 0x58(%rax), %rdx
movq 0x468f4(%rip), %rdi     # 0x8ffe0
callq 0x276c0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x27590
jmp 0x49877
movq 0x468cc(%rip), %rbx     # 0x8ffe0
leaq 0x2b41d(%rip), %rsi     # 0x74b38
movl $0x2b, %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 0x4689a(%rip), %rdi     # 0x8ffe0
callq 0x27040
movq %rax, %rdi
callq 0x27410
movq (%rsp), %r15
movq 0x8(%rsp), %r12
cmpq %r12, %r15
je 0x4988a
movq 0x46874(%rip), %rbx     # 0x8ffe0
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
callq 0x276c0
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 0x4976c
jmp 0x4988a
cmpb $0x1, 0x1(%rax)
jne 0x497d3
movq %rbx, %rdi
callq 0x48d96
testb %al, %al
je 0x498a6
movq %rbx, %rdi
callq 0x490f8
jmp 0x49833
movq %rbx, %rdi
callq 0x484e6
testb %al, %al
je 0x49848
movq (%rbx), %rax
cmpb $0x1, 0x5(%rax)
jne 0x4982b
movq %rbx, %rdi
callq 0x499e4
testb %al, %al
jne 0x4982b
movq 0x467e5(%rip), %rdi     # 0x8ffe0
leaq 0x2b430(%rip), %rsi     # 0x74c32
movl $0x37, %edx
callq 0x276c0
movq (%rbx), %rax
movq 0x50(%rax), %rsi
movq 0x58(%rax), %rdx
movq 0x467c2(%rip), %rdi     # 0x8ffe0
callq 0x276c0
movq %rax, %rdi
callq 0x27310
movq %rbx, %rdi
callq 0x490f8
movb $0x1, %bpl
testb %al, %al
jne 0x4988c
movl $0x30, %edx
leaq 0x2b3bb(%rip), %rsi     # 0x74c01
jmp 0x49854
movl $0x31, %edx
leaq 0x2b310(%rip), %rsi     # 0x74b64
movq 0x46785(%rip), %rbx     # 0x8ffe0
movq %rbx, %rdi
callq 0x276c0
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 0x2f0de
movl %ebp, %eax
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x46733(%rip), %rdi     # 0x8ffe0
leaq 0x2b318(%rip), %rsi     # 0x74bcc
movl $0x34, %edx
callq 0x276c0
movq (%rbx), %rax
movq 0x50(%rax), %rsi
movq 0x58(%rax), %rdx
movq 0x46710(%rip), %rdi     # 0x8ffe0
callq 0x276c0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x27590
jmp 0x49877
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r15, %rdi
jne 0x499c0
jmp 0x499cc
jmp 0x499c9
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x4aa80
jmp 0x499b6
jmp 0x499dc
movq %rax, %rbx
jmp 0x49938
movq %rax, %rbx
leaq 0x158(%rsp), %rdi
callq 0x4aa80
leaq 0x130(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x499a2
callq 0x27560
jmp 0x499a2
jmp 0x499dc
movq %rax, %rbx
jmp 0x49967
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x4aa80
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x49990
callq 0x27560
jmp 0x49990
jmp 0x499dc
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x4ad68
jmp 0x49990
movq %rax, %rbx
leaq 0x120(%rsp), %rdi
callq 0x4add4
jmp 0x499a2
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x4ae40
jmp 0x499b6
jmp 0x499c9
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x499cc
callq 0x27560
jmp 0x499cc
jmp 0x499c9
movq %rax, %rbx
movq %rsp, %rdi
callq 0x2f0de
movq %rbx, %rdi
callq 0x27b20
movq %rax, %rdi
callq 0x2e1ed