// File: /workspace/github_cpp_makefile_star2_O3/princelab[P]emass/parser.cpp
// Function: Parser::parse()
Parser::ElementListNode * Parser::parse()
{
  Parser::ElementListNode * inner;
  Parser::ElementListNode * outer = new Parser::ElementListNode();
  while(_tokenizer._ttype == LPAREN ||
	_tokenizer._ttype == ELEMENT) {
    if(_tokenizer._ttype == LPAREN) {
      try {
	_tokenizer.get_token();
      } catch (Parser::Error e) {
	delete outer;
	throw e;
      }
      inner = parse();
      if(_tokenizer._ttype != RPAREN) {
	delete outer;
	delete inner;
	_tokenizer.error(L"Expected right parenthesis");
      }
    } else {
      ElemMap::const_iterator i = _elements.find(_tokenizer._tval);
      if(i != _elements.end())
	inner = new ElementListNode((*i).second);
      else {
	delete outer;
	_tokenizer.error(L"\'" + _tokenizer._tval + L"\' is not an element");
      }
    }
    _tokenizer.get_token();
    if(_tokenizer._ttype == NUM) {
      inner->set_count(wcstol(_tokenizer._tval.c_str(), NULL, 0));
      _tokenizer.get_token();
    }
    outer->append(inner);
  }
  return outer;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %r15
movl $0x28, %edi
callq 0x32d0
movq %rax, %r14
leaq 0x4dd9(%rip), %rax      # 0xad10
movq %rax, (%r14)
leaq 0x8(%r14), %rax
movq %rax, 0x10(%r14)
movq %rax, 0x8(%r14)
movq $0x0, 0x18(%r14)
movq $0x1, 0x20(%r14)
leaq 0x8(%r15), %rbx
leaq 0x10(%r15), %r12
movl (%rbx), %eax
cmpl $0x4, %eax
je 0x5f8c
testl %eax, %eax
jne 0x600f
movq %rbx, %rdi
callq 0x5b7a
movq %r15, %rdi
callq 0x5f12
movq %rax, %r13
cmpl $0x1, 0x8(%r15)
je 0x5fc3
jmp 0x6021
movq (%r15), %rdi
movq %r12, %rsi
callq 0x6a1a
movq %rax, %rbp
movq (%r15), %rax
addq $0x8, %rax
cmpq %rax, %rbp
je 0x6068
movl $0x28, %edi
callq 0x32d0
movq %rax, %r13
movq 0x40(%rbp), %rsi
movq %rax, %rdi
callq 0x64ce
movq %rbx, %rdi
callq 0x5b7a
cmpl $0x3, (%rbx)
jne 0x5fe9
movq (%r12), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x33c0
movq %rax, 0x20(%r13)
movq %rbx, %rdi
callq 0x5b7a
movq 0x8(%r14), %rbp
movl $0x18, %edi
callq 0x32d0
movq %r13, 0x10(%rax)
movq %rax, %rdi
movq %rbp, %rsi
callq 0x3060
incq 0x18(%r14)
jmp 0x5f5e
movq %r14, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
testq %r13, %r13
je 0x6039
movq (%r13), %rax
movq %r13, %rdi
callq *0x8(%rax)
leaq 0x38(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x21cb(%rip), %rsi      # 0x8214
leaq 0x222c(%rip), %rdx      # 0x827c
leaq 0x28(%rsp), %r14
movq %r14, %rdi
callq 0x697a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x61c4
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
leaq 0x2360(%rip), %rsi      # 0x83d8
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movq %r12, %rdx
callq 0x664e
leaq 0x21f1(%rip), %rsi      # 0x8280
movq %r14, %rdi
callq 0x34a0
leaq 0x48(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x34f0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x61c4
movq %rax, %rbx
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x60da
movq 0x58(%rsp), %rax
leaq 0x4(,%rax,4), %rsi
callq 0x32f0
jmp 0x60da
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x611b
movq 0x18(%rsp), %rax
jmp 0x610e
movq %rax, %rbx
movl $0x28, %esi
movq %r13, %rdi
jmp 0x6116
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x611b
movq 0x38(%rsp), %rax
leaq 0x4(,%rax,4), %rsi
callq 0x32f0
movq %rbx, %rdi
callq 0x3470
movq %rax, %rbx
cmpl $0x1, %edx
jne 0x611b
movq %rbx, %rdi
callq 0x3370
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rsi
movq 0x8(%rax), %rax
leaq (%rsi,%rax,4), %rdx
leaq 0x8(%rsp), %rdi
callq 0x4cd2
movq %rbx, %rdi
callq 0x3100
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
movl $0x20, %edi
callq 0x3130
movq %rax, %rbx
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x34f0
leaq 0x4b6d(%rip), %rsi      # 0xacf0
leaq 0x4a4(%rip), %rdx       # 0x662e
movq %rbx, %rdi
callq 0x3430
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x61b1
movq 0x18(%rsp), %rax
leaq 0x4(,%rax,4), %rsi
callq 0x32f0
callq 0x3400
jmp 0x611b
movq %rax, %rdi
callq 0x4bd3
nop