// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/utils/bamtools_filter_engine.h
// Function: bool BamTools::FilterEngine<BamTools::BamAlignmentChecker>::evaluateFilterRules<BamTools::BamAlignment>(BamTools::BamAlignment const&)
bool FilterEngine<FilterChecker>::evaluateFilterRules(const T& query) {
  
    // build ruleQueue if not done before
    if ( !m_isRuleQueueGenerated ) 
        buildRuleQueue();
    
    std::stack<bool> resultStack;
    FilterMap::const_iterator filterIter;
    std::queue<std::string> ruleQueueCopy = m_ruleQueue;
    while ( !ruleQueueCopy.empty() ) {
        const std::string& token = ruleQueueCopy.front();
        
        // token is NOT_OPERATOR
        if ( token == FilterEngine<FilterChecker>::NOT_OPERATOR ) {
            BAMTOOLS_ASSERT_MESSAGE( !resultStack.empty(), "Empty result stack - cannot apply operator: !" );
            resultStack.top() = !resultStack.top();
        }
        
        // token is AND_OPERATOR
        else if ( token == FilterEngine<FilterChecker>::AND_OPERATOR ) {
            BAMTOOLS_ASSERT_MESSAGE( resultStack.size() >= 2 , "Not enough operands - cannot apply operator: &" );
            bool topResult = resultStack.top();
            resultStack.pop();
            resultStack.top() &= topResult;
        }
        
        // token is OR_OPERATOR
        else if ( token == FilterEngine<FilterChecker>::OR_OPERATOR ) {
            BAMTOOLS_ASSERT_MESSAGE( resultStack.size() >= 2 , "Not enough operands - cannot apply operator: |" );
            bool topResult = resultStack.top();
            resultStack.pop();
            resultStack.top() |= topResult;
        }
        
        // token is an operand 
        else {
            // look up PropertyFilter that matches this token 
            filterIter = m_filters.find(token);
            BAMTOOLS_ASSERT_MESSAGE( (filterIter != m_filters.end() ), "Filter mentioned in rule, not found in FilterEngine" );
            const PropertyFilter& filter = (*filterIter).second;
            bool result = m_checker.check(filter, query);
            resultStack.push( result );
        }
        
        // pop token from ruleQueue
        ruleQueueCopy.pop();
    }
    
    // return last result
    BAMTOOLS_ASSERT_MESSAGE( resultStack.size() == 1, "Result stack should only have one value remaining - cannot return result" );
    return resultStack.top();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x0, 0xb8(%rdi)
jne 0x3c066
movq %r14, %rdi
callq 0x3c396
xorps %xmm0, %xmm0
leaq 0x60(%rsp), %r15
movaps %xmm0, 0x40(%r15)
movaps %xmm0, 0x30(%r15)
movaps %xmm0, 0x20(%r15)
movaps %xmm0, 0x10(%r15)
movaps %xmm0, (%r15)
movq %r15, %rdi
xorl %esi, %esi
callq 0x3f8ee
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x3fa58
leaq 0x60(%rsp), %rdi
callq 0x3fb4a
leaq 0x68(%r14), %rsi
leaq 0x60(%rsp), %rdi
callq 0x3aa7a
leaq 0xc0(%r14), %r15
leaq 0x60(%rsp), %r12
movq 0x70(%rsp), %r13
cmpq %r13, 0x90(%rsp)
je 0x3c312
movq 0x8(%r13), %rbp
cmpq 0x110(%r14), %rbp
jne 0x3c105
testq %rbp, %rbp
je 0x3c1a5
movq 0x108(%r14), %rsi
movq (%r13), %rdi
movq %rbp, %rdx
callq 0x275f0
testl %eax, %eax
je 0x3c1a5
cmpq 0xd0(%r14), %rbp
jne 0x3c132
testq %rbp, %rbp
je 0x3c1ec
movq 0xc8(%r14), %rsi
movq (%r13), %rdi
movq %rbp, %rdx
callq 0x275f0
testl %eax, %eax
je 0x3c1ec
cmpq 0xf0(%r14), %rbp
jne 0x3c15f
testq %rbp, %rbp
je 0x3c21d
movq 0xe8(%r14), %rsi
movq (%r13), %rdi
movq %rbp, %rdx
callq 0x275f0
testl %eax, %eax
je 0x3c21d
movq %r14, %rdi
movq %r13, %rsi
callq 0x3b0c0
addq $0x40, %rax
movq %r15, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x3c472
movb %al, 0xf(%rsp)
movq 0x40(%rsp), %rcx
movq 0x50(%rsp), %rdx
decq %rdx
cmpq %rdx, %rcx
je 0x3c251
movb %al, (%rcx)
incq %rcx
movq %rcx, 0x40(%rsp)
jmp 0x3c305
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %rdx
movq %rax, %rcx
cmpq %rdx, %rax
jne 0x3c1c8
movq 0x58(%rsp), %rcx
movq -0x8(%rcx), %rcx
movl $0x200, %esi            # imm = 0x200
addq %rsi, %rcx
cmpq %rdx, %rax
jne 0x3c1de
movq 0x58(%rsp), %rax
movq -0x8(%rax), %rax
movl $0x200, %edx            # imm = 0x200
addq %rdx, %rax
movb -0x1(%rcx), %cl
xorb $0x1, %cl
movb %cl, -0x1(%rax)
jmp 0x3c305
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %rdi
movq %rax, %rcx
cmpq %rdi, %rax
jne 0x3c20f
movq 0x58(%rsp), %rcx
movq -0x8(%rcx), %rcx
movl $0x200, %edx            # imm = 0x200
addq %rdx, %rcx
movb -0x1(%rcx), %bpl
cmpq %rdi, %rax
je 0x3c265
decq %rax
jmp 0x3c293
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %rdi
movq %rax, %rcx
cmpq %rdi, %rax
jne 0x3c240
movq 0x58(%rsp), %rcx
movq -0x8(%rcx), %rcx
movl $0x200, %edx            # imm = 0x200
addq %rdx, %rcx
movb -0x1(%rcx), %bpl
cmpq %rdi, %rax
je 0x3c2b6
decq %rax
jmp 0x3c2e4
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rsi
callq 0x4233e
jmp 0x3c305
callq 0x27560
movq 0x58(%rsp), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x58(%rsp)
movq -0x8(%rax), %rax
movq %rax, 0x48(%rsp)
leaq 0x200(%rax), %rcx
movq %rcx, 0x50(%rsp)
addq $0x1ff, %rax            # imm = 0x1FF
movq %rax, 0x40(%rsp)
cmpq 0x48(%rsp), %rax
jne 0x3c2b0
movq 0x58(%rsp), %rax
movq -0x8(%rax), %rax
movl $0x200, %ecx            # imm = 0x200
addq %rcx, %rax
andb %bpl, -0x1(%rax)
jmp 0x3c305
callq 0x27560
movq 0x58(%rsp), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x58(%rsp)
movq -0x8(%rax), %rax
movq %rax, 0x48(%rsp)
leaq 0x200(%rax), %rcx
movq %rcx, 0x50(%rsp)
addq $0x1ff, %rax            # imm = 0x1FF
movq %rax, 0x40(%rsp)
cmpq 0x48(%rsp), %rax
jne 0x3c301
movq 0x58(%rsp), %rax
movq -0x8(%rax), %rax
movl $0x200, %ecx            # imm = 0x200
addq %rcx, %rax
orb %bpl, -0x1(%rax)
movq %r12, %rdi
callq 0x4252a
jmp 0x3c0c1
movq 0x40(%rsp), %rax
cmpq 0x48(%rsp), %rax
jne 0x3c32c
movq 0x58(%rsp), %rcx
movl $0x200, %eax            # imm = 0x200
addq -0x8(%rcx), %rax
movb -0x1(%rax), %bl
leaq 0x60(%rsp), %rdi
callq 0x3a86c
leaq 0x10(%rsp), %rdi
callq 0x3fb4a
movl %ebx, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x3fb4a
jmp 0x3c386
movq %rax, %rbx
jmp 0x3c37c
jmp 0x3c36f
jmp 0x3c36f
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x3a86c
leaq 0x10(%rsp), %rdi
callq 0x3fb4a
movq %rbx, %rdi
callq 0x27b20
movq %rax, %rdi
callq 0x2e1ed