// File: 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:
subq $0xe8, %rsp
movq %rdi, 0xd8(%rsp)
movq %rsi, 0xd0(%rsp)
movq %rdx, 0xc8(%rsp)
movq 0xd8(%rsp), %rax
movq %rax, 0x48(%rsp)
leaq 0x98(%rsp), %rdi
callq 0x86a30
movq 0xc8(%rsp), %rdi
callq 0xa28f0
movq %rax, 0x50(%rsp)
jmp 0x9a05d
movq 0x50(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0xc8(%rsp), %rdi
callq 0xa2920
movq %rax, 0x40(%rsp)
jmp 0x9a07e
movq 0x40(%rsp), %rax
movq %rax, 0x70(%rsp)
leaq 0x88(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0xa2950
movb %al, 0x3f(%rsp)
jmp 0x9a0a0
movb 0x3f(%rsp), %al
testb $0x1, %al
jne 0x9a0ad
jmp 0x9a676
leaq 0x88(%rsp), %rdi
callq 0xa2970
movq %rax, 0x30(%rsp)
jmp 0x9a0c1
movq 0x30(%rsp), %rax
movq %rax, 0x68(%rsp)
leaq 0x88(%rsp), %rdi
callq 0xa2970
movq %rax, 0x28(%rsp)
jmp 0x9a0df
movq 0x28(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x60(%rsp)
movq 0x68(%rsp), %rdi
leaq 0xcb83f(%rip), %rsi     # 0x165938
callq 0x91630
movb %al, 0x27(%rsp)
jmp 0x9a104
movb 0x27(%rsp), %al
testb $0x1, %al
jne 0x9a299
jmp 0x9a112
movq 0x68(%rsp), %rdi
leaq 0xcb83a(%rip), %rsi     # 0x165958
callq 0x91630
movb %al, 0x26(%rsp)
jmp 0x9a129
movb 0x26(%rsp), %al
testb $0x1, %al
jne 0x9a299
jmp 0x9a137
movq 0x68(%rsp), %rdi
leaq 0xcb835(%rip), %rsi     # 0x165978
callq 0x91630
movb %al, 0x25(%rsp)
jmp 0x9a14e
movb 0x25(%rsp), %al
testb $0x1, %al
jne 0x9a299
jmp 0x9a15c
movq 0x68(%rsp), %rdi
leaq 0xcb830(%rip), %rsi     # 0x165998
callq 0x91630
movb %al, 0x24(%rsp)
jmp 0x9a173
movb 0x24(%rsp), %al
testb $0x1, %al
jne 0x9a299
jmp 0x9a181
movq 0x68(%rsp), %rdi
leaq 0xcb82b(%rip), %rsi     # 0x1659b8
callq 0x91630
movb %al, 0x23(%rsp)
jmp 0x9a198
movb 0x23(%rsp), %al
testb $0x1, %al
jne 0x9a299
jmp 0x9a1a6
movq 0x68(%rsp), %rdi
leaq 0xcb826(%rip), %rsi     # 0x1659d8
callq 0x91630
movb %al, 0x22(%rsp)
jmp 0x9a1bd
movb 0x22(%rsp), %al
testb $0x1, %al
jne 0x9a299
jmp 0x9a1cb
movq 0x68(%rsp), %rdi
leaq 0xcb821(%rip), %rsi     # 0x1659f8
callq 0x91630
movb %al, 0x21(%rsp)
jmp 0x9a1e2
movb 0x21(%rsp), %al
testb $0x1, %al
jne 0x9a299
jmp 0x9a1f0
movq 0x68(%rsp), %rdi
leaq 0xcb81c(%rip), %rsi     # 0x165a18
callq 0x91630
movb %al, 0x20(%rsp)
jmp 0x9a207
movb 0x20(%rsp), %al
testb $0x1, %al
jne 0x9a299
jmp 0x9a215
movq 0x68(%rsp), %rdi
leaq 0xcb817(%rip), %rsi     # 0x165a38
callq 0x91630
movb %al, 0x1f(%rsp)
jmp 0x9a22c
movb 0x1f(%rsp), %al
testb $0x1, %al
jne 0x9a299
jmp 0x9a236
movq 0x68(%rsp), %rdi
leaq 0xcb816(%rip), %rsi     # 0x165a58
callq 0x91630
movb %al, 0x1e(%rsp)
jmp 0x9a24d
movb 0x1e(%rsp), %al
testb $0x1, %al
jne 0x9a299
jmp 0x9a257
movq 0x68(%rsp), %rdi
leaq 0xcb815(%rip), %rsi     # 0x165a78
callq 0x91630
movb %al, 0x1d(%rsp)
jmp 0x9a26e
movb 0x1d(%rsp), %al
testb $0x1, %al
jne 0x9a299
jmp 0x9a278
movq 0x68(%rsp), %rdi
leaq 0xcb814(%rip), %rsi     # 0x165a98
callq 0x91630
movb %al, 0x1c(%rsp)
jmp 0x9a28f
movb 0x1c(%rsp), %al
testb $0x1, %al
jne 0x9a299
jmp 0x9a30a
movq 0x60(%rsp), %rdi
leaq 0xc7(%rsp), %rsi
leaq 0x94(%rsp), %rdx
callq 0xa2990
jmp 0x9a2b5
movq 0x48(%rsp), %rdi
addq $0x20, %rdi
movq 0xd0(%rsp), %rsi
movq 0x68(%rsp), %rdx
leaq 0xc7(%rsp), %rcx
leaq 0x94(%rsp), %r8
callq 0xa32f0
jmp 0x9a2e2
jmp 0x9a660
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x80(%rsp)
movl %eax, 0x7c(%rsp)
leaq 0x98(%rsp), %rdi
callq 0x86f68
jmp 0x9a6a4
movq 0x68(%rsp), %rdi
leaq 0xcb602(%rip), %rsi     # 0x165918
callq 0x91630
movb %al, 0x1b(%rsp)
jmp 0x9a321
movb 0x1b(%rsp), %al
testb $0x1, %al
jne 0x9a38e
jmp 0x9a32b
movq 0x68(%rsp), %rdi
leaq 0xcb781(%rip), %rsi     # 0x165ab8
callq 0x91630
movb %al, 0x1a(%rsp)
jmp 0x9a342
movb 0x1a(%rsp), %al
testb $0x1, %al
jne 0x9a38e
jmp 0x9a34c
movq 0x68(%rsp), %rdi
leaq 0xcb7a0(%rip), %rsi     # 0x165af8
callq 0x91630
movb %al, 0x19(%rsp)
jmp 0x9a363
movb 0x19(%rsp), %al
testb $0x1, %al
jne 0x9a38e
jmp 0x9a36d
movq 0x68(%rsp), %rdi
leaq 0xcb7df(%rip), %rsi     # 0x165b58
callq 0x91630
movb %al, 0x18(%rsp)
jmp 0x9a384
movb 0x18(%rsp), %al
testb $0x1, %al
jne 0x9a38e
jmp 0x9a3dc
movq 0x60(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
leaq 0x94(%rsp), %rdx
callq 0xa37e0
jmp 0x9a3aa
movq 0x48(%rsp), %rdi
addq $0x20, %rdi
movq 0xd0(%rsp), %rsi
movq 0x68(%rsp), %rdx
leaq 0xc0(%rsp), %rcx
leaq 0x94(%rsp), %r8
callq 0xa4140
jmp 0x9a3d7
jmp 0x9a65e
movq 0x68(%rsp), %rdi
leaq 0xcb6f0(%rip), %rsi     # 0x165ad8
callq 0x91630
movb %al, 0x17(%rsp)
jmp 0x9a3f3
movb 0x17(%rsp), %al
testb $0x1, %al
jne 0x9a3fd
jmp 0x9a44b
movq 0x60(%rsp), %rdi
leaq 0xbe(%rsp), %rsi
leaq 0x94(%rsp), %rdx
callq 0xa4630
jmp 0x9a419
movq 0x48(%rsp), %rdi
addq $0x20, %rdi
movq 0xd0(%rsp), %rsi
movq 0x68(%rsp), %rdx
leaq 0xbe(%rsp), %rcx
leaq 0x94(%rsp), %r8
callq 0xa4f80
jmp 0x9a446
jmp 0x9a65c
movq 0x68(%rsp), %rdi
leaq 0xcb481(%rip), %rsi     # 0x1658d8
callq 0x91630
movb %al, 0x16(%rsp)
jmp 0x9a462
movb 0x16(%rsp), %al
testb $0x1, %al
jne 0x9a46c
jmp 0x9a4ba
movq 0x60(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
leaq 0x94(%rsp), %rdx
callq 0xa5470
jmp 0x9a488
movq 0x48(%rsp), %rdi
addq $0x20, %rdi
movq 0xd0(%rsp), %rsi
movq 0x68(%rsp), %rdx
leaq 0xb8(%rsp), %rcx
leaq 0x94(%rsp), %r8
callq 0xa5dc0
jmp 0x9a4b5
jmp 0x9a65a
movq 0x68(%rsp), %rdi
leaq 0xcb432(%rip), %rsi     # 0x1658f8
callq 0x91630
movb %al, 0x15(%rsp)
jmp 0x9a4d1
movb 0x15(%rsp), %al
testb $0x1, %al
jne 0x9a563
jmp 0x9a4df
movq 0x68(%rsp), %rdi
leaq 0xcb62d(%rip), %rsi     # 0x165b18
callq 0x91630
movb %al, 0x14(%rsp)
jmp 0x9a4f6
movb 0x14(%rsp), %al
testb $0x1, %al
jne 0x9a563
jmp 0x9a500
movq 0x68(%rsp), %rdi
leaq 0xcb62c(%rip), %rsi     # 0x165b38
callq 0x91630
movb %al, 0x13(%rsp)
jmp 0x9a517
movb 0x13(%rsp), %al
testb $0x1, %al
jne 0x9a563
jmp 0x9a521
movq 0x68(%rsp), %rdi
leaq 0xcb64b(%rip), %rsi     # 0x165b78
callq 0x91630
movb %al, 0x12(%rsp)
jmp 0x9a538
movb 0x12(%rsp), %al
testb $0x1, %al
jne 0x9a563
jmp 0x9a542
movq 0x68(%rsp), %rdi
leaq 0xcb64a(%rip), %rsi     # 0x165b98
callq 0x91630
movb %al, 0x11(%rsp)
jmp 0x9a559
movb 0x11(%rsp), %al
testb $0x1, %al
jne 0x9a563
jmp 0x9a5b1
movq 0x60(%rsp), %rdi
leaq 0x98(%rsp), %rsi
leaq 0x94(%rsp), %rdx
callq 0xa62b0
jmp 0x9a57f
movq 0x48(%rsp), %rdi
addq $0x20, %rdi
movq 0xd0(%rsp), %rsi
movq 0x68(%rsp), %rdx
leaq 0x98(%rsp), %rcx
leaq 0x94(%rsp), %r8
callq 0xa6c50
jmp 0x9a5ac
jmp 0x9a658
movq 0x68(%rsp), %rdi
leaq 0xcb5fb(%rip), %rsi     # 0x165bb8
callq 0x91630
movb %al, 0x10(%rsp)
jmp 0x9a5c8
movb 0x10(%rsp), %al
testb $0x1, %al
jne 0x9a5d2
jmp 0x9a603
movq 0x48(%rsp), %rdi
addq $0x20, %rdi
movq 0xd0(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq 0x60(%rsp), %rcx
movl $0x2, 0x5c(%rsp)
leaq 0x5c(%rsp), %r8
callq 0xa6c50
jmp 0x9a601
jmp 0x9a656
movq 0xca9d6(%rip), %rdi     # 0x164fe0
leaq 0x94e8a(%rip), %rsi     # 0x12f49b
callq 0x86700
movq %rax, 0x8(%rsp)
jmp 0x9a61d
movq 0x8(%rsp), %rdi
movq 0x68(%rsp), %rsi
callq 0x86640
movq %rax, (%rsp)
jmp 0x9a632
movq (%rsp), %rdi
movq 0xca933(%rip), %rsi     # 0x164f70
callq 0x86770
jmp 0x9a644
movb $0x0, 0xe7(%rsp)
movl $0x1, 0x58(%rsp)
jmp 0x9a686
jmp 0x9a658
jmp 0x9a65a
jmp 0x9a65c
jmp 0x9a65e
jmp 0x9a660
jmp 0x9a662
leaq 0x88(%rsp), %rdi
callq 0xa71d0
jmp 0x9a671
jmp 0x9a088
movb $0x1, 0xe7(%rsp)
movl $0x1, 0x58(%rsp)
leaq 0x98(%rsp), %rdi
callq 0x86f68
movb 0xe7(%rsp), %al
andb $0x1, %al
addq $0xe8, %rsp
retq
jmp 0x9a6a6
movq 0x80(%rsp), %rdi
callq 0x86d80
movq %rax, %rdi
callq 0x91290
nopl (%rax,%rax)