// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/toolkit/bamtools_filter.cpp
// Function: BamTools::FilterTool::FilterToolPrivate::AddPropertyTokensToFilter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, 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, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>> const&)
bool FilterTool::FilterToolPrivate::AddPropertyTokensToFilter(const string& filterName,
                                                              const map<string,
                                                              string>& propertyTokens)
{
    // dummy temp values for token parsing
    bool boolValue;
    int32_t int32Value;
    uint16_t uint16Value;
    uint32_t uint32Value;
    string stringValue;
    PropertyFilterValue::ValueCompareType type;
  
    // iterate over property token map
    map<string, string>::const_iterator mapIter = propertyTokens.begin();
    map<string, string>::const_iterator mapEnd  = propertyTokens.end();
    for ( ; mapIter != mapEnd; ++mapIter ) {
      
        const string& propertyName = (*mapIter).first;
        const string& token        = (*mapIter).second;
        
        // ------------------------------
        // convert token to value & compare type 
        // then add to filter engine
        
        // bool conversion
        if ( propertyName == ISDUPLICATE_PROPERTY ||
             propertyName == ISFAILEDQC_PROPERTY ||
             propertyName == ISFIRSTMATE_PROPERTY ||
             propertyName == ISMAPPED_PROPERTY ||
             propertyName == ISMATEMAPPED_PROPERTY ||
             propertyName == ISMATEREVERSESTRAND_PROPERTY ||
             propertyName == ISPAIRED_PROPERTY ||
             propertyName == ISPRIMARYALIGNMENT_PROPERTY ||
             propertyName == ISPROPERPAIR_PROPERTY ||
             propertyName == ISREVERSESTRAND_PROPERTY ||
             propertyName == ISSECONDMATE_PROPERTY ||
             propertyName == ISSINGLETON_PROPERTY
           ) 
        {
            FilterEngine<BamAlignmentChecker>::parseToken(token, boolValue, type);
            m_filterEngine.setProperty(filterName, propertyName, boolValue, type);
        }
        
        // int32_t conversion
        else if ( propertyName == INSERTSIZE_PROPERTY ||
                  propertyName == LENGTH_PROPERTY ||
                  propertyName == MATEPOSITION_PROPERTY ||
                  propertyName == POSITION_PROPERTY 
                ) 
        {
            FilterEngine<BamAlignmentChecker>::parseToken(token, int32Value, type);
            m_filterEngine.setProperty(filterName, propertyName, int32Value, type);
        }
        
        // uint16_t conversion
        else if ( propertyName == MAPQUALITY_PROPERTY )
        {
            FilterEngine<BamAlignmentChecker>::parseToken(token, uint16Value, type);
            m_filterEngine.setProperty(filterName, propertyName, uint16Value, type);
        }
        
        // uint32_t conversion
        else if ( propertyName == ALIGNMENTFLAG_PROPERTY )
        {
            FilterEngine<BamAlignmentChecker>::parseToken(token, uint32Value, type);
            m_filterEngine.setProperty(filterName, propertyName, uint32Value, type);
        }
        
        // string conversion
        else if ( propertyName == CIGAR_PROPERTY || 
                  propertyName == MATEREFERENCE_PROPERTY ||
                  propertyName == NAME_PROPERTY ||
                  propertyName == QUERYBASES_PROPERTY ||
                  propertyName == REFERENCE_PROPERTY 
                ) 
        {
            FilterEngine<BamAlignmentChecker>::parseToken(token, stringValue, type);
            m_filterEngine.setProperty(filterName, propertyName, stringValue, type);
        }
      
        else if ( propertyName == TAG_PROPERTY ) {
            // this will be stored directly as the TAG:VALUE token
            // (VALUE may contain compare ops, will be parsed out later)
            m_filterEngine.setProperty(filterName, propertyName, token, PropertyFilterValue::EXACT);
        }
      
        // else unknown property 
        else {
            cerr << "bamtools filter ERROR: unknown property - " << propertyName << endl;
            return false;
        }
    }
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, 0x18(%rsp)
leaq 0x48(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x18(%rdx), %rbx
addq $0x8, %rdx
movq %rdx, 0x30(%rsp)
cmpq %rdx, %rbx
sete %r13b
je 0x31d12
addq $0x20, %rdi
movq %rdi, 0x10(%rsp)
leaq 0xf(%rsp), %r12
movq %r12, %r14
leaq 0x20(%rbx), %rbp
leaq 0x40(%rbx), %r15
movq 0x28(%rbx), %r12
cmpq 0x5eeeb(%rip), %r12     # 0x907b8
jne 0x318f3
testq %r12, %r12
je 0x31ab0
movq 0x5eed1(%rip), %rsi     # 0x907b0
movq (%rbp), %rdi
movq %r12, %rdx
callq 0x275f0
testl %eax, %eax
je 0x31ab0
cmpq 0x5eede(%rip), %r12     # 0x907d8
jne 0x31920
testq %r12, %r12
je 0x31ab0
movq 0x5eec4(%rip), %rsi     # 0x907d0
movq (%rbp), %rdi
movq %r12, %rdx
callq 0x275f0
testl %eax, %eax
je 0x31ab0
cmpq 0x5eed1(%rip), %r12     # 0x907f8
jne 0x3194d
testq %r12, %r12
je 0x31ab0
movq 0x5eeb7(%rip), %rsi     # 0x907f0
movq (%rbp), %rdi
movq %r12, %rdx
callq 0x275f0
testl %eax, %eax
je 0x31ab0
cmpq 0x5eec4(%rip), %r12     # 0x90818
jne 0x3197a
testq %r12, %r12
je 0x31ab0
movq 0x5eeaa(%rip), %rsi     # 0x90810
movq (%rbp), %rdi
movq %r12, %rdx
callq 0x275f0
testl %eax, %eax
je 0x31ab0
cmpq 0x5eeb7(%rip), %r12     # 0x90838
jne 0x319a7
testq %r12, %r12
je 0x31ab0
movq 0x5ee9d(%rip), %rsi     # 0x90830
movq (%rbp), %rdi
movq %r12, %rdx
callq 0x275f0
testl %eax, %eax
je 0x31ab0
cmpq 0x5eeaa(%rip), %r12     # 0x90858
jne 0x319d4
testq %r12, %r12
je 0x31ab0
movq 0x5ee90(%rip), %rsi     # 0x90850
movq (%rbp), %rdi
movq %r12, %rdx
callq 0x275f0
testl %eax, %eax
je 0x31ab0
cmpq 0x5ee9d(%rip), %r12     # 0x90878
jne 0x31a01
testq %r12, %r12
je 0x31ab0
movq 0x5ee83(%rip), %rsi     # 0x90870
movq (%rbp), %rdi
movq %r12, %rdx
callq 0x275f0
testl %eax, %eax
je 0x31ab0
cmpq 0x5ee90(%rip), %r12     # 0x90898
jne 0x31a2e
testq %r12, %r12
je 0x31ab0
movq 0x5ee76(%rip), %rsi     # 0x90890
movq (%rbp), %rdi
movq %r12, %rdx
callq 0x275f0
testl %eax, %eax
je 0x31ab0
cmpq 0x5ee83(%rip), %r12     # 0x908b8
jne 0x31a53
testq %r12, %r12
je 0x31ab0
movq 0x5ee6d(%rip), %rsi     # 0x908b0
movq (%rbp), %rdi
movq %r12, %rdx
callq 0x275f0
testl %eax, %eax
je 0x31ab0
cmpq 0x5ee7e(%rip), %r12     # 0x908d8
jne 0x31a78
testq %r12, %r12
je 0x31ab0
movq 0x5ee68(%rip), %rsi     # 0x908d0
movq (%rbp), %rdi
movq %r12, %rdx
callq 0x275f0
testl %eax, %eax
je 0x31ab0
cmpq 0x5ee79(%rip), %r12     # 0x908f8
jne 0x31a9d
testq %r12, %r12
je 0x31ab0
movq 0x5ee63(%rip), %rsi     # 0x908f0
movq (%rbp), %rdi
movq %r12, %rdx
callq 0x275f0
testl %eax, %eax
je 0x31ab0
movq %rbp, %rdi
leaq 0x5ee69(%rip), %rsi     # 0x90910
callq 0x2e3bb
testb %al, %al
je 0x31afd
movq %r15, %rdi
movq %r14, %r12
movq %r14, %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdx
callq 0x370ac
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq %rbp, %rdx
movq %r12, %rcx
movq %r14, %r8
callq 0x37510
movq %rbx, %rdi
callq 0x276d0
movq %rax, %rbx
cmpq 0x30(%rsp), %rax
sete %r13b
jne 0x318b7
jmp 0x31d12
movq %rbp, %rdi
leaq 0x5ec89(%rip), %rsi     # 0x90790
callq 0x2e3bb
movq %r14, %r12
testb %al, %al
jne 0x31b4c
movq %rbp, %rdi
leaq 0x5ee13(%rip), %rsi     # 0x90930
callq 0x2e3bb
testb %al, %al
jne 0x31b4c
movq %rbp, %rdi
leaq 0x5ee40(%rip), %rsi     # 0x90970
callq 0x2e3bb
testb %al, %al
jne 0x31b4c
movq %rbp, %rdi
leaq 0x5ee8d(%rip), %rsi     # 0x909d0
callq 0x2e3bb
testb %al, %al
je 0x31b80
movq %r15, %rdi
leaq 0x2c(%rsp), %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdx
callq 0x3789a
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq %rbp, %rdx
leaq 0x2c(%rsp), %rcx
movq %r14, %r8
callq 0x37cfc
jmp 0x31ade
movq %rbp, %rdi
leaq 0x5edc6(%rip), %rsi     # 0x90950
callq 0x2e3bb
testb %al, %al
je 0x31bc7
movq %r15, %rdi
leaq 0xc(%rsp), %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdx
callq 0x38082
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq %rbp, %rdx
leaq 0xc(%rsp), %rcx
movq %r14, %r8
callq 0x384e6
jmp 0x31ade
movq %rbp, %rdi
leaq 0x5eb7f(%rip), %rsi     # 0x90750
callq 0x2e3bb
testb %al, %al
je 0x31c0e
movq %r15, %rdi
leaq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdx
callq 0x38870
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq %rbp, %rdx
leaq 0x28(%rsp), %rcx
movq %r14, %r8
callq 0x38cd2
jmp 0x31ade
movq %rbp, %rdi
leaq 0x5eb58(%rip), %rsi     # 0x90770
callq 0x2e3bb
testb %al, %al
jne 0x31c6d
movq %rbp, %rdi
leaq 0x5ed65(%rip), %rsi     # 0x90990
callq 0x2e3bb
testb %al, %al
jne 0x31c6d
movq %rbp, %rdi
leaq 0x5ed72(%rip), %rsi     # 0x909b0
callq 0x2e3bb
testb %al, %al
jne 0x31c6d
movq %rbp, %rdi
leaq 0x5ed9f(%rip), %rsi     # 0x909f0
callq 0x2e3bb
testb %al, %al
jne 0x31c6d
movq %rbp, %rdi
leaq 0x5edac(%rip), %rsi     # 0x90a10
callq 0x2e3bb
testb %al, %al
je 0x31ca1
movq %r15, %rdi
leaq 0x38(%rsp), %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdx
callq 0x39058
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq %rbp, %rdx
leaq 0x38(%rsp), %rcx
movq %r14, %r8
callq 0x394dc
jmp 0x31ade
movq %rbp, %rdi
leaq 0x5ed85(%rip), %rsi     # 0x90a30
callq 0x2e3bb
testb %al, %al
je 0x31cde
movl $0x2, 0x24(%rsp)
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq %rbp, %rdx
movq %r15, %rcx
leaq 0x24(%rsp), %r8
callq 0x394dc
movq %r14, %r12
jmp 0x31ade
movq 0x5e2fb(%rip), %rdi     # 0x8ffe0
leaq 0x40fda(%rip), %rsi     # 0x72cc6
movl $0x2a, %edx
callq 0x276c0
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq 0x5e2db(%rip), %rdi     # 0x8ffe0
callq 0x276c0
movq %rax, %rdi
callq 0x27310
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x31d26
callq 0x27560
andb $0x1, %r13b
movl %r13d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x31d40
jmp 0x31d40
movq %rax, %rbx
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x31d57
callq 0x27560
movq %rbx, %rdi
callq 0x27b20
nop