// File: /workspace/github_cpp_makefile_star2_O3/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
leaq 0x28(%rdi), %r15
xorl %eax, %eax
movq %rax, 0x8(%rdi)
movq %r15, 0x18(%rdi)
movq %rax, 0x20(%rdi)
movb $0x0, 0x28(%rdi)
leaq 0x27514(%rip), %r12     # 0x352b0
movl (%r12), %ecx
movl %ecx, 0x38(%rdi)
leaq 0x2668e(%rip), %rcx     # 0x34438
movq %rcx, (%rdi)
movq %rax, 0x10(%rdi)
leaq 0x27620(%rip), %rax     # 0x353d8
cmpl $0x1, (%rax)
jne 0xddc4
movq %rbx, 0x2758c(%rip)     # 0x35350
leaq 0x2675d(%rip), %rax     # 0x34528
movq %rax, (%rbx)
xorl %eax, %eax
testq %rsi, %rsi
setne %al
movl %eax, 0x3c(%rbx)
movq %rsi, 0x40(%rbx)
leaq 0x2759c(%rip), %rdi     # 0x35380
leaq 0x275cd(%rip), %rsi     # 0x353b8
callq 0x1313a
movl 0x50(%rax), %eax
cmpl 0x3c(%rbx), %eax
je 0xdf38
leaq 0x38(%rsp), %r13
movq %r13, -0x10(%r13)
movq $0x0, -0x8(%r13)
movb $0x0, (%r13)
leaq 0x27567(%rip), %rdi     # 0x35380
leaq 0x27598(%rip), %rsi     # 0x353b8
callq 0x1313a
movl 0x50(%rax), %eax
testl %eax, %eax
je 0xde60
cmpl $0x1, %eax
jne 0xdf10
leaq 0x1ac01(%rip), %rsi     # 0x28a3d
leaq 0x27575(%rip), %rdx     # 0x353b8
leaq 0x48(%rsp), %rdi
callq 0x11c02
leaq 0x1abfd(%rip), %rsi     # 0x28a51
leaq 0x48(%rsp), %rdi
callq 0x5510
jmp 0xde89
leaq 0x1abda(%rip), %rsi     # 0x28a41
leaq 0x2754a(%rip), %rdx     # 0x353b8
leaq 0x48(%rsp), %rdi
callq 0x11c02
leaq 0x1abea(%rip), %rsi     # 0x28a69
leaq 0x48(%rsp), %rdi
callq 0x5510
leaq 0x18(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xdeb0
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0xdeb7
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
movq 0x8(%rax), %rdx
leaq 0x8(%rsp), %r14
movq %rdx, 0x8(%r14)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
callq 0x5310
movq (%r14), %rdi
cmpq %rbp, %rdi
je 0xdef5
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5240
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xdf10
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x5240
movq 0x28(%rsp), %rdi
movl (%r12), %esi
callq 0x8030
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0xdf35
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x5240
movl 0x3c(%rbx), %eax
cmpl $0x1, %eax
jne 0xe01b
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 0xe01b
leaq 0x1aad9(%rip), %rsi     # 0x28a46
leaq 0x27444(%rip), %rdx     # 0x353b8
leaq 0x8(%rsp), %rdi
callq 0x11c02
leaq 0x1ab00(%rip), %rsi     # 0x28a85
leaq 0x8(%rsp), %rdi
callq 0x5510
leaq 0x38(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdi
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdi
je 0xdfb6
movq %rdi, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0xdfc0
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq %r14, %rdi
movq 0x8(%rax), %rdx
movq %rdx, 0x30(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x18(%rsp), %rcx
movq -0x10(%rcx), %rax
cmpq %rcx, %rax
je 0xdffb
movq 0x18(%rsp), %rsi
incq %rsi
movq %rax, %rdi
callq 0x5240
movq 0x28(%rsp), %rdi
movl (%r12), %esi
callq 0x8030
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0xe01b
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x5240
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xe034
movq %rax, %r14
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xe075
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x5240
jmp 0xe075
jmp 0xe072
jmp 0xe072
movq %rax, %r14
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xe091
movq 0x18(%rsp), %rsi
jmp 0xe084
jmp 0xe08e
movq %rax, %r14
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0xe091
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x5240
jmp 0xe091
movq %rax, %r14
leaq 0x26578(%rip), %rax     # 0x34610
movq %rax, (%rbx)
movq 0x18(%rbx), %rdi
cmpq %r15, %rdi
je 0xe0af
movq (%r15), %rsi
incq %rsi
callq 0x5240
movq %r14, %rdi
callq 0x54c0
nop