// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/backend/asmgen_gas64.c
// Function: asm_stat_va_start
static void _asm_stat_va_start(
	ASMGeneratorGas64Context *ctx,
	ParserASTNode *node
) {
	assert(ctx);
	assert(node);
	assert(node->type == BE_NODE_STAT_VA_START);
	assert(node->nchilds == 1);

	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);

	_asm_inst_mov_x_x(
		ctx,
		ctx->body,
		BE_TYPE_UINT64,
		_ASM_REG_NAME_RAX,
		_ASM_REG_NAME_RBP
	);

	// +16为第一个参数的位子，再+8后跳过第一个参数，所以+24。
	_asm_inst_add_x_x(
		ctx,
		ctx->body,
		BE_TYPE_UINT64,
		_ASM_REG_NAME_RAX,
		_ASM_CONST_24
	);

	_asm_inst_mov_x_x(
		ctx,
		ctx->body,
		BE_TYPE_UINT64,
		_ASM_REG_NAME_RBX,
		RSTR_CSTR(BE_VAR_SYMBOL_GET_CODE_GEN_NAME(symbol_target))
	);

	ResizableString rstr_memref;
	rstr_init(&rstr_memref);
	_asm_inst_memref_base(
		ctx,
		&rstr_memref,
		_ASM_REG_NAME_RBX
	);

	_asm_inst_mov_x_x(
		ctx,
		ctx->body,
		BE_TYPE_UINT64,
		RSTR_CSTR(&rstr_memref),
		_ASM_REG_NAME_RAX
	);

	rstr_free(&rstr_memref);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x31d29
jmp 0x31d48
leaq 0x4e431(%rip), %rdi     # 0x80161
leaq 0x48dcd(%rip), %rsi     # 0x7ab04
movl $0x1b5b, %edx           # imm = 0x1B5B
leaq 0x4bff9(%rip), %rcx     # 0x7dd3c
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x31d51
jmp 0x31d70
leaq 0x44804(%rip), %rdi     # 0x7655c
leaq 0x48da5(%rip), %rsi     # 0x7ab04
movl $0x1b5c, %edx           # imm = 0x1B5C
leaq 0x4bfd1(%rip), %rcx     # 0x7dd3c
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0xb70, (%rax)          # imm = 0xB70
jne 0x31d7e
jmp 0x31d9d
leaq 0x4844a(%rip), %rdi     # 0x7a1cf
leaq 0x48d78(%rip), %rsi     # 0x7ab04
movl $0x1b5d, %edx           # imm = 0x1B5D
leaq 0x4bfa4(%rip), %rcx     # 0x7dd3c
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0x1, 0x44(%rax)
jne 0x31da9
jmp 0x31dc8
leaq 0x4565e(%rip), %rdi     # 0x7740e
leaq 0x48d4d(%rip), %rsi     # 0x7ab04
movl $0x1b5e, %edx           # imm = 0x1B5E
leaq 0x4bf79(%rip), %rcx     # 0x7dd3c
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 0x31de5
jmp 0x31e04
leaq 0x445d1(%rip), %rdi     # 0x763bd
leaq 0x48d11(%rip), %rsi     # 0x7ab04
movl $0x1b61, %edx           # imm = 0x1B61
leaq 0x4bf3d(%rip), %rcx     # 0x7dd3c
callq 0x30a0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x32820
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x9, %edx
leaq 0x4928d(%rip), %rcx     # 0x7b0ba
leaq 0x4bf4d(%rip), %r8      # 0x7dd81
callq 0x33720
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x9, %edx
leaq 0x49269(%rip), %rcx     # 0x7b0ba
leaq 0x4bf2e(%rip), %r8      # 0x7dd86
callq 0x33b30
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x58(%rax)
jne 0x31e89
leaq 0x440bc(%rip), %rax     # 0x75f3f
movq %rax, -0x48(%rbp)
jmp 0x31e95
movq -0x20(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %r8
movl $0x9, %edx
leaq 0x49852(%rip), %rcx     # 0x7b6ff
callq 0x33720
leaq -0x30(%rbp), %rdi
callq 0x8c90
movq -0x8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
leaq 0x49835(%rip), %rdx     # 0x7b6ff
callq 0x35240
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x31ef7
leaq 0x4404e(%rip), %rax     # 0x75f3f
movq %rax, -0x60(%rbp)
jmp 0x31eff
movq -0x28(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x50(%rbp), %rsi
movq -0x58(%rbp), %rdi
movq -0x60(%rbp), %rcx
movl $0x9, %edx
leaq 0x491a3(%rip), %r8      # 0x7b0ba
callq 0x33720
leaq -0x30(%rbp), %rdi
callq 0x9310
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)