LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/utils/bamtools_filter_ruleparser.h
// Function: BamTools::RuleParser::RuleParser(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
RuleParser(const std::string& ruleString)
            : m_ruleString(ruleString)
        { 
            // initialize char markers
            m_begin = (char*)m_ruleString.c_str();
            m_end   = m_begin + m_ruleString.length();
            ignoreQuotes();
        }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x50, %rsp
movq %rdi, %rbx
callq 0x35810
movq %rsp, %rdi
callq 0x43ff0
leaq 0x38(%rbx), %r14
movq %rsp, %rsi
movq %r14, %rdi
callq 0x441c0
movq %rsp, %rdi
callq 0x43f4e
movq %rsp, %rdi
callq 0x46370
leaq 0x88(%rbx), %rdi
movq %rsp, %rsi
callq 0x4657e
movq %rsp, %rdi
callq 0x462ea
movq (%rbx), %rax
movq %rax, 0x20(%rbx)
addq 0x8(%rbx), %rax
movq %rax, 0x30(%rbx)
movq %rbx, %rdi
callq 0x4634e
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r15
movq %rsp, %rdi
callq 0x462ea
jmp 0x46047
movq %rax, %r15
movq %rsp, %rdi
callq 0x43f4e
jmp 0x46054
movq %rax, %r15
movq %r14, %rdi
callq 0x43f4e
jmp 0x46054
movq %rax, %r15
movq %rbx, %rdi
callq 0x35730
movq %r15, %rdi
callq 0x35b50
movq %rax, %rdi
callq 0x3a198
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/utils/bamtools_filter_ruleparser.h
// Function: BamTools::RuleParser::skipSpaces()
inline
void RuleParser::skipSpaces(void) {
    while ( m_current != m_end ) {
        const char c = *m_current;
        if ( c == ' ' || c == '\t' || c == '\r' || c == '\n')
            ++m_current;
        else break;
    }
}

// Assembly:
movq 0x28(%rdi), %rax
movq 0x30(%rdi), %rcx
movabsq $0x100002600, %rdx      # imm = 0x100002600
cmpq %rcx, %rax
je 0x46a9f
movzbl (%rax), %esi
cmpq $0x20, %rsi
ja 0x46a9f
btq %rsi, %rdx
jae 0x46a9f
incq %rax
movq %rax, 0x28(%rdi)
jmp 0x46a82
retq
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/utils/bamtools_filter_properties.h
// Function: bool BamTools::PropertyFilterValue::check<float>(float const&) const
bool PropertyFilterValue::check(const T& query) const {
  
    // ensure filter value & query are same type
    if ( !Value.is_type<T>() ) { 
        std::cerr << "Cannot compare different types!" << std::endl;
        return false;
    }
    
    // string matching
    if ( Value.is_type<std::string>() ) {
        std::cerr << "Cannot compare different types - query is a string!" << std::endl;
        return false;
    } 
    
    // numeric matching based on our filter type
    switch ( Type ) {
        case ( PropertyFilterValue::EXACT)              : return ( query == Value.get<T>() );
        case ( PropertyFilterValue::GREATER_THAN)       : return ( query >  Value.get<T>() ); 
        case ( PropertyFilterValue::GREATER_THAN_EQUAL) : return ( query >= Value.get<T>() ); 
        case ( PropertyFilterValue::LESS_THAN)          : return ( query <  Value.get<T>() );
        case ( PropertyFilterValue::LESS_THAN_EQUAL)    : return ( query <= Value.get<T>() );
        case ( PropertyFilterValue::NOT)                : return ( query != Value.get<T>() );
        default : BAMTOOLS_ASSERT_UNREACHABLE;
    }
    return false;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
callq 0x4ae32
testb %al, %al
je 0x4ab35
movq %rbx, %rdi
callq 0x43ec6
testb %al, %al
je 0x4ab5a
movq 0x4a4b4(%rip), %rdi     # 0x94fe0
leaq 0x27a8c(%rip), %rsi     # 0x725bf
jmp 0x4ab43
movq 0x4a4a4(%rip), %rdi     # 0x94fe0
leaq 0x27a5c(%rip), %rsi     # 0x7259f
callq 0x355b0
movq %rax, %rdi
callq 0x35300
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl 0x8(%rbx), %eax
addl $-0x2, %eax
cmpl $0x5, %eax
ja 0x4ab50
leaq 0x270a0(%rip), %rcx     # 0x71c0c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movss (%r14), %xmm0
movss %xmm0, 0x4(%rsp)
movq %rbx, %rdi
callq 0x4ae54
movss 0x4(%rsp), %xmm0
cmpeqss (%rax), %xmm0
jmp 0x4ac3a
movss (%r14), %xmm0
movss %xmm0, 0x4(%rsp)
movq %rbx, %rdi
callq 0x4ae54
movss (%rax), %xmm0
ucomiss 0x4(%rsp), %xmm0
jmp 0x4abd2
movss (%r14), %xmm0
movss %xmm0, 0x4(%rsp)
movq %rbx, %rdi
callq 0x4ae54
movss 0x4(%rsp), %xmm0
ucomiss (%rax), %xmm0
setae %al
jmp 0x4ab52
movss (%r14), %xmm0
movss %xmm0, 0x4(%rsp)
movq %rbx, %rdi
callq 0x4ae54
movss (%rax), %xmm0
ucomiss 0x4(%rsp), %xmm0
jmp 0x4ac14
movss (%r14), %xmm0
movss %xmm0, 0x4(%rsp)
movq %rbx, %rdi
callq 0x4ae54
movss 0x4(%rsp), %xmm0
ucomiss (%rax), %xmm0
seta %al
jmp 0x4ab52
movss (%r14), %xmm0
movss %xmm0, 0x4(%rsp)
movq %rbx, %rdi
callq 0x4ae54
movss 0x4(%rsp), %xmm0
cmpneqss (%rax), %xmm0
movd %xmm0, %eax
andl $0x1, %eax
jmp 0x4ab52
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/utils/bamtools_filter_properties.h
// Function: BamTools::PropertyFilterValue::check(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) const
inline
bool PropertyFilterValue::check(const std::string& query) const {
  
    // ensure filter value & query are same type
    if ( !Value.is_type<std::string>() ) {
        std::cerr << "Cannot compare different types!" << std::endl;
        return false;
    }
  
    // localize string version of our filter value
    const std::string& valueString = Value.get<std::string>();
    
    // string matching based on our filter type
    switch ( Type ) {
        case ( PropertyFilterValue::CONTAINS)           : return ( query.find(valueString) != std::string::npos );
        case ( PropertyFilterValue::ENDS_WITH)          : return ( query.find(valueString) == (query.length() - valueString.length()) ); 
        case ( PropertyFilterValue::EXACT)              : return ( query == valueString );
        case ( PropertyFilterValue::GREATER_THAN)       : return ( query >  valueString ); 
        case ( PropertyFilterValue::GREATER_THAN_EQUAL) : return ( query >= valueString ); 
        case ( PropertyFilterValue::LESS_THAN)          : return ( query <  valueString );
        case ( PropertyFilterValue::LESS_THAN_EQUAL)    : return ( query <= valueString );
        case ( PropertyFilterValue::NOT)                : return ( query != valueString );
        case ( PropertyFilterValue::STARTS_WITH)        : return ( query.find(valueString) == 0 );
        default : BAMTOOLS_ASSERT_UNREACHABLE;
    }
    return false;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r15
callq 0x43ec6
testb %al, %al
je 0x48f5d
movq %r15, %rdi
callq 0x49926
movq %rax, %r14
movl 0x8(%r15), %eax
cmpq $0x8, %rax
ja 0x48f78
leaq 0x28c02(%rip), %rcx     # 0x71b40
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x35ca0
cmpq $-0x1, %rax
setne %al
jmp 0x48f7a
movq 0x4c07c(%rip), %rdi     # 0x94fe0
leaq 0x29634(%rip), %rsi     # 0x7259f
callq 0x355b0
movq %rax, %rdi
callq 0x35300
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x49942
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x3a2a9
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x49935
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x4995c
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x35ca0
movq 0x8(%rbx), %rcx
subq 0x8(%r14), %rcx
cmpq %rcx, %rax
jmp 0x4900a
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x3b986
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x4994f
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x35ca0
testq %rax, %rax
sete %al
jmp 0x48f7a
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/utils/bamtools_variant.h
// Function: BamTools::Variant::Impl<unsigned int>* BamTools::Variant::CastFromBase<unsigned int>(BamTools::Variant::ImplBase*)
static Impl<T>* CastFromBase(ImplBase* v) {
            // This upcast will fail if T is other than the T used
            // with the constructor of variant_t.
            Impl<T>* p = dynamic_cast< Impl<T>* > (v);
            if ( p == NULL ) 
                throw std::invalid_argument( typeid(T).name() + std::string(" is not a valid type") );
            return p;
        }

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x50, %rsp
testq %rdi, %rdi
je 0x497f2
leaq 0x4aec2(%rip), %rsi     # 0x94698
leaq 0x4b08b(%rip), %rdx     # 0x94868
xorl %ecx, %ecx
callq 0x35690
testq %rax, %rax
je 0x497f2
addq $0x50, %rsp
popq %rbx
popq %r14
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x35310
movq %rax, %rbx
movq 0x4b7ac(%rip), %rax     # 0x94fb0
movq 0x8(%rax), %r14
movb (%r14), %bpl
leaq 0x28de1(%rip), %rsi     # 0x725f3
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x35280
xorl %eax, %eax
cmpb $0x2a, %bpl
sete %al
addq %rax, %r14
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rdx
movq %r14, %rsi
callq 0x498a8
movb $0x1, %bpl
leaq 0x30(%rsp), %rsi
movq %rbx, %rdi
callq 0x35b10
xorl %ebp, %ebp
movq 0x4b770(%rip), %rsi     # 0x94fc8
movq 0x4b759(%rip), %rdx     # 0x94fb8
movq %rbx, %rdi
callq 0x35af0
movq %rax, %r14
leaq 0x30(%rsp), %rdi
callq 0x35730
jmp 0x4987c
movq %rax, %r14
movb $0x1, %bpl
leaq 0x10(%rsp), %rdi
callq 0x35730
testb %bpl, %bpl
jne 0x49898
jmp 0x498a0
movq %rax, %rdi
callq 0x3a198
movq %rax, %r14
movq %rbx, %rdi
callq 0x35460
movq %r14, %rdi
callq 0x35b50
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/api/BamAlignment.h
// Function: bool BamTools::BamAlignment::GetTag<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) const
inline bool BamAlignment::GetTag<std::string>(const std::string& tag,
                                              std::string& destination) const
{
    // skip if alignment is core-only
    if ( SupportData.HasCoreOnly ) {
        // TODO: set error string?
        return false;
    }

    // skip if no tags present
    if ( TagData.empty() ) {
        // TODO: set error string?
        return false;
    }

    // localize the tag data
    char* pTagData = (char*)TagData.data();
    const unsigned int tagDataLength = TagData.size();
    unsigned int numBytesParsed = 0;

    // return failure if tag not found
    if ( !FindTag(tag, pTagData, tagDataLength, numBytesParsed) ) {
        // TODO: set error string?
        return false;
    }

    // otherwise copy data into destination
    const unsigned int dataLength = strlen(pTagData);
    destination.clear();
    destination.resize(dataLength);
    memcpy( (char*)destination.data(), pTagData, dataLength );

    // return success
    return true;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
cmpb $0x0, 0x130(%rdi)
jne 0x4acc1
movq 0x90(%rdi), %rax
testq %rax, %rax
je 0x4acc1
movq %rdx, %rbx
movq 0x88(%rdi), %rcx
movq %rsp, %rdx
movq %rcx, (%rdx)
leaq 0xc(%rsp), %rcx
movl %eax, (%rcx)
leaq 0x8(%rsp), %r8
andl $0x0, (%r8)
callq 0x35700
movl %eax, %ebp
testb %al, %al
je 0x4acc3
movq (%rsp), %rdi
callq 0x352d0
andq $0x0, 0x8(%rbx)
movq (%rbx), %rcx
movb $0x0, (%rcx)
movl %eax, %r14d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x35820
movq (%rbx), %rdi
movq (%rsp), %rsi
movq %r14, %rdx
callq 0x354c0
jmp 0x4acc3
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/utils/bamtools_filter_engine.h
// Function: BamTools::FilterEngine<BamTools::BamAlignmentChecker>::allPropertyNames[abi:cxx11]()
inline const std::vector<std::string> FilterEngine<FilterChecker>::allPropertyNames(void) {
    // set up stringlist
    std::vector<std::string> names;
    names.reserve(m_properties.size());
    // iterate through all properties, appending to stringlist
    std::vector<Property>::const_iterator propIter = m_properties.begin();
    std::vector<Property>::const_iterator propEnd  = m_properties.end();
    for ( ; propIter != propEnd; ++propIter )
        names.push_back( (*propIter).Name );  
    // return stringlist
    return names;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
movq 0x38(%rsi), %rax
subq 0x30(%rsi), %rax
pushq $0x28
popq %rcx
cqto
idivq %rcx
movq %rax, %rsi
callq 0x4b22e
movq 0x30(%r14), %r15
movq 0x38(%r14), %r14
cmpq %r14, %r15
je 0x4b1da
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3a16c
addq $0x28, %r15
jmp 0x4b1c4
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
jmp 0x4b1e5
movq %rax, %r14
movq %rbx, %rdi
callq 0x3abf0
movq %r14, %rdi
callq 0x35b50
movq %rax, %rdi
callq 0x3a198
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_header.cpp
// Function: BamTools::HeaderTool::~HeaderTool()
HeaderTool::~HeaderTool(void) {

    delete m_settings;
    m_settings = 0;

    delete m_impl;
    m_impl = 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x48a32(%rip), %rax     # 0x94970
movq %rax, (%rdi)
movq 0x8(%rdi), %r14
testq %r14, %r14
je 0x4bf52
movq %r14, %rdi
callq 0x4bff6
movq %r14, %rdi
callq 0x35570
andq $0x0, 0x8(%rbx)
movq 0x10(%rbx), %rdi
callq 0x35570
andq $0x0, 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq %r14, %rdi
callq 0x35570
movq %rbx, %rdi
callq 0x35b50
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_index.cpp
// Function: BamTools::IndexTool::IndexToolPrivate::Run()
bool IndexTool::IndexToolPrivate::Run(void) {

    // open our BAM reader
    BamReader reader;
    if ( !reader.Open(m_settings->InputBamFilename) ) {
        cerr << "bamtools index ERROR: could not open BAM file: "
             << m_settings->InputBamFilename << endl;
        return false;
    }

    // create index for BAM file
    const BamIndex::IndexType type = ( m_settings->IsUsingBamtoolsIndex ? BamIndex::BAMTOOLS
                                                                        : BamIndex::STANDARD );
    reader.CreateIndex(type);

    // clean & exit
    reader.Close();
    return true;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x353f0
movq (%r14), %rsi
addq $0x8, %rsi
movq %rbx, %rdi
callq 0x357b0
movl %eax, %ebx
testb %al, %al
je 0x4c08b
movq (%r14), %rax
movzbl 0x1(%rax), %eax
xorl $0x1, %eax
leaq 0x14(%rsp), %rsi
movl %eax, (%rsi)
leaq 0x8(%rsp), %rdi
callq 0x35b60
leaq 0x8(%rsp), %rdi
callq 0x350a0
jmp 0x4c0b5
movq 0x48f4e(%rip), %rdi     # 0x94fe0
leaq 0x26804(%rip), %rsi     # 0x7289d
callq 0x355b0
movq (%r14), %rsi
addq $0x8, %rsi
movq %rax, %rdi
callq 0x35510
movq %rax, %rdi
callq 0x35300
leaq 0x8(%rsp), %rdi
callq 0x35620
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
jmp 0x4c0cb
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x35620
movq %rbx, %rdi
callq 0x35b50
movq %rax, %rdi
callq 0x3a198
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_index.cpp
// Function: BamTools::IndexTool::~IndexTool()
IndexTool::~IndexTool(void) {

    delete m_settings;
    m_settings = 0;

    delete m_impl;
    m_impl = 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x4861c(%rip), %rax     # 0x949b8
movq %rax, (%rdi)
movq 0x8(%rdi), %r14
testq %r14, %r14
je 0x4c3b1
leaq 0x8(%r14), %rdi
callq 0x35730
movq %r14, %rdi
callq 0x35570
andq $0x0, 0x8(%rbx)
movq 0x10(%rbx), %rdi
callq 0x35570
andq $0x0, 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq %r14, %rdi
callq 0x35570
movq %rbx, %rdi
callq 0x35b50
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_merge.cpp
// Function: BamTools::MergeTool::~MergeTool()
MergeTool::~MergeTool(void) {

    delete m_settings;
    m_settings = 0;

    delete m_impl;
    m_impl = 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x47b36(%rip), %rax     # 0x94a00
movq %rax, (%rdi)
movq 0x8(%rdi), %r14
testq %r14, %r14
je 0x4cede
movq %r14, %rdi
callq 0x4d1b8
movq %r14, %rdi
callq 0x35570
andq $0x0, 0x8(%rbx)
movq 0x10(%rbx), %rdi
callq 0x35570
andq $0x0, 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq %r14, %rdi
callq 0x35570
movq %rbx, %rdi
callq 0x35b50
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_merge.cpp
// Function: BamTools::MergeTool::Run(int, char**)
int MergeTool::Run(int argc, char* argv[]) {
  
    // parse command line arguments
    Options::Parse(argc, argv, 1);
    
    // initialize MergeTool with settings
    m_impl = new MergeToolPrivate(m_settings);

    // run MergeTool, return success/fail
    if ( m_impl->Run() )
        return 0;
    else
        return 1;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
pushq $0x1
popq %rax
movl %esi, %edi
movq %rdx, %rsi
movl %eax, %edx
callq 0x6595a
pushq $0x8
popq %rdi
callq 0x355d0
movq 0x8(%rbx), %rcx
movq %rcx, (%rax)
movq %rax, 0x10(%rbx)
movq %rax, %rdi
callq 0x4c474
xorb $0x1, %al
movzbl %al, %eax
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_random.cpp
// Function: BamTools::RandomTool::~RandomTool()
RandomTool::~RandomTool(void) { 

    delete m_settings;
    m_settings = 0;

    delete m_impl;
    m_impl = 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x46aa2(%rip), %rax     # 0x94a48
movq %rax, (%rdi)
movq 0x8(%rdi), %r14
testq %r14, %r14
je 0x4dfba
movq %r14, %rdi
callq 0x4e454
movq %r14, %rdi
callq 0x35570
andq $0x0, 0x8(%rbx)
movq 0x10(%rbx), %rdi
callq 0x35570
andq $0x0, 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq %r14, %rdi
callq 0x35570
movq %rbx, %rdi
callq 0x35b50
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_resolve.cpp
// Function: CalculateModelType(BamTools::BamAlignment const&)
uint16_t CalculateModelType(const BamAlignment& al) {

    // localize alignment's mate positions & orientations for convenience
    const int32_t m1_begin = ( al.IsFirstMate() ? al.Position : al.MatePosition );
    const int32_t m2_begin = ( al.IsFirstMate() ? al.MatePosition : al.Position );
    const bool m1_isReverseStrand = ( al.IsFirstMate() ? al.IsReverseStrand() : al.IsMateReverseStrand() );
    const bool m2_isReverseStrand = ( al.IsFirstMate() ? al.IsMateReverseStrand() : al.IsReverseStrand() );

    // determine 'model type'
    if ( m1_begin < m2_begin ) {
        if ( !m1_isReverseStrand && !m2_isReverseStrand ) return 0; // ID: 1
        if ( !m1_isReverseStrand &&  m2_isReverseStrand ) return 1; // ID: 2
        if (  m1_isReverseStrand && !m2_isReverseStrand ) return 2; // ID: 3
        if (  m1_isReverseStrand &&  m2_isReverseStrand ) return 3; // ID: 4
    } else {
        if ( !m2_isReverseStrand && !m1_isReverseStrand ) return 4; // ID: 5
        if ( !m2_isReverseStrand &&  m1_isReverseStrand ) return 5; // ID: 6
        if (  m2_isReverseStrand && !m1_isReverseStrand ) return 6; // ID: 7
        if (  m2_isReverseStrand &&  m1_isReverseStrand ) return 7; // ID: 8
    }

    // unknown model
    return ModelType::DUMMY_ID;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
callq 0x352c0
leaq 0xac(%r14), %rbx
leaq 0xd4(%r14), %r15
testb %al, %al
movq %r15, %rax
cmovneq %rbx, %rax
movl (%rax), %ebp
movq %r14, %rdi
callq 0x352c0
testb %al, %al
cmovneq %r15, %rbx
movl (%rbx), %r15d
movq %r14, %rdi
callq 0x352c0
movq %r14, %rdi
testb %al, %al
je 0x4e52a
callq 0x35830
jmp 0x4e52f
callq 0x35880
movl %eax, %ebx
movq %r14, %rdi
callq 0x352c0
movq %r14, %rdi
testb %al, %al
je 0x4e547
callq 0x35880
jmp 0x4e54c
callq 0x35830
movl %ebx, %edx
orb %al, %dl
cmpl %r15d, %ebp
jge 0x4e584
testb %dl, %dl
je 0x4e5be
movl %eax, %edx
xorb $0x1, %dl
movl %ebx, %esi
orb %dl, %sil
movw $0x1, %cx
cmpb $0x1, %sil
jne 0x4e5c0
xorb $0x1, %bl
orb %bl, %al
movw $0x2, %cx
cmpb $0x1, %al
jne 0x4e5c0
orb %dl, %bl
movw $0x3, %cx
jne 0x4e5b8
jmp 0x4e5c0
movw $0x4, %cx
testb %dl, %dl
je 0x4e5c0
movl %ebx, %edx
xorb $0x1, %dl
movl %eax, %esi
orb %dl, %sil
movw $0x5, %cx
cmpb $0x1, %sil
jne 0x4e5c0
xorb $0x1, %al
orb %al, %bl
movw $0x6, %cx
cmpb $0x1, %bl
jne 0x4e5c0
orb %al, %dl
movw $0x7, %cx
cmpb $0x1, %dl
jne 0x4e5c0
movw $0x64, %cx
jmp 0x4e5c0
xorl %ecx, %ecx
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_resolve.cpp
// Function: ReadGroupResolver::ReadGroupResolver()
ReadGroupResolver::ReadGroupResolver(void)
    : MinFragmentLength(0)
    , MedianFragmentLength(0)
    , MaxFragmentLength(0)
    , TopModelId(ModelType::DUMMY_ID)
    , NextTopModelId(ModelType::DUMMY_ID)
    , IsAmbiguous(false)
    , HasData(false)
{
    // pre-allocate space for 8 models
    Models.reserve(NUM_MODELS);
    for ( uint16_t i = 0; i < NUM_MODELS; ++i )
        Models.push_back( ModelType(i+1) );
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdi, %r14
andq $0x0, (%rdi)
movabsq $0x64006400000000, %rax # imm = 0x64006400000000
movq %rax, 0x8(%rdi)
andw $0x0, 0x10(%rdi)
leaq 0x18(%rdi), %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rdi)
andq $0x0, 0x28(%rdi)
leaq 0x38(%rdi), %rax
andl $0x0, 0x38(%rdi)
andq $0x0, 0x40(%rdi)
movq %rax, 0x48(%rdi)
movq %rax, 0x50(%rdi)
andq $0x0, 0x58(%rdi)
pushq $0x8
popq %rsi
movq %rbx, %rdi
callq 0x51888
movw $0x1, %bp
leaq 0x8(%rsp), %r15
movq %rsp, %r12
cmpw $0x9, %bp
je 0x4e65d
movzwl %bp, %esi
movq %r12, %rdi
callq 0x5193c
movq %rbx, %rdi
movq %r12, %rsi
callq 0x51910
movq %r15, %rdi
callq 0x52412
incl %ebp
jmp 0x4e635
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4e679
movq %rax, %r12
movq %r15, %rdi
callq 0x52412
jmp 0x4e67c
movq %rax, %r12
addq $0x30, %r14
movq %r14, %rdi
callq 0x5221c
movq %rbx, %rdi
callq 0x51984
movq %r12, %rdi
callq 0x35b50
movq %rax, %rdi
callq 0x3a198
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_resolve.cpp
// Function: BamTools::ResolveTool::ReadNamesFileReader::Open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool ResolveTool::ReadNamesFileReader::Open(const string& filename) {

    // make sure stream is fresh
    Close();

    // attempt to open filename, return status
    m_stream.open(filename.c_str(), ifstream::in);
    return m_stream.good();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x4ea56
movq (%rbx), %rsi
pushq $0x8
popq %rdx
movq %r14, %rdi
callq 0x353b0
movq (%r14), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x20(%r14,%rax)
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_resolve.cpp
// Function: BamTools::ResolveTool::ReadNamesFileWriter::Open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool ResolveTool::ReadNamesFileWriter::Open(const string& filename) {

    // make sure stream is fresh
    Close();

    // attempt to open filename, return status
    m_stream.open(filename.c_str(), ofstream::out);
    return m_stream.good();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x4ec7c
movq (%rbx), %rsi
pushq $0x10
popq %rdx
movq %r14, %rdi
callq 0x35070
movq (%r14), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x20(%r14,%rax)
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_resolve.cpp
// Function: BamTools::ResolveTool::StatsFileWriter::Write(BamTools::ResolveTool::ResolveSettings*, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, ReadGroupResolver, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, ReadGroupResolver>>> const&)
bool ResolveTool::StatsFileWriter::Write(ResolveTool::ResolveSettings* settings,
                                         const map<string, ReadGroupResolver>& readGroups)
{
    // return failure if file not open
    if ( !m_stream.is_open() )
        return false;

    // write stats file elements
    WriteHeader();
    WriteInput(settings);
    WriteOptions(settings);
    WriteReadGroups(readGroups);

    // return success
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
addq $0x70, %rdi
callq 0x35130
movl %eax, %ebp
testb %al, %al
je 0x4f4c4
movq %r14, %rdi
callq 0x4f4d2
movq %r14, %rdi
movq %r15, %rsi
callq 0x4f638
movq %r14, %rdi
movq %r15, %rsi
callq 0x4f670
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4f766
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_resolve.cpp
// Function: BamTools::ResolveTool::StatsFileWriter::WriteHeader()
void ResolveTool::StatsFileWriter::WriteHeader(void) {

    // stringify current bamtools version
    stringstream versionStream("");
    versionStream << "v"
                  << BAMTOOLS_VERSION_MAJOR << "."
                  << BAMTOOLS_VERSION_MINOR << "."
                  << BAMTOOLS_VERSION_BUILD;

    // # bamtools resolve (vX.Y.Z)
    // #
    // # MODEL DESCRIPTION - see above for actual text
    // \n

    m_stream << COMMENT_CHAR << " bamtools resolve (" << versionStream.str() << ")" << endl
             << COMMENT_CHAR << endl
             << MODEL_DESCRIPTION
             << endl;
}

// Assembly:
pushq %rbx
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, %rbx
leaq 0x27313(%rip), %rsi     # 0x767f7
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x35280
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
pushq $0x18
popq %rdx
callq 0x359e0
leaq 0x8(%rsp), %rdi
callq 0x35730
leaq 0x38(%rsp), %rdi
leaq 0x26171(%rip), %rsi     # 0x7568c
callq 0x355b0
pushq $0x2
popq %rsi
movq %rax, %rdi
callq 0x35b00
leaq 0x26bec(%rip), %rsi     # 0x7611e
movq %rax, %rdi
callq 0x355b0
pushq $0x4
popq %rsi
movq %rax, %rdi
callq 0x35b00
leaq 0x26bd2(%rip), %rsi     # 0x7611e
movq %rax, %rdi
callq 0x355b0
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0x35b00
pushq $0x23
popq %rsi
movq %rbx, %rdi
callq 0x356e0
leaq 0x23ead(%rip), %rsi     # 0x7341e
movq %rax, %rdi
callq 0x355b0
movq %rax, %rbx
leaq 0x40(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x359c0
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x35510
leaq 0x25e74(%rip), %rsi     # 0x75413
movq %rax, %rdi
callq 0x355b0
movq %rax, %rdi
callq 0x35300
pushq $0x23
popq %rsi
movq %rax, %rdi
callq 0x356e0
movq %rax, %rdi
callq 0x35300
leaq 0x466a7(%rip), %rsi     # 0x95c70
movq %rax, %rdi
callq 0x35510
movq %rax, %rdi
callq 0x35300
leaq 0x8(%rsp), %rdi
callq 0x35730
leaq 0x28(%rsp), %rdi
callq 0x35490
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbx
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x35730
jmp 0x4f628
jmp 0x4f61b
movq %rax, %rbx
jmp 0x4f628
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x35730
jmp 0x4f61e
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x35490
movq %rbx, %rdi
callq 0x35b50
movq %rax, %rdi
callq 0x3a198
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_resolve.cpp
// Function: BamTools::ResolveTool::StatsFileWriter::WriteInput(BamTools::ResolveTool::ResolveSettings*)
void ResolveTool::StatsFileWriter::WriteInput(ResolveTool::ResolveSettings* settings) {

    // [Input]
    // filename
    // \n

    m_stream << INPUT_TOKEN << endl
             << settings->InputBamFilename << endl
             << endl;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
leaq 0x4652d(%rip), %rsi     # 0x95b70
callq 0x35510
movq %rax, %rdi
callq 0x35300
addq $0x10, %rbx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x35510
movq %rax, %rdi
callq 0x35300
movq %rax, %rdi
popq %rbx
jmp 0x35300
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_resolve.cpp
// Function: BamTools::ResolveTool::StatsFileWriter::WriteOptions(BamTools::ResolveTool::ResolveSettings*)
void ResolveTool::StatsFileWriter::WriteOptions(ResolveTool::ResolveSettings* settings) {

    // [Options]
    // ConfidenceInterval=<double>
    // ForceMarkReadGroups=<true|false>
    // MinimumMapQuality=<uint16_t>
    // UnusedModelThreshold=<double>
    // \n

    m_stream << OPTIONS_TOKEN << endl
             << OPTION_CONFIDENCEINTERVAL   << EQUAL_CHAR << settings->ConfidenceInterval << endl
             << OPTION_FORCEMARKREADGROUPS  << EQUAL_CHAR << boolalpha << settings->HasForceMarkReadGroups << endl
             << OPTION_MINIMUMMAPQUALITY    << EQUAL_CHAR << settings->MinimumMapQuality << endl
             << OPTION_UNUSEDMODELTHRESHOLD << EQUAL_CHAR << settings->UnusedModelThreshold << endl
             << endl;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
leaq 0x46513(%rip), %rsi     # 0x95b90
callq 0x35510
movq %rax, %rdi
callq 0x35300
leaq 0x4653f(%rip), %rsi     # 0x95bd0
movq %rax, %rdi
callq 0x35510
pushq $0x3d
popq %rbp
movq %rax, %rdi
movl %ebp, %esi
callq 0x356e0
movsd 0x90(%rbx), %xmm0
movq %rax, %rdi
callq 0x35a00
movq %rax, %rdi
callq 0x35300
leaq 0x4656b(%rip), %rsi     # 0x95c30
movq %rax, %rdi
callq 0x35510
movq %rax, %rdi
movl %ebp, %esi
callq 0x356e0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
orl $0x1, 0x18(%rax,%rcx)
movzbl 0x8(%rbx), %esi
movq %rax, %rdi
callq 0x35a50
movq %rax, %rdi
callq 0x35300
leaq 0x464f2(%rip), %rsi     # 0x95bf0
movq %rax, %rdi
callq 0x35510
movq %rax, %rdi
movl %ebp, %esi
callq 0x356e0
movzwl 0x98(%rbx), %esi
movq %rax, %rdi
callq 0x35a90
movq %rax, %rdi
callq 0x35300
leaq 0x464e2(%rip), %rsi     # 0x95c10
movq %rax, %rdi
callq 0x35510
movq %rax, %rdi
movl %ebp, %esi
callq 0x356e0
movsd 0xa0(%rbx), %xmm0
movq %rax, %rdi
callq 0x35a00
movq %rax, %rdi
callq 0x35300
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x35300
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_resolve.cpp
// Function: BamTools::ResolveTool::StatsFileWriter::WriteReadGroups(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, ReadGroupResolver, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, ReadGroupResolver>>> const&)
void ResolveTool::StatsFileWriter::WriteReadGroups(const map<string, ReadGroupResolver>& readGroups) {

    // [ReadGroups]
    // #<name> <medianFL> <minFL> <maxFL> <topModelID> <nextTopModelID> <isAmbiguous?>
    m_stream << READGROUPS_TOKEN << endl
             << RG_FIELD_DESCRIPTION << endl;

    // iterate over read groups
    map<string, ReadGroupResolver>::const_iterator rgIter = readGroups.begin();
    map<string, ReadGroupResolver>::const_iterator rgEnd  = readGroups.end();
    for ( ; rgIter != rgEnd; ++rgIter ) {
        const string& name = (*rgIter).first;
        const ReadGroupResolver& resolver = (*rgIter).second;

        // skip if read group has no data
        if ( !resolver.HasData )
            continue;

        // write read group data
        m_stream << name << TAB_CHAR
                 << resolver.MedianFragmentLength << TAB_CHAR
                 << resolver.MinFragmentLength << TAB_CHAR
                 << resolver.MaxFragmentLength << TAB_CHAR
                 << resolver.TopModelId << TAB_CHAR
                 << resolver.NextTopModelId << TAB_CHAR
                 << boolalpha << resolver.IsAmbiguous
                 << endl;
    }

    // extra newline at end
    m_stream << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x46436(%rip), %rsi     # 0x95bb0
callq 0x35510
movq %rax, %rdi
callq 0x35300
leaq 0x464c2(%rip), %rsi     # 0x95c50
movq %rax, %rdi
callq 0x35510
movq %rax, %rdi
callq 0x35300
movq 0x18(%r14), %r15
addq $0x8, %r14
pushq $0x9
popq %rbp
cmpq %r14, %r15
je 0x4f874
cmpb $0x1, 0x51(%r15)
jne 0x4f864
leaq 0x20(%r15), %rsi
movq %rbx, %rdi
callq 0x35510
movq %rax, %rdi
movl %ebp, %esi
callq 0x356e0
movl 0x44(%r15), %esi
movq %rax, %rdi
callq 0x35b00
movq %rax, %rdi
movl %ebp, %esi
callq 0x356e0
movl 0x40(%r15), %esi
movq %rax, %rdi
callq 0x35b00
movq %rax, %rdi
movl %ebp, %esi
callq 0x356e0
movl 0x48(%r15), %esi
movq %rax, %rdi
callq 0x35b00
movq %rax, %rdi
movl %ebp, %esi
callq 0x356e0
movzwl 0x4c(%r15), %esi
movq %rax, %rdi
callq 0x35a90
movq %rax, %rdi
movl %ebp, %esi
callq 0x356e0
movzwl 0x4e(%r15), %esi
movq %rax, %rdi
callq 0x35a90
movq %rax, %rdi
movl %ebp, %esi
callq 0x356e0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
orl $0x1, 0x18(%rax,%rcx)
movzbl 0x50(%r15), %esi
movq %rax, %rdi
callq 0x35a50
movq %rax, %rdi
callq 0x35300
movq %r15, %rdi
callq 0x356b0
movq %rax, %r15
jmp 0x4f7a9
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x35300
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_resolve.cpp
// Function: BamTools::ResolveTool::ResolveToolPrivate::ParseHeader(BamTools::SamHeader const&)
void ResolveTool::ResolveToolPrivate::ParseHeader(const SamHeader& header) {

    // iterate over header read groups, creating a 'resolver' for each
    SamReadGroupConstIterator rgIter = header.ReadGroups.ConstBegin();
    SamReadGroupConstIterator rgEnd  = header.ReadGroups.ConstEnd();
    for ( ; rgIter != rgEnd; ++rgIter ) {
        const SamReadGroup& rg = (*rgIter);
        m_readGroups.insert( make_pair<string, ReadGroupResolver>(rg.ID, ReadGroupResolver()) );
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %rdi, %r12
leaq 0xc0(%rsi), %rbx
movq %rbx, %rdi
callq 0x35a80
movq %rax, %r14
movq %rbx, %rdi
callq 0x35bb0
movq %rax, %r15
addq $0x8, %r12
movq %r12, (%rsp)
leaq 0x8(%rsp), %r12
leaq 0x28(%rsp), %r13
leaq 0x88(%rsp), %rbp
leaq 0x108(%rsp), %rbx
cmpq %r15, %r14
je 0x5025d
addq $0x40, %r14
movq %r12, %rdi
movq %r14, %rsi
callq 0x35810
movq %r13, %rdi
callq 0x4e5ce
movq %rbp, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x53bba
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x51bc0
movq (%rsp), %rdi
movq %rbx, %rsi
callq 0x53bf8
movq %rbx, %rdi
callq 0x51c02
movq %rbp, %rdi
callq 0x51c3c
movq %r13, %rdi
callq 0x51c76
movq %r12, %rdi
callq 0x35730
addq $0x158, %r14            # imm = 0x158
jmp 0x501f3
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
callq 0x51c02
jmp 0x50289
movq %rax, %rbx
jmp 0x502a5
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x51c3c
jmp 0x5029b
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x51c76
leaq 0x8(%rsp), %rdi
callq 0x35730
movq %rbx, %rdi
callq 0x35b50
movq %rax, %rdi
callq 0x3a198
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_resolve.cpp
// Function: BamTools::ResolveTool::ResolveToolPrivate::ReadStatsFile()
bool ResolveTool::ResolveToolPrivate::ReadStatsFile(void) {

    // skip if no filename provided
    if ( m_settings->StatsFilename.empty() )
        return false;

    // attempt to open stats file
    ResolveTool::StatsFileReader statsReader;
    if ( !statsReader.Open(m_settings->StatsFilename) ) {
        cerr << "bamtools resolve ERROR - could not open stats file: "
             << m_settings->StatsFilename << " for reading" << endl;
        return false;
    }

    // attempt to read stats data
    if ( !statsReader.Read(m_settings, m_readGroups) ) {
        cerr << "bamtools resolve ERROR - could not parse stats file: "
             << m_settings->StatsFilename << " for data" << endl;
        return false;
    }

    // return success
    return true;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x210, %rsp            # imm = 0x210
movq (%rdi), %rax
cmpq $0x0, 0x58(%rax)
je 0x5033b
movq %rdi, %rbx
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x356a0
movq (%rbx), %rsi
addq $0x50, %rsi
movq %r14, %rdi
callq 0x4ed4e
testb %al, %al
je 0x5033f
movq (%rbx), %rsi
leaq 0x8(%rbx), %rdx
leaq 0x8(%rsp), %rdi
callq 0x4f228
movb $0x1, %bpl
testb %al, %al
jne 0x5037a
movq 0x44cc9(%rip), %rdi     # 0x94fe0
leaq 0x23635(%rip), %rsi     # 0x73953
callq 0x355b0
movq (%rbx), %rsi
addq $0x50, %rsi
movq %rax, %rdi
callq 0x35510
leaq 0x23650(%rip), %rsi     # 0x73989
jmp 0x50368
xorl %ebp, %ebp
jmp 0x50384
movq 0x44c9a(%rip), %rdi     # 0x94fe0
leaq 0x235d1(%rip), %rsi     # 0x7391e
callq 0x355b0
movq (%rbx), %rsi
addq $0x50, %rsi
movq %rax, %rdi
callq 0x35510
leaq 0x2595e(%rip), %rsi     # 0x75cc6
movq %rax, %rdi
callq 0x355b0
movq %rax, %rdi
callq 0x35300
xorl %ebp, %ebp
leaq 0x8(%rsp), %rdi
callq 0x51cf6
movl %ebp, %eax
addq $0x210, %rsp            # imm = 0x210
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x51cf6
movq %rbx, %rdi
callq 0x35b50
movq %rax, %rdi
callq 0x3a198
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_resolve.cpp
// Function: BamTools::ResolveTool::ResolveToolPrivate::WriteStatsFile()
bool ResolveTool::ResolveToolPrivate::WriteStatsFile(void) {

    // skip if no filename provided
    if ( m_settings->StatsFilename.empty() )
        return false;

    // attempt to open stats file
    ResolveTool::StatsFileWriter statsWriter;
    if ( !statsWriter.Open(m_settings->StatsFilename) ) {
        cerr << "bamtools resolve ERROR - could not open stats file: "
             << m_settings->StatsFilename << " for writing" << endl;
        return false;
    }

    // attempt to write stats data
    if ( !statsWriter.Write(m_settings, m_readGroups) ) {
        cerr << "bamtools resolve ERROR - could not write stats file: "
             << m_settings->StatsFilename << " for data" << endl;
        return false;
    }

    // return success
    return true;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
movq (%rdi), %rax
cmpq $0x0, 0x58(%rax)
je 0x50b79
movq %rdi, %rbx
movq %rsp, %r14
movq %r14, %rdi
callq 0x35ae0
movq (%rbx), %rsi
addq $0x50, %rsi
movq %r14, %rdi
callq 0x4f446
testb %al, %al
je 0x50b7d
movq (%rbx), %rsi
leaq 0x8(%rbx), %rdx
movq %rsp, %rdi
callq 0x4f47c
movb $0x1, %bpl
testb %al, %al
jne 0x50bb8
movq 0x4448b(%rip), %rdi     # 0x94fe0
leaq 0x22fc8(%rip), %rsi     # 0x73b24
callq 0x355b0
movq (%rbx), %rsi
addq $0x50, %rsi
movq %rax, %rdi
callq 0x35510
leaq 0x22e12(%rip), %rsi     # 0x73989
jmp 0x50ba6
xorl %ebp, %ebp
jmp 0x50bc0
movq 0x4445c(%rip), %rdi     # 0x94fe0
leaq 0x22d93(%rip), %rsi     # 0x7391e
callq 0x355b0
movq (%rbx), %rsi
addq $0x50, %rsi
movq %rax, %rdi
callq 0x35510
leaq 0x23052(%rip), %rsi     # 0x73bf8
movq %rax, %rdi
callq 0x355b0
movq %rax, %rdi
callq 0x35300
xorl %ebp, %ebp
movq %rsp, %rdi
callq 0x51da2
movl %ebp, %eax
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x51da2
movq %rbx, %rdi
callq 0x35b50
movq %rax, %rdi
callq 0x3a198
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_resolve.cpp
// Function: BamTools::ResolveTool::~ResolveTool()
ResolveTool::~ResolveTool(void) {

    delete m_settings;
    m_settings = 0;

    delete m_impl;
    m_impl = 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x432ee(%rip), %rax     # 0x94a90
movq %rax, (%rdi)
movq 0x8(%rdi), %rbx
testq %rbx, %rbx
je 0x517b6
movq %rbx, %rdi
callq 0x521ac
movq %rbx, %rdi
callq 0x35570
andq $0x0, 0x8(%r14)
movq 0x10(%r14), %rbx
testq %rbx, %rbx
je 0x517d5
leaq 0x8(%rbx), %rdi
callq 0x52808
movq %rbx, %rdi
callq 0x35570
andq $0x0, 0x10(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
jmp 0x517ec
movq %rax, %r14
movq %rbx, %rdi
callq 0x35570
movq %r14, %rdi
callq 0x35b50
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_resolve.cpp
// Function: BamTools::ResolveTool::Run(int, char**)
int ResolveTool::Run(int argc, char* argv[]) {

    // parse command line arguments
    Options::Parse(argc, argv, 1);

    // initialize ResolveTool
    m_impl = new ResolveToolPrivate(m_settings);

    // run ResolveTool, return success/failure
    if ( m_impl->Run() )
        return 0;
    else
        return 1;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
pushq $0x1
popq %rax
movl %esi, %edi
movq %rdx, %rsi
movl %eax, %edx
callq 0x6595a
pushq $0x38
popq %rdi
callq 0x355d0
movq 0x8(%rbx), %rcx
movq %rcx, (%rax)
andl $0x0, 0x10(%rax)
andq $0x0, 0x18(%rax)
leaq 0x10(%rax), %rcx
movq %rcx, 0x20(%rax)
movq %rcx, 0x28(%rax)
andq $0x0, 0x30(%rax)
movq %rax, 0x10(%rbx)
movq %rax, %rdi
callq 0x5083a
xorb $0x1, %al
movzbl %al, %eax
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_revert.cpp
// Function: BamTools::RevertTool::RevertToolPrivate::RevertAlignment(BamTools::BamAlignment&)
void RevertTool::RevertToolPrivate::RevertAlignment(BamAlignment& al) {

    // replace Qualities with OQ contents, if requested
    if ( !m_settings->IsKeepQualities ) {
        string originalQualities;
        if ( al.GetTag(OQ_TAG, originalQualities) ) {
            al.Qualities = originalQualities;
            al.RemoveTag(OQ_TAG);
        }
    }

    // clear duplicate flag, if requested
    if ( !m_settings->IsKeepDuplicateFlag )
        al.SetIsDuplicate(false);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq (%rdi), %rax
cmpb $0x0, 0x4(%rax)
jne 0x54055
movq %rdi, %r14
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x41cbe(%rip), %rsi     # 0x95cd8
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x4ac46
testb %al, %al
je 0x54048
leaq 0x68(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0x35340
leaq 0x41c98(%rip), %rsi     # 0x95cd8
movq %rbx, %rdi
callq 0x35660
leaq 0x8(%rsp), %rdi
callq 0x35730
movq (%r14), %rax
cmpb $0x0, 0x3(%rax)
jne 0x54065
movq %rbx, %rdi
xorl %esi, %esi
callq 0x35c90
addq $0x28, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x35730
movq %rbx, %rdi
callq 0x35b50
movq %rax, %rdi
callq 0x3a198
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_revert.cpp
// Function: BamTools::RevertTool::~RevertTool()
RevertTool::~RevertTool(void) {

    delete m_settings;
    m_settings = 0;
    
    delete m_impl;
    m_impl = 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x4037e(%rip), %rax     # 0x94b10
movq %rax, (%rdi)
movq 0x8(%rdi), %r14
testq %r14, %r14
je 0x547a6
movq %r14, %rdi
callq 0x548a4
movq %r14, %rdi
callq 0x35570
andq $0x0, 0x8(%rbx)
movq 0x10(%rbx), %rdi
callq 0x35570
andq $0x0, 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq %r14, %rdi
callq 0x35570
movq %rbx, %rdi
callq 0x35b50
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_sort.cpp
// Function: BamTools::SortTool::SortToolPrivate::SortToolPrivate(BamTools::SortTool::SortSettings*)
SortTool::SortToolPrivate::SortToolPrivate(SortTool::SortSettings* settings) 
    : m_settings(settings)
    , m_numberOfRuns(0) 
{ 
    // set filename stub depending on inputfile path
    // that way multiple sort runs don't trip on each other's temp files
    if ( m_settings) {
        size_t extensionFound = m_settings->InputBamFilename.find(".bam");
        if ( extensionFound != string::npos )
            m_tempFilenameStub = m_settings->InputBamFilename.substr(0,extensionFound);
        m_tempFilenameStub.append(".sort.temp.");
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rsi, (%rdi)
leaq 0x18(%rdi), %rax
movq %rax, 0x8(%rdi)
andq $0x0, 0x10(%rdi)
xorl %eax, %eax
movb %al, 0x18(%rdi)
andl $0x0, 0x28(%rdi)
leaq 0x40(%rdi), %rcx
movq %rcx, 0x30(%rdi)
andq $0x0, 0x38(%rdi)
movb %al, 0x40(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rdi)
movups %xmm0, 0x60(%rdi)
movups %xmm0, 0x70(%rdi)
testq %rsi, %rsi
je 0x54989
movq %rdi, %rbx
leaq 0x8(%rdi), %r14
addq $0x8, %rsi
leaq 0x2019f(%rip), %rax     # 0x74adf
movq %rsi, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x35c70
cmpq $-0x1, %rax
je 0x5497a
movq (%rbx), %rsi
addq $0x8, %rsi
movq %rsp, %rdi
xorl %edx, %edx
movq %rax, %rcx
callq 0x35600
movq %rsp, %rsi
movq %r14, %rdi
callq 0x35340
movq %rsp, %rdi
callq 0x35730
leaq 0x20163(%rip), %rsi     # 0x74ae4
movq %r14, %rdi
callq 0x35c30
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r15
movq %rsp, %rdi
callq 0x35730
jmp 0x549a5
jmp 0x549a2
movq %rax, %r15
leaq 0x68(%rbx), %rdi
callq 0x3abf0
leaq 0x50(%rbx), %rdi
callq 0x3a26c
addq $0x30, %rbx
movq %rbx, %rdi
callq 0x35730
movq %r14, %rdi
callq 0x35730
movq %r15, %rdi
callq 0x35b50
movq %rax, %rdi
callq 0x3a198
nop
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_sort.cpp
// Function: BamTools::SortTool::SortToolPrivate::CreateSortedTempFile(std::vector<BamTools::BamAlignment, std::allocator<BamTools::BamAlignment>>&)
bool SortTool::SortToolPrivate::CreateSortedTempFile(vector<BamAlignment>& buffer) {
 
    // do sorting
    SortBuffer(buffer);
  
    // write sorted contents to temp file, store success/fail
    stringstream tempStr;
    tempStr << m_tempFilenameStub << m_numberOfRuns;
    bool success = WriteTempFile( buffer, tempStr.str() );
    
    // save temp filename for merging later
    m_tempFilenames.push_back(tempStr.str());
    
    // clear buffer contents & update run counter
    buffer.clear();
    ++m_numberOfRuns;
    
    // return success/fail of writing to temp file
    // TODO: a failure returned here is not actually caught and handled anywhere
    return success;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rsi, %r14
movq %rdi, %rbx
callq 0x54dac
leaq 0x20(%rsp), %rdi
callq 0x35430
leaq 0x30(%rsp), %rdi
leaq 0x8(%rbx), %rsi
callq 0x35510
movl 0x28(%rbx), %esi
movq %rax, %rdi
callq 0x35b00
leaq 0x38(%rsp), %r15
movq %rsp, %rdi
movq %r15, %rsi
callq 0x359c0
movq %rsp, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x54dca
movl %eax, %ebp
movq %rsp, %rdi
callq 0x35730
movq %rsp, %rdi
movq %r15, %rsi
callq 0x359c0
leaq 0x68(%rbx), %rdi
movq %rsp, %rsi
callq 0x3a16c
movq %rsp, %rdi
callq 0x35730
movq %r14, %rdi
callq 0x5586e
incl 0x28(%rbx)
leaq 0x20(%rsp), %rdi
callq 0x35490
movl %ebp, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x54d8f
movq %rax, %rbx
movq %rsp, %rdi
callq 0x35730
jmp 0x54d92
movq %rax, %rbx
movq %rsp, %rdi
callq 0x35730
jmp 0x54d92
jmp 0x54d8f
jmp 0x54d8f
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x35490
movq %rbx, %rdi
callq 0x35b50
movq %rax, %rdi
callq 0x3a198
// File: /workspace/github_cpp_makefile_star2_O2/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_sort.cpp
// Function: BamTools::SortTool::SortToolPrivate::SortBuffer(std::vector<BamTools::BamAlignment, std::allocator<BamTools::BamAlignment>>&)
void SortTool::SortToolPrivate::SortBuffer(vector<BamAlignment>& buffer) {
 
    // ** add further custom sort options later ?? **
    
    // sort buffer by desired method
    if ( m_settings->IsSortingByName )
        std::stable_sort( buffer.begin(), buffer.end(), Sort::ByName() );
    else
        std::stable_sort( buffer.begin(), buffer.end(), Sort::ByPosition() );
}

// Assembly:
movq (%rdi), %rax
movq (%rsi), %rdi
movq 0x8(%rsi), %rsi
cmpb $0x1, 0x4(%rax)
jne 0x54dc3
xorl %edx, %edx
jmp 0x55c65
xorl %edx, %edx
jmp 0x57003