// File: /workspace/github_cpp_makefile_star2_O2/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, %r14
leaq 0x38(%rdi), %r15
movq 0x68(%r14), %rax
cmpq 0x48(%r14), %rax
je 0x46095
movq %r15, %rdi
callq 0x4b128
jmp 0x46081
cmpq $0x0, 0x8(%r14)
je 0x46264
movq 0x20(%r14), %rax
movq %rax, 0x28(%r14)
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x88(%r14), %r12
movq %r14, %rdi
movq %rsp, %rsi
callq 0x4690a
cmpq $0x0, 0x10(%rsp)
setne %cl
testb %cl, %al
je 0x46218
movl (%rsp), %eax
testl %eax, %eax
je 0x4618e
cmpl $0x3, %eax
ja 0x461a0
movq 0xb8(%r14), %rbp
cmpq 0x98(%r14), %rbp
je 0x46208
cmpq 0xc0(%r14), %rbp
jne 0x46120
movq 0xd0(%r14), %rax
movq -0x8(%rax), %rbp
movl $0x1e0, %eax            # imm = 0x1E0
addq %rax, %rbp
leaq -0x28(%rbp), %rbx
movl (%rsp), %eax
leal -0x5(%rax), %ecx
cmpl $-0x3, %ecx
ja 0x4614a
movq %rsp, %rdi
callq 0x46a56
movl %eax, %r13d
movq %rbx, %rdi
callq 0x46a56
cmpl %eax, %r13d
jle 0x46172
movl (%rsp), %eax
addl $-0x3, %eax
cmpl $0x1, %eax
ja 0x46208
movq %rsp, %rdi
callq 0x46a56
movl %eax, %r13d
movq %rbx, %rdi
callq 0x46a56
cmpl %eax, %r13d
jge 0x46208
addq $-0x20, %rbp
movq %r15, %rdi
movq %rbp, %rsi
callq 0x46aa0
movq %r12, %rdi
callq 0x46cbc
jmp 0x460f0
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
callq 0x46aa0
jmp 0x460c0
cmpl $0x4, %eax
je 0x46208
cmpl $0x5, %eax
jne 0x460c0
xorl %ebx, %ebx
movq 0xb8(%r14), %rsi
cmpq 0x98(%r14), %rsi
je 0x460c0
testb $0x1, %bl
jne 0x460c0
cmpq 0xc0(%r14), %rsi
jne 0x461e9
movq 0xd0(%r14), %rax
movq -0x8(%rax), %rsi
movl $0x1e0, %eax            # imm = 0x1E0
addq %rax, %rsi
cmpl $0x4, -0x28(%rsi)
sete %bl
je 0x461fe
addq $-0x20, %rsi
movq %r15, %rdi
callq 0x46aa0
movq %r12, %rdi
callq 0x46cbc
jmp 0x461b0
movq %r12, %rdi
movq %rsp, %rsi
callq 0x46d26
jmp 0x460c0
movl $0x1e0, %ebx            # imm = 0x1E0
movq 0xb8(%r14), %rsi
cmpq 0x98(%r14), %rsi
je 0x4625a
cmpq 0xc0(%r14), %rsi
jne 0x46244
movq 0xd0(%r14), %rax
movq -0x8(%rax), %rsi
addq %rbx, %rsi
addq $-0x20, %rsi
movq %r15, %rdi
callq 0x46aa0
movq %r12, %rdi
callq 0x46cbc
jmp 0x4621d
leaq 0x8(%rsp), %rdi
callq 0x35730
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x46279
jmp 0x46279
jmp 0x46279
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x35730
movq %rbx, %rdi
callq 0x35b50
movq %rax, %rdi
callq 0x3a198