// File: /workspace/github_c_makefile_star2_O3/Ihsoh[P]ilang/compiler/frontend/semantics.c
// Function: stat_if
static void _stat_if(
	ParserContext *ctx,
	ParserASTNode *node
) {
	assert(ctx);
	assert(node);
	assert(node->type == FE_NODE_STAT_IF);
	assert(node->nchilds >= 2);

	ParserASTNode *node_if_cond_expr = node->childs[0];
	_expr_wrapper(ctx, node_if_cond_expr);
	if (!_is_integer_type_node(ctx, node_if_cond_expr)
			&& !_is_pointer_type_node(ctx, node_if_cond_expr)) {
		_SYNERR_NODE(
			ctx,
			node,
			"statement 'if' condition expression requires integer type or pointer type."
		);
	}

	ParserASTNode *node_if_body = node->childs[1];
	_stats_block(ctx, node_if_body);

	for (int i = 2; i < node->nchilds; i++) {
		ParserASTNode *child = node->childs[i];
		if (child->type == FE_NODE_STAT_ELIF) {
			assert(child->nchilds == 2);
			ParserASTNode *node_elif_cond_expr = child->childs[0];
			_expr_wrapper(ctx, node_elif_cond_expr);
			if (!_is_integer_type_node(ctx, node_elif_cond_expr)
					&& !_is_pointer_type_node(ctx, node_elif_cond_expr)) {
				_SYNERR_NODE(
					ctx,
					node,
					"statement 'elif' condition expression requires integer type or pointer type."
				);
			}

			ParserASTNode *node_elif_body = child->childs[1];
			_stats_block(ctx, node_elif_body);
		} else if (child->type == FE_NODE_STAT_ELSE) {
			assert(child->nchilds == 1);
			_stats_block(ctx, child->childs[0]);
		} else {
			assert(0);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
cmpl $0xb10, (%rsi)          # imm = 0xB10
jne 0x338ab
movq %rsi, %rbx
cmpl $0x1, 0x44(%rsi)
jle 0x338ca
movq %rdi, %r14
movq 0x48(%rbx), %rax
movq (%rax), %r15
movq %r15, %rsi
callq 0x2bd91
movq %r15, %rdi
callq 0x2d683
testb %al, %al
jne 0x3376c
movq %r15, %rdi
callq 0x2d6e4
testb %al, %al
jne 0x3376c
leaq 0x194bd(%rip), %rsi     # 0x4cc08
leaq -0x430(%rbp), %r15
movl $0x4b, %edx
movq %r15, %rdi
callq 0x3110
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq *0x58(%r14)
movq 0x48(%rbx), %rax
movq 0x8(%rax), %rsi
movq %r14, %rdi
callq 0x32de1
cmpl $0x3, 0x44(%rbx)
jl 0x3383c
movl $0x2, %r15d
movq 0x48(%rbx), %rax
movq (%rax,%r15,8), %r12
movl (%r12), %eax
cmpl $0xb12, %eax            # imm = 0xB12
je 0x33814
cmpl $0xb11, %eax            # imm = 0xB11
jne 0x3386d
cmpl $0x2, 0x44(%r12)
jne 0x3388c
movq 0x48(%r12), %rax
movq (%rax), %r13
movq %r14, %rdi
movq %r13, %rsi
callq 0x2bd91
movq %r13, %rdi
callq 0x2d683
testb %al, %al
jne 0x33809
movq %r13, %rdi
callq 0x2d6e4
testb %al, %al
jne 0x33809
movl $0x4d, %edx
leaq -0x430(%rbp), %r13
movq %r13, %rdi
leaq 0x19470(%rip), %rsi     # 0x4cc67
callq 0x3110
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq *0x58(%r14)
movq 0x48(%r12), %rax
addq $0x8, %rax
jmp 0x33821
cmpl $0x1, 0x44(%r12)
jne 0x3384e
movq 0x48(%r12), %rax
movq (%rax), %rsi
movq %r14, %rdi
callq 0x32de1
incq %r15
movslq 0x44(%rbx), %rax
cmpq %rax, %r15
jl 0x3378c
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1945f(%rip), %rdi     # 0x4ccb4
leaq 0x1709e(%rip), %rsi     # 0x4a8fa
leaq 0x19357(%rip), %rcx     # 0x4cbba
movl $0x4f6, %edx            # imm = 0x4F6
callq 0x30a0
leaq 0xbaec(%rip), %rdi      # 0x3f360
leaq 0x1707f(%rip), %rsi     # 0x4a8fa
leaq 0x19338(%rip), %rcx     # 0x4cbba
movl $0x4f9, %edx            # imm = 0x4F9
callq 0x30a0
leaq 0x193c0(%rip), %rdi     # 0x4cc53
leaq 0x17060(%rip), %rsi     # 0x4a8fa
leaq 0x19319(%rip), %rcx     # 0x4cbba
movl $0x4e7, %edx            # imm = 0x4E7
callq 0x30a0
leaq 0x19338(%rip), %rdi     # 0x4cbea
leaq 0x17041(%rip), %rsi     # 0x4a8fa
leaq 0x192fa(%rip), %rcx     # 0x4cbba
movl $0x4d3, %edx            # imm = 0x4D3
callq 0x30a0
leaq 0x175df(%rip), %rdi     # 0x4aeb0
leaq 0x17022(%rip), %rsi     # 0x4a8fa
leaq 0x192db(%rip), %rcx     # 0x4cbba
movl $0x4d4, %edx            # imm = 0x4D4
callq 0x30a0