// File: /workspace/github_cpp_makefile_star2_O3/zeeev[P]DASVC/bamtools/src/utils/bamtools_filter_ruleparser.h
// Function: BamTools::RuleParser::parse()
inline
void RuleParser::parse(void) {
  
    // clear out any prior data
    while ( !m_ruleQueue.empty() ) 
        m_ruleQueue.pop();
    
    // skip if no rule to parse
    if ( m_ruleString.empty() ) return;
  
    // start at beginning of ruleString
    m_current = m_begin;
    
    // iterate through tokens in rule string
    RuleToken token;
    while ( readToken(token) ) {
      
        if ( token.Value.empty() ) break;
      
        // if token is an operand
        if ( isOperand(token) )
            m_ruleQueue.push(token.Value);

        // if token is an operator 
        else if ( isOperator(token) ) {

            // pop any operators at top of stack with higher priority
            while ( !m_operatorStack.empty() ) {
                const RuleToken& opToken = m_operatorStack.top();
                if ( (isLeftAssociative(token) && (priority(token) <= priority(opToken))) ||
                     (isRightAssociative(token) && (priority(token) < priority(opToken))) 
                    )
                {
                    m_ruleQueue.push(opToken.Value);
                    m_operatorStack.pop();
                }
                else break;
            }
            
            // push current operator token onto stack
            m_operatorStack.push(token);
        }
        
        // if token is left parenthesis
        else if ( isLeftParenthesis(token) )
            m_operatorStack.push(token);
        
        // if token is right parenthesis
        else if ( isRightParenthesis(token) ) {
          
            bool foundLeftParenthesis = false;
          
            // push operators into rule queue until left parenthesis found
            while ( !m_operatorStack.empty() && !foundLeftParenthesis ) {
                const RuleToken& opToken = m_operatorStack.top();
                if ( !isLeftParenthesis(opToken) )
                    m_ruleQueue.push(opToken.Value);
                else 
                    foundLeftParenthesis = true;
                m_operatorStack.pop();
            }
          
            // no left parenthesis found, error
            BAMTOOLS_ASSERT_MESSAGE( foundLeftParenthesis, "ERROR: Mismatched parenthesis in rule string.1");
        }
        
        // error: unknown operand
        else BAMTOOLS_ASSERT_UNREACHABLE;
    }    
    
    // while there are still operators on stack
    while ( !m_operatorStack.empty() ) {
        const RuleToken& token = m_operatorStack.top();
        BAMTOOLS_ASSERT_MESSAGE( (!isLeftParenthesis(token) && !isRightParenthesis(token)), "ERROR: Mismatched parenthesis in rule string.2");
        m_ruleQueue.push(token.Value);
        m_operatorStack.pop();
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0x38(%rdi), %r14
movq 0x68(%rdi), %rax
cmpq 0x48(%rdi), %rax
je 0x3cd1d
movq %r14, %rdi
callq 0x4246a
movq 0x68(%rbx), %rax
cmpq 0x48(%rbx), %rax
jne 0x3cd0b
cmpq $0x0, 0x8(%rbx)
je 0x3cf05
movq 0x20(%rbx), %rax
movq %rax, 0x28(%rbx)
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x88(%rbx), %r15
movq %rsp, %r13
movl $0x1e0, %ebp            # imm = 0x1E0
movq %rbx, %rdi
movq %r13, %rsi
callq 0x3d570
cmpq $0x0, 0x10(%rsp)
setne %cl
testb %cl, %al
je 0x3ceae
movl (%rsp), %eax
testl %eax, %eax
je 0x3ce26
cmpl $0x3, %eax
ja 0x3ce38
movq 0xb8(%rbx), %rsi
cmpq 0x98(%rbx), %rsi
je 0x3ce9e
cmpq 0xc0(%rbx), %rsi
jne 0x3cdae
movq 0xd0(%rbx), %rax
movq -0x8(%rax), %rsi
addq %rbp, %rsi
movl (%rsp), %eax
leal -0x5(%rax), %ecx
cmpl $-0x3, %ecx
ja 0x3cdf5
decl %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmpl $0x4, %eax
ja 0x3cdd6
movl %eax, %eax
leaq 0x35a2d(%rip), %rdx     # 0x72800
movl (%rdx,%rax,4), %edx
movl -0x28(%rsi), %eax
decl %eax
cmpl $0x4, %eax
ja 0x3cdec
movl %eax, %eax
leaq 0x35923(%rip), %rcx     # 0x7270c
movl (%rcx,%rax,4), %ecx
cmpl %ecx, %edx
jle 0x3ce0d
jmp 0x3ce9e
movl -0x28(%rsi), %ecx
addl $-0x4, %ecx
cmpl $-0x3, %ecx
jb 0x3ce9e
cmpl $0x3, %eax
je 0x3ce9e
addq $-0x20, %rsi
movq %r14, %rdi
callq 0x3d704
movq %r15, %rdi
callq 0x3d9a0
jmp 0x3cd83
movq %r14, %rdi
leaq 0x8(%rsp), %rsi
callq 0x3d704
jmp 0x3cd53
cmpl $0x4, %eax
je 0x3ce9e
cmpl $0x5, %eax
jne 0x3cd53
xorl %r12d, %r12d
movq 0xb8(%rbx), %rsi
cmpq 0x98(%rbx), %rsi
je 0x3cd53
testb $0x1, %r12b
jne 0x3cd53
cmpq 0xc0(%rbx), %rsi
jne 0x3ce7e
movq 0xd0(%rbx), %rax
movq -0x8(%rax), %rsi
addq %rbp, %rsi
cmpl $0x4, -0x28(%rsi)
sete %r12b
je 0x3ce94
addq $-0x20, %rsi
movq %r14, %rdi
callq 0x3d704
movq %r15, %rdi
callq 0x3d9a0
jmp 0x3ce49
movq %r15, %rdi
movq %r13, %rsi
callq 0x3da1a
jmp 0x3cd53
movl $0x1e0, %r12d           # imm = 0x1E0
movq 0xb8(%rbx), %rsi
cmpq 0x98(%rbx), %rsi
je 0x3cef1
cmpq 0xc0(%rbx), %rsi
jne 0x3cedb
movq 0xd0(%rbx), %rax
movq -0x8(%rax), %rsi
addq %r12, %rsi
addq $-0x20, %rsi
movq %r14, %rdi
callq 0x3d704
movq %r15, %rdi
callq 0x3d9a0
jmp 0x3ceb4
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3cf05
callq 0x27560
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3cf1a
jmp 0x3cf1a
jmp 0x3cf1a
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3cf31
callq 0x27560
movq %rbx, %rdi
callq 0x27b10
nop