// File: /workspace/github_cpp_makefile_star2_O1/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 0x4e91(%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 0x5ed4
testl %eax, %eax
jne 0x5f57
movq %rbx, %rdi
callq 0x5b96
movq %r15, %rdi
callq 0x5e5a
movq %rax, %r13
cmpl $0x1, 0x8(%r15)
je 0x5f0b
jmp 0x5f69
movq (%r15), %rdi
movq %r12, %rsi
callq 0x695e
movq %rax, %rbp
movq (%r15), %rax
addq $0x8, %rax
cmpq %rax, %rbp
je 0x5fb0
movl $0x28, %edi
callq 0x32d0
movq %rax, %r13
movq 0x40(%rbp), %rsi
movq %rax, %rdi
callq 0x641a
movq %rbx, %rdi
callq 0x5b96
cmpl $0x3, (%rbx)
jne 0x5f31
movq 0x10(%r15), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x33d0
movq %rax, 0x20(%r13)
movq %rbx, %rdi
callq 0x5b96
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 0x5ea6
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 0x5f81
movq (%r13), %rax
movq %r13, %rdi
callq *0x8(%rax)
leaq 0x38(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x2273(%rip), %rsi      # 0x8204
leaq 0x22d4(%rip), %rdx      # 0x826c
leaq 0x28(%rsp), %r14
movq %r14, %rdi
callq 0x68c6
movq %rbx, %rdi
movq %r14, %rsi
callq 0x610c
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
leaq 0x2408(%rip), %rsi      # 0x83c8
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movq %r12, %rdx
callq 0x659a
leaq 0x2299(%rip), %rsi      # 0x8270
movq %r14, %rdi
callq 0x34b0
leaq 0x48(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x3500
movq %rbx, %rdi
movq %r14, %rsi
callq 0x610c
movq %rax, %rbx
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6022
movq 0x58(%rsp), %rax
leaq 0x4(,%rax,4), %rsi
callq 0x32f0
jmp 0x6022
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6063
movq 0x18(%rsp), %rax
jmp 0x6056
movq %rax, %rbx
movl $0x28, %esi
movq %r13, %rdi
jmp 0x605e
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x6063
movq 0x38(%rsp), %rax
leaq 0x4(,%rax,4), %rsi
callq 0x32f0
movq %rbx, %rdi
callq 0x3480
movq %rax, %rbx
cmpl $0x1, %edx
jne 0x6063
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 0x4ce6
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 0x3500
leaq 0x4c25(%rip), %rsi      # 0xacf0
leaq 0x4a8(%rip), %rdx       # 0x657a
movq %rbx, %rdi
callq 0x3440
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x60f9
movq 0x18(%rsp), %rax
leaq 0x4(,%rax,4), %rsi
callq 0x32f0
callq 0x3410
jmp 0x6063
movq %rax, %rdi
callq 0x4be7
nop