// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/backend/asmgen_gas32.c
// Function: asm_stat_idx
static void _asm_stat_idx(
	ASMGeneratorGas32Context *ctx,
	ParserASTNode *node
) {
	assert(ctx);
	assert(node);
	assert(node->type == BE_NODE_STAT_IDX);
	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);
	uint8_t type_target = BE_VAR_SYMBOL_GET_TYPE(symbol_target);
	ParserASTNode *node_type_target = BE_VAR_SYMBOL_GET_TYPE_NODE(symbol_target);

	ParserASTNode *node_source_left = node->childs[1];
	ParserASTNode *node_source_right = node->childs[2];

	if (be_sem_is_pointer_type(type_target)) {
		_move_id_or_constexpr_to_reg(
			ctx,
			_ASM_REG_AX,
			_ASM_REG_BX,
			node_source_left
		);

		_move_id_or_constexpr_to_reg(
			ctx,
			_ASM_REG_BX,
			_ASM_REG_CX,
			node_source_right
		);

		size_t size = be_sem_calc_type_size(
			ctx->psrctx, node, node_type_target->childs[0]
		);
		ResizableString rstr_size;
		rstr_init(&rstr_size);
		_asm_inst_uint_const(
			ctx,
			&rstr_size,
			size
		);
		_asm_inst_imul_x_x_x(
			ctx,
			ctx->body,
			BE_TYPE_UINT32,
			_ASM_REG_NAME_EBX,
			_ASM_REG_NAME_EBX,
			RSTR_CSTR(&rstr_size)
		);
		rstr_free(&rstr_size);
		
		_asm_inst_add_x_x(
			ctx,
			ctx->body,
			BE_TYPE_UINT32,
			_ASM_REG_NAME_EAX,
			_ASM_REG_NAME_EBX
		);

		ParserSymbol *symbol_target_l = _instantiate_varsym(ctx, symbol_target, 0);

		_asm_inst_mov_sym_x(
			ctx,
			ctx->body,
			symbol_target_l,
			_ASM_REG_NAME_EAX
		);

		_free_varsym(ctx, symbol_target_l);
	} else {
		assert(0);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x186bc
jmp 0x186db
leaq 0x67a9e(%rip), %rdi     # 0x80161
leaq 0x5d22e(%rip), %rsi     # 0x758f8
movl $0x1c81, %edx           # imm = 0x1C81
leaq 0x60d6d(%rip), %rcx     # 0x79443
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x186e4
jmp 0x18703
leaq 0x5de71(%rip), %rdi     # 0x7655c
leaq 0x5d206(%rip), %rsi     # 0x758f8
movl $0x1c82, %edx           # imm = 0x1C82
leaq 0x60d45(%rip), %rcx     # 0x79443
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0xbe6, (%rax)          # imm = 0xBE6
jne 0x18711
jmp 0x18730
leaq 0x60d6b(%rip), %rdi     # 0x79483
leaq 0x5d1d9(%rip), %rsi     # 0x758f8
movl $0x1c83, %edx           # imm = 0x1C83
leaq 0x60d18(%rip), %rcx     # 0x79443
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0x3, 0x44(%rax)
jne 0x1873c
jmp 0x1875b
leaq 0x5e9fb(%rip), %rdi     # 0x7713e
leaq 0x5d1ae(%rip), %rsi     # 0x758f8
movl $0x1c84, %edx           # imm = 0x1C84
leaq 0x60ced(%rip), %rcx     # 0x79443
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 0x18778
jmp 0x18797
leaq 0x5dc3e(%rip), %rdi     # 0x763bd
leaq 0x5d172(%rip), %rsi     # 0x758f8
movl $0x1c87, %edx           # imm = 0x1C87
leaq 0x60cb1(%rip), %rcx     # 0x79443
callq 0x30a0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1f720
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movb 0x30(%rax), %al
movb %al, -0x21(%rbp)
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
movzbl -0x21(%rbp), %edi
callq 0x4db70
testb $0x1, %al
jne 0x187f0
jmp 0x1890f
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rcx
xorl %esi, %esi
movl $0x1, %edx
callq 0x22a20
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rcx
movl $0x1, %esi
movl $0x2, %edx
callq 0x22a20
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rdx
callq 0x4d4f0
movq %rax, -0x48(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x8c90
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rdx
leaq -0x58(%rbp), %rsi
callq 0x21e80
movq -0x8(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x1887c
leaq 0x5d6c9(%rip), %rax     # 0x75f3f
movq %rax, -0x78(%rbp)
jmp 0x18884
movq -0x50(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x68(%rbp), %rsi
movq -0x70(%rbp), %rdi
movq -0x78(%rbp), %r9
movl $0x8, %edx
leaq 0x5db4e(%rip), %r8      # 0x763ea
movq %r8, %rcx
callq 0x25510
leaq -0x58(%rbp), %rdi
callq 0x9310
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5db20(%rip), %rcx     # 0x763e5
leaq 0x5db1e(%rip), %r8      # 0x763ea
callq 0x21eb0
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
xorl %edx, %edx
callq 0x1f8e0
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x60(%rbp), %rdx
leaq 0x5daea(%rip), %rcx     # 0x763e5
callq 0x20080
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x1fd10
jmp 0x1892e
leaq 0x5ab44(%rip), %rdi     # 0x7345a
leaq 0x5cfdb(%rip), %rsi     # 0x758f8
movl $0x1cc5, %edx           # imm = 0x1CC5
leaq 0x60b1a(%rip), %rcx     # 0x79443
callq 0x30a0
addq $0x80, %rsp
popq %rbp
retq
nopw (%rax,%rax)