// File: /workspace/github_cpp_makefile_star2_O3/zeeev[P]DASVC/bamtools/src/utils/bamtools_filter_ruleparser.h
// Function: BamTools::RuleParser::readToken(BamTools::RuleToken&)
inline
bool RuleParser::readToken(RuleToken& token) {
  
    // skip any preceding whitespace
    skipSpaces();
    if ( m_current == m_end ) return false;

    // clear out prior token value
    token.Value.clear();
    
    // read chars while still in token
    char c = 1;
    bool keepReading = true;
    bool inOperandString = false;
    while ( keepReading && (c != 0) ) {
      
      // get next char
      c = getNextChar();
      switch (c) {
        
          // current char is '('
          case ( LEFT_PARENTHESIS_CHAR ) :
              token.Type = RuleToken::LEFT_PARENTHESIS;
              token.Value.append(1, LEFT_PARENTHESIS_CHAR);
              keepReading = false;
              break;
              
          // current char is ')'
          case ( RIGHT_PARENTHESIS_CHAR ) :
              if ( inOperandString )
                  --m_current;
              else {
                  token.Type = RuleToken::RIGHT_PARENTHESIS;
                  token.Value.append(1, RIGHT_PARENTHESIS_CHAR);
              }
              keepReading = false;
              break;
        
          // current char is '&'
          case ( AND_OPERATOR_CHAR ) :
              if ( inOperandString ) 
                  --m_current;
              else {
                  token.Type = RuleToken::AND_OPERATOR;
                  token.Value.append(1, AND_OPERATOR_CHAR);
              }
              keepReading = false;
              break;
              
          // current char is '|' 
          case ( OR_OPERATOR_CHAR ) :
              if ( inOperandString )
                  --m_current;
              else {  
                  token.Type = RuleToken::OR_OPERATOR;
                  token.Value.append(1, OR_OPERATOR_CHAR);
              }
              keepReading = false;
              break;
              
          // current char is '!'
          case ( NOT_OPERATOR_CHAR ) :
              token.Type = RuleToken::NOT_OPERATOR;
              token.Value.append(1, NOT_OPERATOR_CHAR);
              keepReading = false;
              break;
              
          // current char is ' '
          case ( SPACE_CHAR ) : 
              keepReading = false;
              break;
            
          // current char is a true value token
          default:
              if ( c != 0 ) {
                  token.Type = RuleToken::OPERAND;
                  token.Value.append(1, c);
                  inOperandString = true;
                  keepReading = true;
              }
        }         
    }
      
    return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq 0x28(%rdi), %rax
movq 0x30(%rdi), %rcx
cmpq %rcx, %rax
je 0x3d5b2
movq %rsi, %r15
movq %rdi, %r12
movabsq $0x100002600, %rdx      # imm = 0x100002600
movzbl (%rax), %esi
cmpq $0x20, %rsi
ja 0x3d5c0
btq %rsi, %rdx
jae 0x3d5c0
incq %rax
movq %rax, 0x28(%r12)
cmpq %rcx, %rax
jne 0x3d596
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
cmpq %rcx, %rax
setne %bl
je 0x3d5b2
movq $0x0, 0x10(%r15)
movq 0x8(%r15), %rax
movb $0x0, (%rax)
movq 0x28(%r12), %rax
cmpq 0x30(%r12), %rax
je 0x3d5b4
leaq 0x8(%r15), %r14
xorl %ecx, %ecx
leaq 0x34574(%rip), %r13     # 0x71b64
leaq 0x1(%rax), %rdx
movq %rdx, 0x28(%r12)
movb (%rax), %dl
movzbl %dl, %esi
leal -0x20(%rsi), %edi
cmpl $0x9, %edi
ja 0x3d610
movslq (%r13,%rdi,4), %rsi
addq %r13, %rsi
jmpq *%rsi
testl %esi, %esi
je 0x3d5b4
cmpl $0x7c, %esi
je 0x3d6cf
movl $0x0, (%r15)
movq 0x10(%r15), %rsi
movsbl %dl, %r8d
movl $0x1, %ecx
movq %r14, %rdi
xorl %edx, %edx
callq 0x27bc0
movq 0x28(%r12), %rax
movb $0x1, %cl
cmpq 0x30(%r12), %rax
jne 0x3d5f0
jmp 0x3d5b4
movl $0x4, (%r15)
movq 0x10(%r15), %rsi
movl $0x1, %ecx
movq %r14, %rdi
xorl %edx, %edx
movl $0x28, %r8d
jmp 0x3d6f9
testb $0x1, %cl
jne 0x3d6d4
movl $0x1, (%r15)
movq 0x10(%r15), %rsi
movl $0x1, %ecx
movq %r14, %rdi
xorl %edx, %edx
movl $0x26, %r8d
jmp 0x3d6f9
testb $0x1, %cl
jne 0x3d6d4
movl $0x5, (%r15)
movq 0x10(%r15), %rsi
movl $0x1, %ecx
movq %r14, %rdi
xorl %edx, %edx
movl $0x29, %r8d
jmp 0x3d6f9
movl $0x3, (%r15)
movq 0x10(%r15), %rsi
movl $0x1, %ecx
movq %r14, %rdi
xorl %edx, %edx
movl $0x21, %r8d
jmp 0x3d6f9
testb $0x1, %cl
je 0x3d6de
movq %rax, 0x28(%r12)
jmp 0x3d5b4
movl $0x2, (%r15)
movq 0x10(%r15), %rsi
movl $0x1, %ecx
movq %r14, %rdi
xorl %edx, %edx
movl $0x7c, %r8d
callq 0x27bc0
jmp 0x3d5b4
nop