// File: /workspace/github_cpp_makefile_star2_O1/rfotino[P]consolite-compiler/src/syntax.cpp
// Function: ReturnStatement::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::shared_ptr<FunctionToken> const&)
bool ReturnStatement::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,
      const std::shared_ptr<FunctionToken>& currentFunc) {
  _lineNum = tokenizer->peekNext().line();
  // Make sure the first token is the "return" keyword.
  if (!_expect(tokenizer, "return")) {
    return false;
  }
  // If the next token is not a semicolon, parse the expression.
  if (";" != tokenizer->peekNext().str()) {
    _hasExpr = true;
    if (!_returnExpr.parse(tokenizer, functions, globals,
                           parameters, localVars)) {
      return false;
    }
  } else {
    _hasExpr = false;
  }
  // Check for the trailing semicolon.
  if (!_expect(tokenizer, ";")) {
    return false;
  }
  // Make sure that _hasExpr matches up with the void-ness of the
  // containing function.
  if (_hasExpr && "void" == currentFunc->type().name()) {
    _error("Cannot return a value from a void function.", _lineNum);
    return false;
  } else if (!_hasExpr && "void" != currentFunc->type().name()) {
    _error("Return statement must include a value in a non-void function.",
           _lineNum);
    return false;
  }
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %r9, %rbp
movq %r8, 0x90(%rsp)
movq %rcx, 0x88(%rsp)
movq %rdx, 0x80(%rsp)
movq %rsi, %r14
movq %rdi, %r15
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x33270
movl 0x8(%rbx), %eax
movl %eax, 0x8(%r15)
leaq 0x28e17(%rip), %r13     # 0x46ce0
movq %r13, (%rbx)
movq 0x10(%rbx), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x1dee7
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x72c0
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x196be(%rip), %rsi     # 0x375b6
leaq 0x196bd(%rip), %rdx     # 0x375bc
leaq 0x8(%rsp), %rdi
callq 0xc0a4
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
movl $0x1, %edx
callq 0x3494f
movl %eax, %ebx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x1df34
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x72c0
testb %bl, %bl
je 0x1e2ce
movq %rbp, %r12
movq %r15, 0x40(%rsp)
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x33270
leaq 0x58(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rdx
addq %rsi, %rdx
leaq 0x48(%rsp), %rdi
callq 0xc014
leaq 0x18c48(%rip), %rsi     # 0x36bc1
leaq 0x48(%rsp), %r15
movq %r15, %rdi
callq 0x70c0
movl %eax, %ebx
movq (%r15), %rdi
cmpq %rbp, %rdi
je 0x1df9d
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x72c0
movq %r13, 0x8(%rsp)
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %r13
cmpq %r13, %rdi
movq 0x40(%rsp), %r15
movq %r12, %rbp
je 0x1dfc6
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x72c0
testl %ebx, %ebx
leaq 0x18(%rsp), %r12
je 0x1e004
movb $0x1, 0x38(%r15)
leaq 0x10(%r15), %rdi
movq %r14, %rsi
movq 0x80(%rsp), %rdx
movq 0x88(%rsp), %rcx
movq 0x90(%rsp), %r8
movq %rbp, %r9
callq 0x1160e
testb %al, %al
jne 0x1e009
jmp 0x1e2ce
movb $0x0, 0x38(%r15)
leaq 0x8(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x18ba9(%rip), %rsi     # 0x36bc1
leaq 0x18ba3(%rip), %rdx     # 0x36bc2
callq 0xc0a4
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
movl $0x1, %edx
callq 0x3494f
movl %eax, %ebx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x1e04f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x72c0
testb %bl, %bl
je 0x1e2ce
movq 0x130(%rsp), %r14
movb 0x38(%r15), %bpl
cmpb $0x1, %bpl
jne 0x1e0f6
movq (%r14), %r12
leaq 0x28cd9(%rip), %rax     # 0x46d50
leaq 0x18(%rsp), %rbx
movq %rax, -0x10(%rbx)
movl 0x28(%r12), %eax
movl %eax, -0x8(%rbx)
leaq 0x28c91(%rip), %r15     # 0x46d20
movq %r15, -0x10(%rbx)
movq %r13, (%rbx)
movq 0x30(%r12), %rsi
movq 0x38(%r12), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0xc014
movl 0x50(%r12), %eax
movl %eax, 0x20(%rbx)
leaq 0xe8(%rsp), %rax
movq %rax, -0x10(%rax)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq 0xd8(%rsp), %rdi
callq 0xc014
leaq 0x17f63(%rip), %rsi     # 0x36040
leaq 0xd8(%rsp), %rdi
callq 0x70c0
testl %eax, %eax
sete %bl
movq 0x40(%rsp), %r15
jmp 0x1e0f8
xorl %ebx, %ebx
testb %bpl, %bpl
je 0x1e141
leaq 0xe8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1e11e
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x72c0
leaq 0x28bfb(%rip), %rax     # 0x46d20
movq %rax, 0x8(%rsp)
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
je 0x1e141
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x72c0
testb %bl, %bl
je 0x1e18b
leaq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %r14
movq %r14, (%rdi)
leaq 0x18e3b(%rip), %rsi     # 0x36f94
leaq 0x18e5f(%rip), %rdx     # 0x36fbf
callq 0xc0a4
movl 0x8(%r15), %esi
leaq 0x48(%rsp), %rdi
callq 0x34811
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x1e2ce
movq 0x58(%rsp), %rsi
jmp 0x1e2c6
movb 0x38(%r15), %bl
testb %bl, %bl
je 0x1e19a
xorl %ebp, %ebp
jmp 0x1e227
movq (%r14), %r12
leaq 0x28bac(%rip), %rax     # 0x46d50
leaq 0x58(%rsp), %rdi
movq %rax, -0x10(%rdi)
movl 0x28(%r12), %eax
movl %eax, -0x8(%rdi)
leaq 0x28b64(%rip), %r15     # 0x46d20
movq %r15, -0x10(%rdi)
leaq 0x68(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x30(%r12), %rsi
movq 0x38(%r12), %rdx
addq %rsi, %rdx
callq 0xc014
movl 0x50(%r12), %eax
movl %eax, 0x10(%r14)
leaq 0xc8(%rsp), %rax
movq %rax, -0x10(%rax)
movq -0x10(%r14), %rsi
movq -0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0xb8(%rsp), %rdi
callq 0xc014
leaq 0x17e31(%rip), %rsi     # 0x36040
leaq 0xb8(%rsp), %rdi
callq 0x70c0
testl %eax, %eax
setne %bpl
movq 0x40(%rsp), %r15
testb %bl, %bl
jne 0x1e272
leaq 0xc8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1e24c
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x72c0
leaq 0x28acd(%rip), %rax     # 0x46d20
leaq 0x68(%rsp), %rcx
movq %rax, -0x20(%rcx)
movq -0x10(%rcx), %rdi
cmpq %rcx, %rdi
je 0x1e272
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x72c0
movb $0x1, %al
testb %bpl, %bpl
je 0x1e2d0
leaq 0xa8(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x18d34(%rip), %rsi     # 0x36fc0
leaq 0x18d6a(%rip), %rdx     # 0x36ffd
leaq 0x98(%rsp), %rdi
callq 0xc0a4
movl 0x8(%r15), %esi
leaq 0x98(%rsp), %rdi
callq 0x34811
movq 0x98(%rsp), %rdi
cmpq %r14, %rdi
je 0x1e2ce
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x72c0
xorl %eax, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %r14, %rdi
je 0x1e389
movq 0xa8(%rsp), %rsi
jmp 0x1e37c
jmp 0x1e386
movq %rax, %rbx
movq %r15, 0x48(%rsp)
movq 0x58(%rsp), %rdi
cmpq %r14, %rdi
je 0x1e389
movq 0x68(%rsp), %rsi
jmp 0x1e37c
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x1e389
movq 0x58(%rsp), %rsi
jmp 0x1e37c
jmp 0x1e386
movq %rax, %rbx
movq %r15, 0x8(%rsp)
movq 0x18(%rsp), %rdi
cmpq %r13, %rdi
jne 0x1e363
jmp 0x1e389
jmp 0x1e36a
jmp 0x1e386
movq %rax, %rbx
movq %r13, 0x8(%rsp)
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x1e389
movq 0x28(%rsp), %rsi
jmp 0x1e37c
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x1e389
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x72c0
jmp 0x1e389
movq %rax, %rbx
movq %rbx, %rdi
callq 0x74f0
nop