// File: /workspace/github_cpp_makefile_star2_O2/rfotino[P]consolite-compiler/src/syntax.cpp
// Function: CompoundStatement::parse(Tokenizer*, std::vector<std::shared_ptr<FunctionToken>, std::allocator<std::shared_ptr<FunctionToken>>> const&, std::vector<std::shared_ptr<GlobalVarToken>, std::allocator<std::shared_ptr<GlobalVarToken>>> const&, std::vector<std::shared_ptr<ParamToken>, std::allocator<std::shared_ptr<ParamToken>>> const&, std::vector<std::shared_ptr<LocalVarToken>, std::allocator<std::shared_ptr<LocalVarToken>>> const&, std::vector<std::shared_ptr<LabelStatement>, std::allocator<std::shared_ptr<LabelStatement>>>&, std::vector<std::shared_ptr<GotoStatement>, std::allocator<std::shared_ptr<GotoStatement>>>&, std::shared_ptr<FunctionToken> const&, bool)
bool CompoundStatement::parse(
      Tokenizer *tokenizer,
      const std::vector<std::shared_ptr<FunctionToken>>& functions,
      const std::vector<std::shared_ptr<GlobalVarToken>>& globals,
      const std::vector<std::shared_ptr<ParamToken>>& parameters,
      const std::vector<std::shared_ptr<LocalVarToken>>& localVars,
      std::vector<std::shared_ptr<LabelStatement>>& labels,
      std::vector<std::shared_ptr<GotoStatement>>& gotos,
      const std::shared_ptr<FunctionToken>& currentFunc,
      bool inLoop) {
  _lineNum = tokenizer->peekNext().line();
  // Make sure the first token is a '{'.
  if (!_expect(tokenizer, "{")) {
    return false;
  }
  // Get the inner statements.
  while ("}" != tokenizer->peekNext().str()) {
    auto statement = StatementToken::parse(tokenizer, functions, globals,
                                           parameters, localVars, labels,
                                           gotos, currentFunc, inLoop);
    if (!statement) {
      return false;
    }
    // Local variables are only allowed as top level statements in
    // a function.
    if (std::dynamic_pointer_cast<LocalVarToken>(statement)) {
      _error("Local variables can only be declared as top level "
             "statements in a function.", statement->line());
      return false;
    }
    _statements.push_back(statement);
  }
  // Consume the final '}' token.
  tokenizer->getNext();
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %r9, 0x50(%rsp)
movq %r8, 0x48(%rsp)
movq %rcx, 0x40(%rsp)
movq %rdx, 0x38(%rsp)
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x279a6
movl 0x8(%r15), %eax
movl %eax, 0x8(%rbx)
movq %r15, %rdi
callq 0x7b20
leaq 0x14d01(%rip), %rsi     # 0x299d3
leaq 0x8(%rsp), %rdi
leaq 0x58(%rsp), %rdx
callq 0x9502
leaq 0x8(%rsp), %rsi
pushq $0x1
popq %rdx
movq %r14, %rdi
callq 0x286c3
movl %eax, %r15d
leaq 0x8(%rsp), %rdi
callq 0x75c8
testb %r15b, %r15b
je 0x14e32
addq $0x10, %rbx
leaq 0x8(%rsp), %r15
leaq 0x58(%rsp), %r12
movzbl 0xf8(%rsp), %ebp
movq %r15, %rdi
movq %r14, %rsi
callq 0x279a6
movq %r12, %rdi
leaq 0x18(%rsp), %rsi
callq 0x73e0
leaq 0x14c99(%rip), %rdi     # 0x299d5
movq %r12, %rsi
callq 0x9976
movl %eax, %r13d
movq %r12, %rdi
callq 0x75c8
movq %r15, %rdi
callq 0x7b20
testb %r13b, %r13b
je 0x14dda
movq %r12, %rdi
movq %r14, %rsi
movq 0x38(%rsp), %rdx
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %r8
movq 0x50(%rsp), %r9
pushq %rbp
pushq 0xf8(%rsp)
pushq 0xf8(%rsp)
pushq 0xf8(%rsp)
callq 0x136f2
addq $0x20, %rsp
cmpq $0x0, 0x58(%rsp)
je 0x14e28
movq %r15, %rdi
movq %r12, %rsi
callq 0x1887c
movq 0x8(%rsp), %r13
leaq 0x10(%rsp), %rdi
callq 0x7a34
testq %r13, %r13
jne 0x14df6
movq %rbx, %rdi
movq %r12, %rsi
callq 0x188d2
leaq 0x60(%rsp), %rdi
callq 0x7a34
jmp 0x14d1d
leaq 0x78(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2772c
movq %rbx, %rdi
callq 0x7b20
movb $0x1, %al
jmp 0x14e34
leaq 0x14fca(%rip), %rsi     # 0x29dc7
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x9502
movq 0x58(%rsp), %rax
movl 0x8(%rax), %esi
leaq 0x8(%rsp), %rdi
callq 0x285f3
leaq 0x8(%rsp), %rdi
callq 0x75c8
leaq 0x60(%rsp), %rdi
callq 0x7a34
xorl %eax, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x75c8
jmp 0x14e6e
jmp 0x14e6b
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x75c8
jmp 0x14e87
movq %rax, %rbx
jmp 0x14e87
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x7a34
jmp 0x14e87
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x7b20
movq %rbx, %rdi
callq 0x7510
nop