// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/backend/semantics.c
// Function: stat_return
static void _stat_return(
	ParserContext *ctx,
	ParserASTNode *node
) {
	assert(ctx);
	assert(node);
	assert(node->type == BE_NODE_STAT_RETURN);

	ParserASTNode *node_func = _search_node_along_parent(node->parent, BE_NODE_FUNC, 0);
	if (node_func == NULL) {
		_SYNERR_NODE(
			ctx,
			node,
			"statement 'return' must be use in function."
		);
	}

	ParserASTNode *node_return_type = NULL;
	if (node_func->nchilds == 4) {
		node_return_type = node_func->childs[2];
	}

	if (node->nchilds == 0) {
		if (node_return_type != NULL) {
			_SYNERR_NODE(
				ctx,
				node,
				"statement 'return' requires return value."
			);
		}
	} else if (node->nchilds == 1) {
		if (node_return_type == NULL) {
			_SYNERR_NODE(
				ctx,
				node,
				"statement 'return' does not require return value."
			);
		}

		ParserASTNode *node_ret_val = node->childs[0];
		_GetParamInfoResult result_ret_val;
		_get_param_info(ctx, node_ret_val, &result_ret_val);
		_check_param_combination2(ctx, node, node_return_type, result_ret_val.node_type);
	} else {
		assert(0);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc50, %rsp            # imm = 0xC50
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x5c61c
jmp 0x5c63b
leaq 0x23b3e(%rip), %rdi     # 0x80161
leaq 0x26256(%rip), %rsi     # 0x82880
movl $0x1148, %edx           # imm = 0x1148
leaq 0x288c2(%rip), %rcx     # 0x84ef8
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x5c644
jmp 0x5c663
leaq 0x19f11(%rip), %rdi     # 0x7655c
leaq 0x2622e(%rip), %rsi     # 0x82880
movl $0x1149, %edx           # imm = 0x1149
leaq 0x2889a(%rip), %rcx     # 0x84ef8
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0xb20, (%rax)          # imm = 0xB20
jne 0x5c671
jmp 0x5c690
leaq 0x1ad5e(%rip), %rdi     # 0x773d6
leaq 0x26201(%rip), %rsi     # 0x82880
movl $0x114a, %edx           # imm = 0x114A
leaq 0x2886d(%rip), %rcx     # 0x84ef8
callq 0x30a0
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdi
movl $0xa00, %esi            # imm = 0xA00
xorl %edx, %edx
movb $0x0, %al
callq 0x5f3e0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x5c6df
leaq -0x420(%rbp), %rdi
leaq 0x2886d(%rip), %rsi     # 0x84f2c
movb $0x0, %al
callq 0x3160
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x420(%rbp), %rdx
callq *%rax
movq $0x0, -0x428(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x4, 0x44(%rax)
jne 0x5c707
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x428(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x44(%rax)
jne 0x5c74e
cmpq $0x0, -0x428(%rbp)
je 0x5c749
leaq -0x830(%rbp), %rdi
leaq 0x2882f(%rip), %rsi     # 0x84f58
movb $0x0, %al
callq 0x3160
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x830(%rbp), %rdx
callq *%rax
jmp 0x5c7f7
movq -0x10(%rbp), %rax
cmpl $0x1, 0x44(%rax)
jne 0x5c7d6
cmpq $0x0, -0x428(%rbp)
jne 0x5c790
leaq -0xc30(%rbp), %rdi
leaq 0x28812(%rip), %rsi     # 0x84f82
movb $0x0, %al
callq 0x3160
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0xc30(%rbp), %rdx
callq *%rax
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq %rax, -0xc38(%rbp)
movq -0x8(%rbp), %rdi
movq -0xc38(%rbp), %rsi
leaq -0xc48(%rbp), %rdx
callq 0x5efc0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x428(%rbp), %rdx
movq -0xc48(%rbp), %rcx
callq 0x5f150
jmp 0x5c7f5
leaq 0x16c7d(%rip), %rdi     # 0x7345a
leaq 0x2609c(%rip), %rsi     # 0x82880
movl $0x1170, %edx           # imm = 0x1170
leaq 0x28708(%rip), %rcx     # 0x84ef8
callq 0x30a0
jmp 0x5c7f7
addq $0xc50, %rsp            # imm = 0xC50
popq %rbp
retq