// File: /workspace/github_cpp_makefile_star2_O1/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 0x2657c(%rip), %rax     # 0x345d8
movq %rax, (%rdi)
leaq 0x28(%rdi), %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rdi)
movq %r15, 0x18(%rdi)
xorl %eax, %eax
movq %rax, 0x20(%rdi)
movb $0x0, 0x28(%rdi)
leaq 0x27231(%rip), %r13     # 0x352b0
movl (%r13), %ecx
movl %ecx, 0x38(%rdi)
leaq 0x26373(%rip), %rcx     # 0x34400
movq %rcx, (%rdi)
movq %rax, 0x10(%rdi)
leaq 0x2733d(%rip), %rax     # 0x353d8
cmpl $0x1, (%rax)
jne 0xe0a7
movq %rbx, 0x272a9(%rip)     # 0x35350
leaq 0x26442(%rip), %rax     # 0x344f0
movq %rax, (%rbx)
xorl %eax, %eax
testq %rsi, %rsi
setne %al
movl %eax, 0x3c(%rbx)
movq %rsi, 0x40(%rbx)
leaq 0x272b9(%rip), %rdi     # 0x35380
leaq 0x272ea(%rip), %rsi     # 0x353b8
callq 0x12e54
movl 0x50(%rax), %eax
cmpl 0x3c(%rbx), %eax
je 0xe219
leaq 0x38(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq $0x0, -0x8(%rbp)
movb $0x0, (%rbp)
leaq 0x27285(%rip), %rdi     # 0x35380
leaq 0x272b6(%rip), %rsi     # 0x353b8
callq 0x12e54
movl 0x50(%rax), %eax
testl %eax, %eax
je 0xe142
cmpl $0x1, %eax
jne 0xe1f4
leaq 0x1a8e8(%rip), %rsi     # 0x28a06
leaq 0x27293(%rip), %rdx     # 0x353b8
leaq 0x48(%rsp), %rdi
callq 0x11eb4
leaq 0x1a8e4(%rip), %rsi     # 0x28a1a
leaq 0x48(%rsp), %rdi
callq 0x5510
jmp 0xe16b
leaq 0x1a8c1(%rip), %rsi     # 0x28a0a
leaq 0x27268(%rip), %rdx     # 0x353b8
leaq 0x48(%rsp), %rdi
callq 0x11eb4
leaq 0x1a8d1(%rip), %rsi     # 0x28a32
leaq 0x48(%rsp), %rdi
callq 0x5510
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xe193
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0xe19b
movups (%rcx), %xmm0
movups %xmm0, (%r12)
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 %r12, %rdi
je 0xe1d9
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5240
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xe1f4
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x5240
movq 0x28(%rsp), %rdi
movl (%r13), %esi
callq 0x81dc
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0xe219
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x5240
cmpl $0x1, 0x3c(%rbx)
jne 0xe2f7
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 0xe2f7
leaq 0x1a7c0(%rip), %rsi     # 0x28a0f
leaq 0x27162(%rip), %rdx     # 0x353b8
leaq 0x8(%rsp), %rdi
callq 0x11eb4
leaq 0x1a7e7(%rip), %rsi     # 0x28a4e
leaq 0x8(%rsp), %rdi
callq 0x5510
leaq 0x38(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xe298
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0xe29f
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rdx, 0x30(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xe2d2
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5240
movq 0x28(%rsp), %rdi
movl (%r13), %esi
callq 0x81dc
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0xe2f7
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 0xe310
movq %rax, %r14
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xe351
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x5240
jmp 0xe351
jmp 0xe34e
jmp 0xe34e
movq %rax, %r14
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xe36d
movq 0x18(%rsp), %rsi
jmp 0xe360
jmp 0xe36a
movq %rax, %r14
movq 0x28(%rsp), %rdi
cmpq %rbp, %rdi
je 0xe36d
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x5240
jmp 0xe36d
movq %rax, %r14
leaq 0x26264(%rip), %rax     # 0x345d8
movq %rax, (%rbx)
movq 0x18(%rbx), %rdi
cmpq %r15, %rdi
je 0xe38b
movq (%r15), %rsi
incq %rsi
callq 0x5240
movq %r14, %rdi
callq 0x54c0
nop