// File: /workspace/github_cpp_makefile_star2_O3/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, %r15
movq %rsi, 0x10(%rsp)
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x18(%rdx), %r14
addq $0x8, %r15
movb $0x1, %bl
cmpq %r15, %r14
je 0x31cb9
addq $0x20, %rdi
movq %rdi, 0x8(%rsp)
leaq 0x7(%rsp), %r12
movq %r12, %r13
leaq 0x20(%r14), %rbp
leaq 0x40(%r14), %rbx
movq 0x28(%r14), %r12
cmpq 0x5deff(%rip), %r12     # 0x8f7b0
jne 0x318d7
testq %r12, %r12
je 0x31a94
movq 0x5dee5(%rip), %rsi     # 0x8f7a8
movq (%rbp), %rdi
movq %r12, %rdx
callq 0x275f0
testl %eax, %eax
je 0x31a94
cmpq 0x5def2(%rip), %r12     # 0x8f7d0
jne 0x31904
testq %r12, %r12
je 0x31a94
movq 0x5ded8(%rip), %rsi     # 0x8f7c8
movq (%rbp), %rdi
movq %r12, %rdx
callq 0x275f0
testl %eax, %eax
je 0x31a94
cmpq 0x5dee5(%rip), %r12     # 0x8f7f0
jne 0x31931
testq %r12, %r12
je 0x31a94
movq 0x5decb(%rip), %rsi     # 0x8f7e8
movq (%rbp), %rdi
movq %r12, %rdx
callq 0x275f0
testl %eax, %eax
je 0x31a94
cmpq 0x5ded8(%rip), %r12     # 0x8f810
jne 0x3195e
testq %r12, %r12
je 0x31a94
movq 0x5debe(%rip), %rsi     # 0x8f808
movq (%rbp), %rdi
movq %r12, %rdx
callq 0x275f0
testl %eax, %eax
je 0x31a94
cmpq 0x5decb(%rip), %r12     # 0x8f830
jne 0x3198b
testq %r12, %r12
je 0x31a94
movq 0x5deb1(%rip), %rsi     # 0x8f828
movq (%rbp), %rdi
movq %r12, %rdx
callq 0x275f0
testl %eax, %eax
je 0x31a94
cmpq 0x5debe(%rip), %r12     # 0x8f850
jne 0x319b8
testq %r12, %r12
je 0x31a94
movq 0x5dea4(%rip), %rsi     # 0x8f848
movq (%rbp), %rdi
movq %r12, %rdx
callq 0x275f0
testl %eax, %eax
je 0x31a94
cmpq 0x5deb1(%rip), %r12     # 0x8f870
jne 0x319e5
testq %r12, %r12
je 0x31a94
movq 0x5de97(%rip), %rsi     # 0x8f868
movq (%rbp), %rdi
movq %r12, %rdx
callq 0x275f0
testl %eax, %eax
je 0x31a94
cmpq 0x5dea4(%rip), %r12     # 0x8f890
jne 0x31a12
testq %r12, %r12
je 0x31a94
movq 0x5de8a(%rip), %rsi     # 0x8f888
movq (%rbp), %rdi
movq %r12, %rdx
callq 0x275f0
testl %eax, %eax
je 0x31a94
cmpq 0x5de97(%rip), %r12     # 0x8f8b0
jne 0x31a37
testq %r12, %r12
je 0x31a94
movq 0x5de81(%rip), %rsi     # 0x8f8a8
movq (%rbp), %rdi
movq %r12, %rdx
callq 0x275f0
testl %eax, %eax
je 0x31a94
cmpq 0x5de92(%rip), %r12     # 0x8f8d0
jne 0x31a5c
testq %r12, %r12
je 0x31a94
movq 0x5de7c(%rip), %rsi     # 0x8f8c8
movq (%rbp), %rdi
movq %r12, %rdx
callq 0x275f0
testl %eax, %eax
je 0x31a94
cmpq 0x5de8d(%rip), %r12     # 0x8f8f0
jne 0x31a81
testq %r12, %r12
je 0x31a94
movq 0x5de77(%rip), %rsi     # 0x8f8e8
movq (%rbp), %rdi
movq %r12, %rdx
callq 0x275f0
testl %eax, %eax
je 0x31a94
movq %rbp, %rdi
leaq 0x5de7d(%rip), %rsi     # 0x8f908
callq 0x2e3c3
testb %al, %al
je 0x31ad9
movq %rbx, %rdi
movq %r13, %r12
movq %r13, %rsi
movq %rsp, %rbx
movq %rbx, %rdx
callq 0x37074
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %rbp, %rdx
movq %r12, %rcx
movq %rbx, %r8
callq 0x374d0
movq %r14, %rdi
callq 0x276c0
movq %rax, %r14
cmpq %r15, %rax
jne 0x3189b
jmp 0x31cb2
movq %rbp, %rdi
leaq 0x5dca5(%rip), %rsi     # 0x8f788
callq 0x2e3c3
movq %r13, %r12
testb %al, %al
jne 0x31b28
movq %rbp, %rdi
leaq 0x5de2f(%rip), %rsi     # 0x8f928
callq 0x2e3c3
testb %al, %al
jne 0x31b28
movq %rbp, %rdi
leaq 0x5de5c(%rip), %rsi     # 0x8f968
callq 0x2e3c3
testb %al, %al
jne 0x31b28
movq %rbp, %rdi
leaq 0x5dea9(%rip), %rsi     # 0x8f9c8
callq 0x2e3c3
testb %al, %al
je 0x31b5a
movq %rbx, %rdi
leaq 0x24(%rsp), %rsi
movq %rsp, %rbx
movq %rbx, %rdx
callq 0x37856
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %rbp, %rdx
leaq 0x24(%rsp), %rcx
movq %rbx, %r8
callq 0x37cb0
jmp 0x31ac0
movq %rbp, %rdi
leaq 0x5dde4(%rip), %rsi     # 0x8f948
callq 0x2e3c3
testb %al, %al
je 0x31b9f
movq %rbx, %rdi
leaq 0x4(%rsp), %rsi
movq %rsp, %rbx
movq %rbx, %rdx
callq 0x38032
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %rbp, %rdx
leaq 0x4(%rsp), %rcx
movq %rbx, %r8
callq 0x3848e
jmp 0x31ac0
movq %rbp, %rdi
leaq 0x5db9f(%rip), %rsi     # 0x8f748
callq 0x2e3c3
testb %al, %al
je 0x31be4
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
movq %rsp, %rbx
movq %rbx, %rdx
callq 0x38814
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %rbp, %rdx
leaq 0x20(%rsp), %rcx
movq %rbx, %r8
callq 0x38c6e
jmp 0x31ac0
movq %rbp, %rdi
leaq 0x5db7a(%rip), %rsi     # 0x8f768
callq 0x2e3c3
testb %al, %al
jne 0x31c43
movq %rbp, %rdi
leaq 0x5dd87(%rip), %rsi     # 0x8f988
callq 0x2e3c3
testb %al, %al
jne 0x31c43
movq %rbp, %rdi
leaq 0x5dd94(%rip), %rsi     # 0x8f9a8
callq 0x2e3c3
testb %al, %al
jne 0x31c43
movq %rbp, %rdi
leaq 0x5ddc1(%rip), %rsi     # 0x8f9e8
callq 0x2e3c3
testb %al, %al
jne 0x31c43
movq %rbp, %rdi
leaq 0x5ddce(%rip), %rsi     # 0x8fa08
callq 0x2e3c3
testb %al, %al
je 0x31c75
movq %rbx, %rdi
leaq 0x28(%rsp), %rsi
movq %rsp, %rbx
movq %rbx, %rdx
callq 0x38ff0
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %rbp, %rdx
leaq 0x28(%rsp), %rcx
movq %rbx, %r8
callq 0x39474
jmp 0x31ac0
movq %rbp, %rdi
leaq 0x5dda9(%rip), %rsi     # 0x8fa28
callq 0x2e3c3
testb %al, %al
je 0x31cd9
movl $0x2, 0x1c(%rsp)
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %rbp, %rdx
movq %rbx, %rcx
leaq 0x1c(%rsp), %r8
callq 0x39474
movq %r13, %r12
jmp 0x31ac0
leaq 0x38(%rsp), %rax
movb $0x1, %bl
movq 0x28(%rsp), %rdi
cmpq %rax, %rdi
je 0x31cc8
callq 0x27560
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x5d300(%rip), %rdi     # 0x8efe0
leaq 0x3ffdf(%rip), %rsi     # 0x71cc6
movl $0x2a, %edx
callq 0x276b0
movq 0x20(%r14), %rsi
movq 0x28(%r14), %rdx
movq 0x5d2e0(%rip), %rdi     # 0x8efe0
callq 0x276b0
movq %rax, %rdi
callq 0x27310
xorl %ebx, %ebx
leaq 0x38(%rsp), %rax
jmp 0x31cb9
jmp 0x31d1a
jmp 0x31d1a
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x31d31
callq 0x27560
movq %rbx, %rdi
callq 0x27b10
nop