// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/frontend/semantics.c
// Function: stat_for
static void _stat_for(
	ParserContext *ctx,
	ParserASTNode *node
) {
	assert(ctx);
	assert(node);
	assert(node->type == FE_NODE_STAT_FOR);
	assert(node->nchilds == 4);

	ParserASTNode *node_for_init = node->childs[0];
	assert(node_for_init->type == FE_NODE_STAT_FOR_INIT);
	assert(node_for_init->nchilds == 0 || node_for_init->nchilds == 1);
	if (node_for_init->nchilds == 1) {
		ParserASTNode *node_for_init_var = node_for_init->childs[0];
		_var_with_parent(ctx, node_for_init_var, node);
	}

	ParserASTNode *node_for_expr_cond = node->childs[1];
	assert(node_for_expr_cond->type == FE_NODE_STAT_FOR_EXPR_COND);
	assert(node_for_expr_cond->nchilds == 0 || node_for_expr_cond->nchilds == 1);
	if (node_for_expr_cond->nchilds == 1) {
		ParserASTNode *node_for_expr_cond_expr = node_for_expr_cond->childs[0];
		_expr_wrapper(ctx, node_for_expr_cond_expr);

		if (!_is_integer_type_node(ctx, node_for_expr_cond_expr)
				&& !_is_pointer_type_node(ctx, node_for_expr_cond_expr)) {
			_SYNERR_NODE(
				ctx,
				node,
				"statement 'for' condition expression requires integer type or pointer type."
			);
		}
	}

	ParserASTNode *node_for_expr = node->childs[2];
	assert(node_for_expr->type == FE_NODE_STAT_FOR_EXPR);
	assert(node_for_expr->nchilds == 0 || node_for_expr->nchilds == 1);
	if (node_for_expr->nchilds == 1) {
		ParserASTNode *node_for_expr_expr = node_for_expr->childs[0];
		_expr_wrapper(ctx, node_for_expr_expr);
	}

	ParserASTNode *node_for_body = node->childs[3];
	assert(node_for_body->type == FE_NODE_STATS_BLOCK);
	_stats_block(ctx, node_for_body);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x450, %rsp            # imm = 0x450
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x5df1c
jmp 0x5df3b
leaq 0x1e633(%rip), %rdi     # 0x7c556
leaq 0x20320(%rip), %rsi     # 0x7e24a
movl $0x532, %edx            # imm = 0x532
leaq 0x229f0(%rip), %rcx     # 0x80926
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x5df44
jmp 0x5df63
leaq 0x18088(%rip), %rdi     # 0x75fd3
leaq 0x202f8(%rip), %rsi     # 0x7e24a
movl $0x533, %edx            # imm = 0x533
leaq 0x229c8(%rip), %rcx     # 0x80926
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0xb40, (%rax)          # imm = 0xB40
jne 0x5df71
jmp 0x5df90
leaq 0x1df4a(%rip), %rdi     # 0x7bec2
leaq 0x202cb(%rip), %rsi     # 0x7e24a
movl $0x534, %edx            # imm = 0x534
leaq 0x2299b(%rip), %rcx     # 0x80926
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0x4, 0x44(%rax)
jne 0x5df9c
jmp 0x5dfbb
leaq 0x229b4(%rip), %rdi     # 0x80957
leaq 0x202a0(%rip), %rsi     # 0x7e24a
movl $0x535, %edx            # imm = 0x535
leaq 0x22970(%rip), %rcx     # 0x80926
callq 0x30a0
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpl $0xb41, (%rax)          # imm = 0xB41
jne 0x5dfd8
jmp 0x5dff7
leaq 0x18502(%rip), %rdi     # 0x764e1
leaq 0x20264(%rip), %rsi     # 0x7e24a
movl $0x538, %edx            # imm = 0x538
leaq 0x22934(%rip), %rcx     # 0x80926
callq 0x30a0
movq -0x18(%rbp), %rax
cmpl $0x0, 0x44(%rax)
je 0x5e00b
movq -0x18(%rbp), %rax
cmpl $0x1, 0x44(%rax)
jne 0x5e00d
jmp 0x5e02c
leaq 0x184fa(%rip), %rdi     # 0x7650e
leaq 0x2022f(%rip), %rsi     # 0x7e24a
movl $0x539, %edx            # imm = 0x539
leaq 0x228ff(%rip), %rcx     # 0x80926
callq 0x30a0
movq -0x18(%rbp), %rax
cmpl $0x1, 0x44(%rax)
jne 0x5e056
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x4ea00
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpl $0xb42, (%rax)          # imm = 0xB42
jne 0x5e074
jmp 0x5e093
leaq 0x184ce(%rip), %rdi     # 0x76549
leaq 0x201c8(%rip), %rsi     # 0x7e24a
movl $0x540, %edx            # imm = 0x540
leaq 0x22898(%rip), %rcx     # 0x80926
callq 0x30a0
movq -0x28(%rbp), %rax
cmpl $0x0, 0x44(%rax)
je 0x5e0a7
movq -0x28(%rbp), %rax
cmpl $0x1, 0x44(%rax)
jne 0x5e0a9
jmp 0x5e0c8
leaq 0x184d0(%rip), %rdi     # 0x76580
leaq 0x20193(%rip), %rsi     # 0x7e24a
movl $0x541, %edx            # imm = 0x541
leaq 0x22863(%rip), %rcx     # 0x80926
callq 0x30a0
movq -0x28(%rbp), %rax
cmpl $0x1, 0x44(%rax)
jne 0x5e140
movq -0x28(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x4f680
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x526c0
testb $0x1, %al
jne 0x5e13e
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x52770
testb $0x1, %al
jne 0x5e13e
leaq -0x430(%rbp), %rdi
leaq 0x2284c(%rip), %rsi     # 0x8096a
movb $0x0, %al
callq 0x3160
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x430(%rbp), %rdx
callq *%rax
jmp 0x5e140
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x438(%rbp)
movq -0x438(%rbp), %rax
cmpl $0xb43, (%rax)          # imm = 0xB43
jne 0x5e164
jmp 0x5e183
leaq 0x1845a(%rip), %rdi     # 0x765c5
leaq 0x200d8(%rip), %rsi     # 0x7e24a
movl $0x551, %edx            # imm = 0x551
leaq 0x227a8(%rip), %rcx     # 0x80926
callq 0x30a0
movq -0x438(%rbp), %rax
cmpl $0x0, 0x44(%rax)
je 0x5e19d
movq -0x438(%rbp), %rax
cmpl $0x1, 0x44(%rax)
jne 0x5e19f
jmp 0x5e1be
leaq 0x1844c(%rip), %rdi     # 0x765f2
leaq 0x2009d(%rip), %rsi     # 0x7e24a
movl $0x552, %edx            # imm = 0x552
leaq 0x2276d(%rip), %rcx     # 0x80926
callq 0x30a0
movq -0x438(%rbp), %rax
cmpl $0x1, 0x44(%rax)
jne 0x5e1f0
movq -0x438(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq %rax, -0x440(%rbp)
movq -0x8(%rbp), %rdi
movq -0x440(%rbp), %rsi
callq 0x4f680
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x18(%rax), %rax
movq %rax, -0x448(%rbp)
movq -0x448(%rbp), %rax
cmpl $0xb00, (%rax)          # imm = 0xB00
jne 0x5e214
jmp 0x5e233
leaq 0x18412(%rip), %rdi     # 0x7662d
leaq 0x20028(%rip), %rsi     # 0x7e24a
movl $0x559, %edx            # imm = 0x559
leaq 0x226f8(%rip), %rcx     # 0x80926
callq 0x30a0
movq -0x8(%rbp), %rdi
movq -0x448(%rbp), %rsi
callq 0x5d3d0
addq $0x450, %rsp            # imm = 0x450
popq %rbp
retq
nopl (%rax)