// File: /workspace/github_cpp_makefile_star2_O3/princelab[P]emass/parser.cpp
// Function: Parser::Tokenizer::get_token()
void Parser::Tokenizer::get_token()
{
  States s = START;
  _last = _i;
  for(;;)
    {
      wchar_t c = _input[_i];
      switch(s) {
      case START:
	if(iswspace(c)) {
	  ; // skip whitespace
	} else if(iswdigit(c) || c == L'-') {
	  _ttype = NUM;	
	  _tval = c;
	  s = NUMBER;
	} else if(iswupper(c)) {
	  _ttype = ELEMENT;
	  _tval = c;
	  s = ALPHA;
	} else if(c == L'[') {
	  _ttype = ELEMENT;
	  _tval = L"";
	  s = LITERAL;
	} else if(c == L'(') {
	  _ttype = LPAREN;
	  s = STOP;
	} else if(c == L')') {
	  _ttype = RPAREN;
	  s = STOP;
	} else if(c == L'%') {
	  _ttype = EOS;
	  s = END;
	} else {
	  error(L"Parse error");
	}
	break;
      case ALPHA:
	if(iswlower(c)) {
	  _tval += c;
	} else {
	  return; // we're done
	}
	break;
      case LITERAL:
	if(c == L'%') {
	  error(L"Missing left bracket");
	} else if(c != L']') {
	  _tval += c;
	} else {
	  ++_i; // skip the ']'
	  return; // we're done
	}	
	break;
      case NUMBER:
	if(iswdigit(c)) {
	  _tval += c;
	} else {
	  return; // we're done
	}
	break;
      case END:
	if(_input.find(ENDTOKEN) == _i - 1) {
	  s = STOP;
	} else {
	  error(L"Illegal character: \'%\'");
	}
	break;
      case STOP:
	return; // exit
      }
      ++_i;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x60, %rsp
movq %rdi, %rbx
movq 0x28(%rdi), %rax
movq %rax, 0x30(%rdi)
leaq 0x38(%rdi), %r14
leaq 0x8(%rdi), %r15
xorl %ecx, %ecx
movq (%r14), %rdx
movl (%rdx,%rax,4), %ebp
movl %ecx, %ecx
leaq 0x25de(%rip), %r12      # 0x8188
movslq (%r12,%rcx,4), %rcx
addq %r12, %rcx
jmpq *%rcx
movl %ebp, %edi
callq 0x31f0
testl %eax, %eax
jne 0x5d35
movl %ebp, %edi
callq 0x3500
testl %eax, %eax
setne %al
cmpl $0x2d, %ebp
sete %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x5c18
movl $0x3, (%rbx)
movq 0x10(%rbx), %rdx
movl $0x1, %ecx
movq %r15, %rdi
xorl %esi, %esi
movl %ebp, %r8d
callq 0x3280
movl $0x3, %ecx
movq 0x28(%rbx), %rax
incq %rax
movq %rax, 0x28(%rbx)
movq (%r14), %rdx
movl (%rdx,%rax,4), %ebp
movl %ecx, %ecx
movslq (%r12,%rcx,4), %rcx
addq %r12, %rcx
jmpq *%rcx
movl %ebp, %edi
callq 0x3410
testl %eax, %eax
je 0x5c60
movl $0x4, (%rbx)
movq 0x10(%rbx), %rdx
movl $0x1, %ecx
movq %r15, %rdi
xorl %esi, %esi
movl %ebp, %r8d
callq 0x3280
movl $0x1, %ecx
movq 0x28(%rbx), %rax
incq %rax
movq %rax, 0x28(%rbx)
movq (%r14), %rdx
movl (%rdx,%rax,4), %ebp
movl %ecx, %ecx
movslq (%r12,%rcx,4), %rcx
addq %r12, %rcx
jmpq *%rcx
cmpl $0x28, %ebp
jg 0x5c9a
cmpl $0x25, %ebp
je 0x5ce7
cmpl $0x28, %ebp
jne 0x5d39
movl $0x0, (%rbx)
movl $0x5, %ecx
movq 0x28(%rbx), %rax
incq %rax
movq %rax, 0x28(%rbx)
movq (%r14), %rdx
movl (%rdx,%rax,4), %ebp
movl %ecx, %ecx
movslq (%r12,%rcx,4), %rcx
addq %r12, %rcx
jmpq *%rcx
cmpl $0x29, %ebp
je 0x5d0e
cmpl $0x5b, %ebp
jne 0x5d39
movl $0x4, (%rbx)
movq 0x10(%rbx), %rdx
leaq 0x2637(%rip), %rcx      # 0x82f0
movq %r15, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x3490
movl $0x2, %ecx
movq 0x28(%rbx), %rax
incq %rax
movq %rax, 0x28(%rbx)
movq (%r14), %rdx
movl (%rdx,%rax,4), %ebp
movl %ecx, %ecx
movslq (%r12,%rcx,4), %rcx
addq %r12, %rcx
jmpq *%rcx
movl $0x2, (%rbx)
movl $0x4, %ecx
movq 0x28(%rbx), %rax
incq %rax
movq %rax, 0x28(%rbx)
movq (%r14), %rdx
movl (%rdx,%rax,4), %ebp
movl %ecx, %ecx
movslq (%r12,%rcx,4), %rcx
addq %r12, %rcx
jmpq *%rcx
movl $0x1, (%rbx)
movl $0x5, %ecx
movq 0x28(%rbx), %rax
incq %rax
movq %rax, 0x28(%rbx)
movq (%r14), %rdx
movl (%rdx,%rax,4), %ebp
movl %ecx, %ecx
movslq (%r12,%rcx,4), %rcx
addq %r12, %rcx
jmpq *%rcx
xorl %ecx, %ecx
jmp 0x5d72
leaq 0x50(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x25b7(%rip), %rsi      # 0x8300
leaq 0x25dc(%rip), %rdx      # 0x832c
leaq 0x40(%rsp), %r14
movq %r14, %rdi
callq 0x697a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x61c4
movq %rax, %rbx
movq 0x40(%rsp), %rdi
jmp 0x5d8e
movq 0x28(%rbx), %rax
incq %rax
movq %rax, 0x28(%rbx)
movq (%r14), %rdx
movl (%rdx,%rax,4), %ebp
movl %ecx, %ecx
movslq (%r12,%rcx,4), %rcx
addq %r12, %rcx
jmpq *%rcx
cmpq %r15, %rdi
je 0x5da3
movq (%r15), %rax
leaq 0x4(,%rax,4), %rsi
callq 0x32f0
movq %rbx, %rdi
callq 0x3470
movl %ebp, %edi
callq 0x34c0
testl %eax, %eax
je 0x5ebd
movq %r15, %rdi
movl %ebp, %esi
callq 0x30f0
movl $0x1, %ecx
movq 0x28(%rbx), %rax
incq %rax
movq %rax, 0x28(%rbx)
movq (%r14), %rdx
movl (%rdx,%rax,4), %ebp
movl %ecx, %ecx
movslq (%r12,%rcx,4), %rcx
addq %r12, %rcx
jmpq *%rcx
cmpl $0x5d, %ebp
je 0x5eb6
cmpl $0x25, %ebp
je 0x5eca
movq %r15, %rdi
movl %ebp, %esi
callq 0x30f0
movl $0x2, %ecx
movq 0x28(%rbx), %rax
incq %rax
movq %rax, 0x28(%rbx)
movq (%r14), %rdx
movl (%rdx,%rax,4), %ebp
movl %ecx, %ecx
movslq (%r12,%rcx,4), %rcx
addq %r12, %rcx
jmpq *%rcx
movl %ebp, %edi
callq 0x3500
testl %eax, %eax
je 0x5ebd
movq %r15, %rdi
movl %ebp, %esi
callq 0x30f0
movl $0x3, %ecx
movq 0x28(%rbx), %rax
incq %rax
movq %rax, 0x28(%rbx)
movq (%r14), %rdx
movl (%rdx,%rax,4), %ebp
movl %ecx, %ecx
movslq (%r12,%rcx,4), %rcx
addq %r12, %rcx
jmpq *%rcx
movq 0x550d(%rip), %rsi      # 0xb370
movq 0x550e(%rip), %rcx      # 0xb378
movq %r14, %rdi
xorl %edx, %edx
callq 0x3460
movq 0x28(%rbx), %rdx
decq %rdx
movl $0x5, %ecx
cmpq %rdx, %rax
je 0x5d72
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x24eb(%rip), %rsi      # 0x8384
leaq 0x253c(%rip), %rdx      # 0x83dc
movq %rsp, %r14
movq %r14, %rdi
callq 0x697a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x61c4
incq %rax
movq %rax, 0x28(%rbx)
addq $0x60, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x2456(%rip), %rsi      # 0x8330
leaq 0x249f(%rip), %rdx      # 0x8380
leaq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0x697a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x61c4
movq %rax, %rbx
movq (%rsp), %rdi
jmp 0x5d8e
movq %rax, %rbx
movq 0x20(%rsp), %rdi
jmp 0x5d8e