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

	ParserASTNode *node_target = node->childs[0];
	assert(node_target->type == BE_NODE_IDENTIFIER);
	ParserSymbol *symbol_target = _get_var_symbol_by_id_node(ctx, node_target);
	ParserASTNode *node_type_target = BE_VAR_SYMBOL_GET_TYPE_NODE(symbol_target);
	
	ParserASTNode *node_type = node->childs[1];
	if (!_is_compatible_type(ctx, node_type_target, node_type, true)) {
		goto err;
	}
	uint8_t type = _get_type_by_type_node(ctx, node_type);
	if (!_is_primitive_type(type)
			&& !_is_pointer_type(type)) {
		goto err;
	}

	ParserASTNode *node_source = node->childs[2];
	assert(node_source->type == BE_NODE_IDENTIFIER);
	ParserSymbol *symbol_source = _get_var_symbol_by_id_node(ctx, node_source);
	ParserASTNode *node_type_source = BE_VAR_SYMBOL_GET_TYPE_NODE(symbol_source);
	if (!_is_va_list_pointer(node_type_source)) {
		goto err;
	}

	return;
err:
	_SYNERR_NODE(
		ctx,
		node,
		"invalid parameter combination."
	);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x450, %rsp            # imm = 0x450
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x5eb1c
jmp 0x5eb3b
leaq 0x2163e(%rip), %rdi     # 0x80161
leaq 0x23d56(%rip), %rsi     # 0x82880
movl $0x1648, %edx           # imm = 0x1648
leaq 0x26d20(%rip), %rcx     # 0x85856
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x5eb44
jmp 0x5eb63
leaq 0x17a11(%rip), %rdi     # 0x7655c
leaq 0x23d2e(%rip), %rsi     # 0x82880
movl $0x1649, %edx           # imm = 0x1649
leaq 0x26cf8(%rip), %rcx     # 0x85856
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0xb73, (%rax)          # imm = 0xB73
jne 0x5eb71
jmp 0x5eb90
leaq 0x1b78e(%rip), %rdi     # 0x7a306
leaq 0x23d01(%rip), %rsi     # 0x82880
movl $0x164a, %edx           # imm = 0x164A
leaq 0x26ccb(%rip), %rcx     # 0x85856
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0x3, 0x44(%rax)
jne 0x5eb9c
jmp 0x5ebbb
leaq 0x1859b(%rip), %rdi     # 0x7713e
leaq 0x23cd6(%rip), %rsi     # 0x82880
movl $0x164b, %edx           # imm = 0x164B
leaq 0x26ca0(%rip), %rcx     # 0x85856
callq 0x30a0
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x200, (%rax)          # imm = 0x200
jne 0x5ebd8
jmp 0x5ebf7
leaq 0x177de(%rip), %rdi     # 0x763bd
leaq 0x23c9a(%rip), %rsi     # 0x82880
movl $0x164e, %edx           # imm = 0x164E
leaq 0x26c64(%rip), %rcx     # 0x85856
callq 0x30a0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x5edc0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movl $0x1, %ecx
callq 0x50c90
testb $0x1, %al
jne 0x5ec43
jmp 0x5ecda
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x56560
movb %al, -0x31(%rbp)
movzbl -0x31(%rbp), %edi
callq 0x4db40
testb $0x1, %al
jne 0x5ec6f
movzbl -0x31(%rbp), %edi
callq 0x4db90
testb $0x1, %al
jne 0x5ec6f
jmp 0x5ecda
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpl $0x200, (%rax)          # imm = 0x200
jne 0x5ec8d
jmp 0x5ecac
leaq 0x187ec(%rip), %rdi     # 0x77480
leaq 0x23be5(%rip), %rsi     # 0x82880
movl $0x165d, %edx           # imm = 0x165D
leaq 0x26baf(%rip), %rcx     # 0x85856
callq 0x30a0
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x5edc0
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
callq 0x602f0
testb $0x1, %al
jne 0x5ecd8
jmp 0x5ecda
jmp 0x5ed08
leaq -0x450(%rbp), %rdi
leaq 0x25fc2(%rip), %rsi     # 0x84caa
movb $0x0, %al
callq 0x3160
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x450(%rbp), %rdx
callq *%rax
addq $0x450, %rsp            # imm = 0x450
popq %rbp
retq
nopw %cs:(%rax,%rax)