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

	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);
	uint8_t type_target = BE_VAR_SYMBOL_GET_TYPE(symbol_target);

	ParserASTNode *node_source = node->childs[1];
	uint8_t type_source = _move_id_or_constexpr_to_reg(
		ctx,
		_ASM_REG_AX,
		node_source
	);
	assert(type_source == BE_TYPE_POINTER);

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

	const char *tmp_reg = _asm_inst_reg(ctx, type_target, _ASM_REG_AX);

	_asm_inst_mov_x_x(
		ctx,
		ctx->body,
		type_target,
		tmp_reg,
		RSTR_CSTR(&rstr_memref)
	);

	_asm_inst_mov_sym_x(
		ctx,
		ctx->body,
		symbol_target,
		tmp_reg
	);

	rstr_free(&rstr_memref);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x2bafc
jmp 0x2bb1b
leaq 0x5465e(%rip), %rdi     # 0x80161
leaq 0x4effa(%rip), %rsi     # 0x7ab04
movl $0xfa3, %edx            # imm = 0xFA3
leaq 0x5030c(%rip), %rcx     # 0x7be22
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x2bb24
jmp 0x2bb43
leaq 0x4aa31(%rip), %rdi     # 0x7655c
leaq 0x4efd2(%rip), %rsi     # 0x7ab04
movl $0xfa4, %edx            # imm = 0xFA4
leaq 0x502e4(%rip), %rcx     # 0x7be22
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0xb81, (%rax)          # imm = 0xB81
jne 0x2bb51
jmp 0x2bb70
leaq 0x4bb15(%rip), %rdi     # 0x7766d
leaq 0x4efa5(%rip), %rsi     # 0x7ab04
movl $0xfa5, %edx            # imm = 0xFA5
leaq 0x502b7(%rip), %rcx     # 0x7be22
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0x2, 0x44(%rax)
jne 0x2bb7c
jmp 0x2bb9b
leaq 0x571c1(%rip), %rdi     # 0x82d44
leaq 0x4ef7a(%rip), %rsi     # 0x7ab04
movl $0xfa6, %edx            # imm = 0xFA6
leaq 0x5028c(%rip), %rcx     # 0x7be22
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 0x2bbb8
jmp 0x2bbd7
leaq 0x4a7fe(%rip), %rdi     # 0x763bd
leaq 0x4ef3e(%rip), %rsi     # 0x7ab04
movl $0xfa9, %edx            # imm = 0xFA9
leaq 0x50250(%rip), %rcx     # 0x7be22
callq 0x30a0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x32820
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movb 0x30(%rax), %al
movb %al, -0x21(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
xorl %esi, %esi
callq 0x334a0
movb %al, -0x31(%rbp)
movzbl -0x31(%rbp), %eax
cmpl $0x10, %eax
jne 0x2bc1f
jmp 0x2bc3e
leaq 0x4ba67(%rip), %rdi     # 0x7768d
leaq 0x4eed7(%rip), %rsi     # 0x7ab04
movl $0xfb3, %edx            # imm = 0xFB3
leaq 0x501e9(%rip), %rcx     # 0x7be22
callq 0x30a0
leaq -0x48(%rbp), %rdi
callq 0x8c90
movq -0x8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq 0x4f464(%rip), %rdx     # 0x7b0ba
callq 0x35240
movq -0x8(%rbp), %rdi
xorl %edx, %edx
movzbl -0x21(%rbp), %esi
callq 0x334d0
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x68(%rbp)
movb -0x21(%rbp), %al
movb %al, -0x59(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x2bca4
leaq 0x4a2a1(%rip), %rax     # 0x75f3f
movq %rax, -0x78(%rbp)
jmp 0x2bcac
movq -0x40(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x58(%rbp), %rcx
movb -0x59(%rbp), %al
movq -0x68(%rbp), %rsi
movq -0x70(%rbp), %rdi
movq -0x78(%rbp), %r8
movzbl %al, %edx
callq 0x33720
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x20(%rbp), %rdx
movq -0x50(%rbp), %rcx
callq 0x32d40
leaq -0x48(%rbp), %rdi
callq 0x9310
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)