// File: /workspace/github_cpp_makefile_star2_O2/lhydave[P]SysYCompilerLab/front/node.cpp
// Function: sysY_AST::ret_stmt_node::ret_stmt_node(sysY_AST::exp_node*)
ret_stmt_node::ret_stmt_node(exp_node *_ret_val)
{
	dbg_printf("generate a ret_stmt_node... ret_val is null: %d\n",
		_ret_val == nullptr);
	ret_type = (_ret_val != nullptr) ? INT : VOID;
	ret_val = _ret_val;
	if (func_table[now_func_name].ret_type != ret_type)
	{
		string msg;
		switch (func_table[now_func_name].ret_type)
		{
		case INT:
			msg = "non-void function '" + now_func_name +
				"' should return a value";
			break;
		case VOID:
			msg = "void function '" + now_func_name +
				"' should not return a value";
			break;
		default: dbg_printf("there cannot be other type!\n");
		}
		yyerror(msg.c_str());
	}
	if (ret_type == INT)
	{
		ret_val->reduce();
		ret_val->new_temp();
		if (ret_val->exp_type == EXP_PTR)
		{
			string msg =
				"function '" + now_func_name + "' should not return a pointer";
			yyerror(msg.c_str());
		}
	}
	gen_code();
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r14
movq %rdi, %rbx
xorl %esi, %esi
callq 0x91da
leaq 0x2334b(%rip), %rax     # 0x2d520
movq %rax, (%rbx)
xorl %eax, %eax
testq %r14, %r14
setne %al
movl %eax, 0x3c(%rbx)
movq %r14, 0x40(%rbx)
leaq 0x2419a(%rip), %rdi     # 0x2e388
leaq 0x241cb(%rip), %rsi     # 0x2e3c0
callq 0xd5da
movl 0x50(%rax), %eax
cmpl 0x3c(%rbx), %eax
je 0xa2dd
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x2416a(%rip), %rdi     # 0x2e388
leaq 0x2419b(%rip), %rsi     # 0x2e3c0
callq 0xd5da
movl 0x50(%rax), %eax
testl %eax, %eax
je 0xa26a
cmpl $0x1, %eax
jne 0xa2bc
leaq 0x147c5(%rip), %rsi     # 0x1ea06
leaq 0x24178(%rip), %rdx     # 0x2e3c0
leaq 0x8(%rsp), %rdi
callq 0xc598
leaq 0x147c1(%rip), %rdx     # 0x1ea1a
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xc579
jmp 0xa298
leaq 0x14799(%rip), %rsi     # 0x1ea0a
leaq 0x24148(%rip), %rdx     # 0x2e3c0
leaq 0x8(%rsp), %rdi
callq 0xc598
leaq 0x147a9(%rip), %rdx     # 0x1ea32
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xc579
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %r14
movq %r14, %rsi
callq 0x5300
movq %r14, %rdi
callq 0x5548
leaq 0x8(%rsp), %rdi
callq 0x5548
leaq 0x48(%rsp), %r14
movq (%r14), %rdi
leaq 0x23fed(%rip), %rax     # 0x2e2b8
movl (%rax), %esi
callq 0x79c8
movq %r14, %rdi
callq 0x5548
movl 0x3c(%rbx), %eax
cmpl $0x1, %eax
jne 0xa359
movq 0x40(%rbx), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
movq 0x40(%rbx), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movq 0x40(%rbx), %rax
cmpl $0x6, 0x98(%rax)
jne 0xa359
leaq 0x14705(%rip), %rsi     # 0x1ea0f
leaq 0x240af(%rip), %rdx     # 0x2e3c0
leaq 0x28(%rsp), %rdi
callq 0xc598
leaq 0x1472c(%rip), %rdx     # 0x1ea4e
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0xc579
leaq 0x28(%rsp), %rdi
callq 0x5548
leaq 0x48(%rsp), %r14
movq (%r14), %rdi
leaq 0x23f6e(%rip), %rax     # 0x2e2b8
movl (%rax), %esi
callq 0x79c8
movq %r14, %rdi
callq 0x5548
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
addq $0x68, %rsp
popq %rbx
popq %r14
retq
jmp 0xa36b
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x5548
jmp 0xa38d
jmp 0xa38a
jmp 0xa38a
movq %rax, %r14
leaq 0x28(%rsp), %rdi
jmp 0xa392
jmp 0xa399
movq %rax, %r14
leaq 0x48(%rsp), %rdi
callq 0x5548
jmp 0xa39c
movq %rax, %r14
movq %rbx, %rdi
callq 0xc94c
movq %r14, %rdi
callq 0x54c0