// File: /workspace/github_cpp_makefile_star2_O2/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 $0x48, %rsp
movq %rdx, %rbx
movq %rsi, 0x10(%rsp)
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rdi, %r12
movb $0x0, (%rax)
movq 0x18(%rdx), %r14
addq $0x8, %rbx
addq $0x20, %r12
leaq 0x24(%rsp), %r13
cmpq %rbx, %r14
je 0x3d237
leaq 0x20(%r14), %r15
movq %r15, %rdi
leaq 0x588be(%rip), %rsi     # 0x957e8
callq 0x3a2a9
leaq 0x40(%r14), %rbp
testb %al, %al
jne 0x3d01c
movq %r15, %rdi
leaq 0x588c3(%rip), %rsi     # 0x95808
callq 0x3a2a9
testb %al, %al
jne 0x3d01c
movq %r15, %rdi
leaq 0x588cc(%rip), %rsi     # 0x95828
callq 0x3a2a9
testb %al, %al
jne 0x3d01c
movq %r15, %rdi
leaq 0x588d5(%rip), %rsi     # 0x95848
callq 0x3a2a9
testb %al, %al
jne 0x3d01c
movq %r15, %rdi
leaq 0x588de(%rip), %rsi     # 0x95868
callq 0x3a2a9
testb %al, %al
jne 0x3d01c
movq %r15, %rdi
leaq 0x588e7(%rip), %rsi     # 0x95888
callq 0x3a2a9
testb %al, %al
jne 0x3d01c
movq %r15, %rdi
leaq 0x588f4(%rip), %rsi     # 0x958a8
callq 0x3a2a9
testb %al, %al
jne 0x3d01c
movq %r15, %rdi
leaq 0x58901(%rip), %rsi     # 0x958c8
callq 0x3a2a9
testb %al, %al
jne 0x3d01c
movq %r15, %rdi
leaq 0x5890e(%rip), %rsi     # 0x958e8
callq 0x3a2a9
testb %al, %al
jne 0x3d01c
movq %r15, %rdi
leaq 0x5891b(%rip), %rsi     # 0x95908
callq 0x3a2a9
testb %al, %al
jne 0x3d01c
movq %r15, %rdi
leaq 0x58928(%rip), %rsi     # 0x95928
callq 0x3a2a9
testb %al, %al
jne 0x3d01c
movq %r15, %rdi
leaq 0x58935(%rip), %rsi     # 0x95948
callq 0x3a2a9
testb %al, %al
je 0x3d054
movq %rbp, %rdi
leaq 0xd(%rsp), %rsi
movq %r13, %rdx
callq 0x41270
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq %r15, %rdx
leaq 0xd(%rsp), %rcx
movq %r13, %r8
callq 0x416b4
movq %r14, %rdi
callq 0x356b0
movq %rax, %r14
jmp 0x3cf13
movq %r15, %rdi
leaq 0x5876a(%rip), %rsi     # 0x957c8
callq 0x3a2a9
testb %al, %al
jne 0x3d0a0
movq %r15, %rdi
leaq 0x588f7(%rip), %rsi     # 0x95968
callq 0x3a2a9
testb %al, %al
jne 0x3d0a0
movq %r15, %rdi
leaq 0x58924(%rip), %rsi     # 0x959a8
callq 0x3a2a9
testb %al, %al
jne 0x3d0a0
movq %r15, %rdi
leaq 0x58971(%rip), %rsi     # 0x95a08
callq 0x3a2a9
testb %al, %al
je 0x3d0cd
movq %rbp, %rdi
leaq 0x20(%rsp), %rsi
movq %r13, %rdx
callq 0x418d0
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq %r15, %rdx
leaq 0x20(%rsp), %rcx
movq %r13, %r8
callq 0x41d14
jmp 0x3d044
movq %r15, %rdi
leaq 0x588b1(%rip), %rsi     # 0x95988
callq 0x3a2a9
testb %al, %al
je 0x3d10d
movq %rbp, %rdi
leaq 0xe(%rsp), %rsi
movq %r13, %rdx
callq 0x41f2e
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq %r15, %rdx
leaq 0xe(%rsp), %rcx
movq %r13, %r8
callq 0x42372
jmp 0x3d044
movq %r15, %rdi
leaq 0x58671(%rip), %rsi     # 0x95788
callq 0x3a2a9
testb %al, %al
je 0x3d14d
movq %rbp, %rdi
leaq 0x1c(%rsp), %rsi
movq %r13, %rdx
callq 0x4258e
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq %r15, %rdx
leaq 0x1c(%rsp), %rcx
movq %r13, %r8
callq 0x429d2
jmp 0x3d044
movq %r15, %rdi
leaq 0x58651(%rip), %rsi     # 0x957a8
callq 0x3a2a9
testb %al, %al
jne 0x3d1ac
movq %r15, %rdi
leaq 0x5885e(%rip), %rsi     # 0x959c8
callq 0x3a2a9
testb %al, %al
jne 0x3d1ac
movq %r15, %rdi
leaq 0x5886b(%rip), %rsi     # 0x959e8
callq 0x3a2a9
testb %al, %al
jne 0x3d1ac
movq %r15, %rdi
leaq 0x58898(%rip), %rsi     # 0x95a28
callq 0x3a2a9
testb %al, %al
jne 0x3d1ac
movq %r15, %rdi
leaq 0x588a5(%rip), %rsi     # 0x95a48
callq 0x3a2a9
testb %al, %al
je 0x3d1d9
movq %rbp, %rdi
leaq 0x28(%rsp), %rsi
movq %r13, %rdx
callq 0x42bec
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq %r15, %rdx
leaq 0x28(%rsp), %rcx
movq %r13, %r8
callq 0x4304e
jmp 0x3d044
movq %r15, %rdi
leaq 0x58885(%rip), %rsi     # 0x95a68
callq 0x3a2a9
testb %al, %al
je 0x3d211
movl $0x2, 0x18(%rsp)
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq %r15, %rdx
movq %rbp, %rcx
leaq 0x18(%rsp), %r8
callq 0x4304e
jmp 0x3d044
movq 0x57dc8(%rip), %rdi     # 0x94fe0
leaq 0x34a34(%rip), %rsi     # 0x71c53
callq 0x355b0
movq %rax, %rdi
movq %r15, %rsi
callq 0x35510
movq %rax, %rdi
callq 0x35300
cmpq %rbx, %r14
sete %bl
leaq 0x28(%rsp), %rdi
callq 0x35730
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3d25c
jmp 0x3d25c
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x35730
movq %rbx, %rdi
callq 0x35b50
movq %rax, %rdi
callq 0x3a198
nop