// File: /workspace/github_cpp_makefile_star2_O1/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 0x3cd8f
movq %r14, %rdi
callq 0x4252a
movq 0x68(%rbx), %rax
cmpq 0x48(%rbx), %rax
jne 0x3cd7d
cmpq $0x0, 0x8(%rbx)
je 0x3cf98
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
leaq 0x36948(%rip), %r12     # 0x7370c
movq %rbx, %rdi
movq %rsp, %rsi
callq 0x3d5f6
cmpq $0x0, 0x10(%rsp)
setne %cl
testb %cl, %al
je 0x3cf41
movl (%rsp), %eax
testl %eax, %eax
je 0x3ceaf
cmpl $0x3, %eax
ja 0x3cec1
movq 0xb8(%rbx), %rsi
cmpq 0x98(%rbx), %rsi
je 0x3cf31
cmpq 0xc0(%rbx), %rsi
jne 0x3ce24
movq 0xd0(%rbx), %rax
movq -0x8(%rax), %rsi
movl $0x1e0, %eax            # imm = 0x1E0
addq %rax, %rsi
movl (%rsp), %eax
leal -0x5(%rax), %ecx
cmpl $-0x3, %ecx
ja 0x3ce5b
leal -0x1(%rax), %edi
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmpl $0x4, %edi
ja 0x3ce47
movl %edi, %edx
movl (%r12,%rdx,4), %edx
movl -0x28(%rsi), %edi
decl %edi
cmpl $0x4, %edi
ja 0x3ce57
movl %edi, %ecx
movl (%r12,%rcx,4), %ecx
cmpl %ecx, %edx
jle 0x3ce96
leal -0x3(%rax), %ecx
cmpl $0x1, %ecx
ja 0x3cf31
decl %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmpl $0x4, %eax
ja 0x3ce7e
movl %eax, %eax
movl (%r12,%rax,4), %edx
movl -0x28(%rsi), %eax
decl %eax
cmpl $0x4, %eax
ja 0x3ce8e
movl %eax, %eax
movl (%r12,%rax,4), %ecx
cmpl %ecx, %edx
jge 0x3cf31
addq $-0x20, %rsi
movq %r14, %rdi
callq 0x3d7d0
movq %r15, %rdi
callq 0x3da6c
jmp 0x3cdf4
movq %r14, %rdi
leaq 0x8(%rsp), %rsi
callq 0x3d7d0
jmp 0x3cdc4
cmpl $0x4, %eax
je 0x3cf31
cmpl $0x5, %eax
jne 0x3cdc4
xorl %r13d, %r13d
movq 0xb8(%rbx), %rsi
cmpq 0x98(%rbx), %rsi
je 0x3cdc4
testb $0x1, %r13b
jne 0x3cdc4
cmpq 0xc0(%rbx), %rsi
jne 0x3cf0c
movq 0xd0(%rbx), %rax
movq -0x8(%rax), %rsi
movl $0x1e0, %eax            # imm = 0x1E0
addq %rax, %rsi
movb $0x1, %bpl
cmpl $0x4, -0x28(%rsi)
je 0x3cf24
addq $-0x20, %rsi
movq %r14, %rdi
callq 0x3d7d0
movl %r13d, %ebp
movq %r15, %rdi
callq 0x3da6c
movl %ebp, %r13d
jmp 0x3ced2
movq %r15, %rdi
movq %rsp, %rsi
callq 0x3dae6
jmp 0x3cdc4
movl $0x1e0, %r12d           # imm = 0x1E0
movq 0xb8(%rbx), %rsi
cmpq 0x98(%rbx), %rsi
je 0x3cf84
cmpq 0xc0(%rbx), %rsi
jne 0x3cf6e
movq 0xd0(%rbx), %rax
movq -0x8(%rax), %rsi
addq %r12, %rsi
addq $-0x20, %rsi
movq %r14, %rdi
callq 0x3d7d0
movq %r15, %rdi
callq 0x3da6c
jmp 0x3cf47
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3cf98
callq 0x27560
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3cfad
jmp 0x3cfad
jmp 0x3cfad
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3cfc4
callq 0x27560
movq %rbx, %rdi
callq 0x27b20