// File: /workspace/github_c_makefile_star2_O2/Ihsoh[P]ilang/compiler/backend/asmgen_gas32.c
// Function: move_id_or_constexpr_to_reg_ex
static uint8_t _move_id_or_constexpr_to_reg_ex(
	ASMGeneratorGas32Context *ctx,
	int target_reg_l,
	int target_reg_h,
	ParserASTNode *source_id_or_constexpr,
	MoveIdOrConstexprToRegEx *result
) {
	assert(ctx);
	assert(source_id_or_constexpr);

	if (source_id_or_constexpr->type == BE_NODE_IDENTIFIER) {
		ParserSymbol *symbol = _get_symbol_by_id_node(ctx, source_id_or_constexpr);
		if (symbol->type == BE_SYM_VAR) {
			uint8_t symbol_type = BE_VAR_SYMBOL_GET_TYPE(symbol);
			size_t type_size = BE_VAR_SYMBOL_GET_TYPE_SIZE(symbol);
			if (result != NULL) {
				result->type = symbol_type;
				result->type_size = type_size;
				result->node_type = BE_VAR_SYMBOL_GET_TYPE_NODE(symbol);
			}

			if (type_size < 8) {
				const char *target_reg_l_name = _asm_inst_reg(ctx, symbol_type, target_reg_l);

				ParserSymbol *symbol_l = _instantiate_varsym(ctx, symbol, 0);

				_asm_inst_mov_x_sym(
					ctx,
					ctx->body,
					target_reg_l_name,
					symbol_l
				);

				_free_varsym(ctx, symbol_l);
			} else {
				const char *target_reg_l_name = _asm_inst_reg(ctx, BE_TYPE_UINT32, target_reg_l);
				const char *target_reg_h_name = _asm_inst_reg(ctx, BE_TYPE_UINT32, target_reg_h);

				ParserSymbol *symbol_l = _instantiate_varsym(ctx, symbol, 0);
				ParserSymbol *symbol_h = _instantiate_varsym(ctx, symbol, 4);

				_asm_inst_mov_x_sym(
					ctx,
					ctx->body,
					target_reg_l_name,
					symbol_l
				);

				_asm_inst_mov_x_sym(
					ctx,
					ctx->body,
					target_reg_h_name,
					symbol_h
				);

				_free_varsym(ctx, symbol_l);
				_free_varsym(ctx, symbol_h);
			}

			return symbol_type;
		} else if (symbol->type == BE_SYM_FUNC) {
			if (result != NULL) {
				result->node_type = BE_FUNC_SYMBOL_GET_FUNC_NAME_NODE(symbol);
				result->type = BE_TYPE_POINTER;
				result->type_size = be_sem_calc_type_size(ctx->psrctx, source_id_or_constexpr, result->node_type);
			}

			_asm_inst_mov_x_fsym(
				ctx,
				ctx->body,
				_asm_inst_reg(ctx, BE_TYPE_UINT32, target_reg_l),
				symbol
			);

			return BE_TYPE_POINTER;
		} else {
			assert(0);
			return BE_TYPE_UNKNOWN;
		}
	} else if (source_id_or_constexpr->type == BE_NODE_EXPR) {
		uint8_t type = BE_EXPR_AST_NODE_GET_TYPE(source_id_or_constexpr);
		ParserASTNode *node_type = BE_EXPR_AST_NODE_GET_TYPE_NODE(source_id_or_constexpr);
		size_t type_size = be_sem_calc_type_size(ctx->psrctx, source_id_or_constexpr, node_type);
		if (result != NULL) {
			result->type = type;
			result->type_size = type_size;
			result->node_type = node_type;
		}
		
		if (be_sem_is_signed_type(type)) {
			ResizableString rstr_val_l;
			rstr_init(&rstr_val_l);

			ResizableString rstr_val_h;
			rstr_init(&rstr_val_h);

			_asm_constexpr_param(
				ctx,
				&rstr_val_l, &rstr_val_h,
				source_id_or_constexpr,
				target_reg_l
			);

			if (type == BE_TYPE_INT64) {
				_asm_inst_mov_x_x(
					ctx,
					ctx->body,
					BE_TYPE_INT32,
					_asm_inst_reg(ctx, BE_TYPE_INT32, target_reg_l),
					RSTR_CSTR(&rstr_val_l)
				);

				_asm_inst_mov_x_x(
					ctx,
					ctx->body,
					BE_TYPE_INT32,
					_asm_inst_reg(ctx, BE_TYPE_INT32, target_reg_h),
					RSTR_CSTR(&rstr_val_h)
				);
			} else {
				_asm_inst_mov_x_x(
					ctx,
					ctx->body,
					type,
					_asm_inst_reg(ctx, type, target_reg_l),
					RSTR_CSTR(&rstr_val_l)
				);
			}

			rstr_free(&rstr_val_l);
			rstr_free(&rstr_val_h);
		} else if (be_sem_is_unsigned_type(type)) {
			ResizableString rstr_val_l;
			rstr_init(&rstr_val_l);

			ResizableString rstr_val_h;
			rstr_init(&rstr_val_h);

			_asm_constexpr_param(
				ctx,
				&rstr_val_l, &rstr_val_h,
				source_id_or_constexpr,
				target_reg_l
			);

			if (type == BE_TYPE_UINT64) {
				_asm_inst_mov_x_x(
					ctx,
					ctx->body,
					BE_TYPE_UINT32,
					_asm_inst_reg(ctx, BE_TYPE_UINT32, target_reg_l),
					RSTR_CSTR(&rstr_val_l)
				);

				_asm_inst_mov_x_x(
					ctx,
					ctx->body,
					BE_TYPE_UINT32,
					_asm_inst_reg(ctx, BE_TYPE_UINT32, target_reg_h),
					RSTR_CSTR(&rstr_val_h)
				);
			} else {
				_asm_inst_mov_x_x(
					ctx,
					ctx->body,
					type,
					_asm_inst_reg(ctx, type, target_reg_l),
					RSTR_CSTR(&rstr_val_l)
				);
			}

			rstr_free(&rstr_val_l);
			rstr_free(&rstr_val_h);
		} else if (type == BE_TYPE_FLOAT) {
			ResizableString rstr_val_l;
			rstr_init(&rstr_val_l);

			ResizableString rstr_val_h;
			rstr_init(&rstr_val_h);

			_asm_constexpr_param(
				ctx,
				&rstr_val_l, &rstr_val_h,
				source_id_or_constexpr,
				target_reg_l
			);

			_asm_inst_mov_x_x(
				ctx,
				ctx->body,
				type,
				_asm_inst_reg(ctx, type, target_reg_l),
				RSTR_CSTR(&rstr_val_l)
			);

			rstr_free(&rstr_val_l);
			rstr_free(&rstr_val_h);
		} else if (type == BE_TYPE_DOUBLE) {
			ResizableString rstr_val_l;
			rstr_init(&rstr_val_l);

			ResizableString rstr_val_h;
			rstr_init(&rstr_val_h);

			_asm_constexpr_param(
				ctx,
				&rstr_val_l, &rstr_val_h,
				source_id_or_constexpr,
				target_reg_l
			);

			_asm_inst_mov_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_asm_inst_reg(ctx, BE_TYPE_UINT32, target_reg_l),
				RSTR_CSTR(&rstr_val_l)
			);

			_asm_inst_mov_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_asm_inst_reg(ctx, BE_TYPE_UINT32, target_reg_h),
				RSTR_CSTR(&rstr_val_h)
			);

			rstr_free(&rstr_val_l);
			rstr_free(&rstr_val_h);
		} else if (type == BE_TYPE_POINTER) {
			ResizableString rstr_val_l;
			rstr_init(&rstr_val_l);

			ResizableString rstr_val_h;
			rstr_init(&rstr_val_h);

			_asm_constexpr_param(
				ctx,
				&rstr_val_l, &rstr_val_h,
				source_id_or_constexpr,
				target_reg_l
			);

			_asm_inst_mov_x_x(
				ctx,
				ctx->body,
				type,
				_asm_inst_reg(ctx, type, target_reg_l),
				RSTR_CSTR(&rstr_val_l)
			);

			rstr_free(&rstr_val_l);
			rstr_free(&rstr_val_h);
		} else {
			assert(0);
		}

		return type;
	} else {
		assert(0);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
testq %rcx, %rcx
je 0x13460
movq %r8, %r15
movq %rcx, %r13
movl %esi, %r14d
movq %rdi, %rbx
movl (%rcx), %eax
cmpl $0xe00, %eax            # imm = 0xE00
movl %edx, -0x38(%rbp)
je 0x13012
cmpl $0x200, %eax            # imm = 0x200
jne 0x1347f
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1293e
movq %rax, %r12
movl (%rax), %eax
cmpl $0x3, %eax
je 0x13179
cmpl $0x1, %eax
jne 0x1349e
movb 0x30(%r12), %r13b
movq 0x70(%r12), %rax
testq %r15, %r15
je 0x12fcd
movb %r13b, (%r15)
movq %rax, 0x8(%r15)
movq 0x38(%r12), %rcx
movq %rcx, 0x10(%r15)
cmpq $0x7, %rax
ja 0x13272
movzbl %r13b, %edi
movl %r14d, %esi
movl $0xf5e, %edx            # imm = 0xF5E
callq 0x134dc
movq %rax, %r14
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x129c1
movq %rax, %r15
movq 0x20(%rbx), %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x13709
movq %r15, %rdi
jmp 0x132e6
movl %r14d, -0x30(%rbp)
movb 0x60(%r13), %r12b
movq %rbx, %rax
movzbl %r12b, %ebx
movq 0x68(%r13), %r14
movq %rax, -0x60(%rbp)
movq (%rax), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x27a58
testq %r15, %r15
je 0x13047
movb %r12b, (%r15)
movq %rax, 0x8(%r15)
movq %r14, 0x10(%r15)
movb %r12b, -0x29(%rbp)
movl %ebx, %r12d
movl %ebx, %edi
callq 0x27ff7
testb %al, %al
je 0x130c8
leaq -0x48(%rbp), %r14
movq %r14, %rdi
callq 0x6e1c
leaq -0x58(%rbp), %r15
movq %r15, %rdi
callq 0x6e1c
movq -0x60(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r13, %rcx
movl -0x30(%rbp), %r14d
movl %r14d, %r8d
callq 0x13827
movq 0x20(%rbx), %r15
movb -0x29(%rbp), %r13b
cmpb $0x5, %r13b
jne 0x131c4
movl %r14d, %eax
imulq $0x18, %rax, %rax
leaq 0x43673(%rip), %r12     # 0x56720
movq 0x10(%rax,%r12), %rdx
movq -0x40(%rbp), %rcx
testq %rcx, %rcx
leaq 0x2a96b(%rip), %r13     # 0x3da2b
cmoveq %r13, %rcx
pushq $0x4
jmp 0x13145
movl %r12d, %edi
callq 0x28007
testb %al, %al
movq -0x60(%rbp), %rbx
je 0x131d4
leaq -0x48(%rbp), %r14
movq %r14, %rdi
callq 0x6e1c
leaq -0x58(%rbp), %r15
movq %r15, %rdi
callq 0x6e1c
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r13, %rcx
movl -0x30(%rbp), %r14d
movl %r14d, %r8d
callq 0x13827
movq 0x20(%rbx), %r15
movb -0x29(%rbp), %r13b
cmpb $0x9, %r13b
jne 0x132ed
movl %r14d, %eax
imulq $0x18, %rax, %rax
leaq 0x435f4(%rip), %r12     # 0x56720
movq 0x10(%rax,%r12), %rdx
movq -0x40(%rbp), %rcx
testq %rcx, %rcx
leaq 0x2a8ec(%rip), %r13     # 0x3da2b
cmoveq %r13, %rcx
pushq $0x8
popq %r14
movq %r15, %rdi
movl %r14d, %esi
callq 0x135c7
movq 0x20(%rbx), %rdi
movl -0x38(%rbp), %eax
imulq $0x18, %rax, %rax
movq 0x10(%rax,%r12), %rdx
movq -0x50(%rbp), %rcx
testq %rcx, %rcx
cmoveq %r13, %rcx
movb -0x29(%rbp), %r13b
movl %r14d, %esi
jmp 0x13318
testq %r15, %r15
je 0x1319a
movq 0x58(%r12), %rdx
movq %rdx, 0x10(%r15)
movb $0x10, (%r15)
movq (%rbx), %rdi
movq %r13, %rsi
callq 0x27a58
movq %rax, 0x8(%r15)
movq 0x20(%rbx), %rsi
movl %r14d, %eax
imulq $0x18, %rax, %rax
leaq 0x43574(%rip), %rcx     # 0x56720
movq 0x10(%rax,%rcx), %rdx
movq %rbx, %rdi
movq %r12, %rcx
callq 0x12cde
movb $0x10, %r13b
jmp 0x1332f
movl %r12d, %edi
movl %r14d, %esi
movl $0xfc4, %edx            # imm = 0xFC4
jmp 0x132f8
cmpl $0x10, %r12d
je 0x133e3
cmpl $0xb, %r12d
je 0x13341
cmpl $0xa, %r12d
jne 0x134bd
leaq -0x48(%rbp), %r14
movq %r14, %rdi
callq 0x6e1c
leaq -0x58(%rbp), %r15
movq %r15, %rdi
callq 0x6e1c
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r13, %rcx
movl -0x30(%rbp), %r13d
movl %r13d, %r8d
callq 0x13827
movq 0x20(%rbx), %rbx
pushq $0xa
popq %r12
movl %r12d, %edi
movl %r13d, %esi
movl $0x1007, %edx           # imm = 0x1007
callq 0x134dc
movq 0x8(%r14), %rdx
testq %rdx, %rdx
leaq 0x2a7e3(%rip), %rcx     # 0x3da2b
cmovneq %rdx, %rcx
movq %rbx, %rdi
movl %r12d, %esi
movq %rax, %rdx
callq 0x135c7
movq %r14, %rdi
callq 0x72b9
movq %r15, %rdi
callq 0x72b9
movb $0xa, %r13b
jmp 0x1332f
movl %r14d, %eax
imulq $0x18, %rax, %rax
leaq 0x434a0(%rip), %rcx     # 0x56720
movq 0x10(%rax,%rcx), %r14
movl -0x38(%rbp), %eax
imulq $0x18, %rax, %rax
movq 0x10(%rax,%rcx), %rax
movq %rax, -0x38(%rbp)
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x129c1
movl %r13d, %r15d
movq %rax, %r13
pushq $0x4
popq %rdx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x129c1
movq %rax, %r12
movq 0x20(%rbx), %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x13709
movq 0x20(%rbx), %rdi
movq -0x38(%rbp), %rsi
movq %r12, %rdx
callq 0x13709
movq %r13, %rdi
movl %r15d, %r13d
callq 0x12c87
movq %r12, %rdi
callq 0x12c87
jmp 0x1332f
movl %r12d, %edi
movl %r14d, %esi
movl $0xfee, %edx            # imm = 0xFEE
callq 0x134dc
movq -0x40(%rbp), %rdx
testq %rdx, %rdx
leaq 0x2a720(%rip), %rcx     # 0x3da2b
cmovneq %rdx, %rcx
movq %r15, %rdi
movl %r12d, %esi
movq %rax, %rdx
callq 0x135c7
leaq -0x48(%rbp), %rdi
callq 0x72b9
leaq -0x58(%rbp), %rdi
callq 0x72b9
movl %r13d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x48(%rbp), %r12
movq %r12, %rdi
callq 0x6e1c
leaq -0x58(%rbp), %r15
movq %r15, %rdi
callq 0x6e1c
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r13, %rcx
movl -0x30(%rbp), %r14d
movl %r14d, %r8d
callq 0x13827
movq 0x20(%rbx), %rdi
movl %r14d, %eax
imulq $0x18, %rax, %rax
leaq 0x4339d(%rip), %r13     # 0x56720
movq 0x10(%rax,%r13), %rdx
movq 0x8(%r12), %rcx
testq %rcx, %rcx
leaq 0x2a694(%rip), %r14     # 0x3da2b
cmoveq %r14, %rcx
pushq $0x8
popq %r12
movl %r12d, %esi
callq 0x135c7
movq 0x20(%rbx), %rdi
movl -0x38(%rbp), %eax
imulq $0x18, %rax, %rax
movq 0x10(%rax,%r13), %rdx
movq 0x8(%r15), %rcx
testq %rcx, %rcx
cmoveq %r14, %rcx
movl %r12d, %esi
callq 0x135c7
leaq -0x48(%rbp), %rdi
callq 0x72b9
movq %r15, %rdi
callq 0x72b9
movb $0xb, %r13b
jmp 0x1332f
leaq -0x48(%rbp), %r14
movq %r14, %rdi
callq 0x6e1c
leaq -0x58(%rbp), %r15
movq %r15, %rdi
callq 0x6e1c
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r13, %rcx
movl -0x30(%rbp), %r13d
movl %r13d, %r8d
callq 0x13827
movq 0x20(%rbx), %rbx
pushq $0x10
popq %r12
movl %r12d, %edi
movl %r13d, %esi
movl $0x103f, %edx           # imm = 0x103F
callq 0x134dc
movq 0x8(%r14), %rdx
testq %rdx, %rdx
leaq 0x2a5f2(%rip), %rcx     # 0x3da2b
cmovneq %rdx, %rcx
movq %rbx, %rdi
movl %r12d, %esi
movq %rax, %rdx
callq 0x135c7
movq %r14, %rdi
callq 0x72b9
movq %r15, %rdi
callq 0x72b9
jmp 0x131bc
leaq 0x2ae9e(%rip), %rdi     # 0x3e305
leaq 0x29fda(%rip), %rsi     # 0x3d448
leaq 0x2ae15(%rip), %rcx     # 0x3e28a
movl $0xf50, %edx            # imm = 0xF50
callq 0x30a0
leaq 0x27ee3(%rip), %rdi     # 0x3b369
leaq 0x29fbb(%rip), %rsi     # 0x3d448
leaq 0x2adf6(%rip), %rcx     # 0x3e28a
movl $0x104b, %edx           # imm = 0x104B
callq 0x30a0
leaq 0x27ec4(%rip), %rdi     # 0x3b369
leaq 0x29f9c(%rip), %rsi     # 0x3d448
leaq 0x2add7(%rip), %rcx     # 0x3e28a
movl $0xf94, %edx            # imm = 0xF94
callq 0x30a0
leaq 0x27ea5(%rip), %rdi     # 0x3b369
leaq 0x29f7d(%rip), %rsi     # 0x3d448
leaq 0x2adb8(%rip), %rcx     # 0x3e28a
movl $0x1046, %edx           # imm = 0x1046
callq 0x30a0