// File: /workspace/github_c_makefile_star2_O1/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 0x15132
movq %r8, %rbx
movq %rcx, %r12
movl %esi, %r15d
movq %rdi, %r14
movl (%rcx), %eax
cmpl $0xe00, %eax            # imm = 0xE00
movl %edx, -0x48(%rbp)
je 0x14cef
cmpl $0x200, %eax            # imm = 0x200
jne 0x15151
movq %r14, %rdi
movq %r12, %rsi
callq 0x145eb
movq %rax, %r13
movl (%rax), %eax
cmpl $0x3, %eax
je 0x14e90
cmpl $0x1, %eax
jne 0x15170
movb 0x30(%r13), %r12b
movq 0x70(%r13), %rax
testq %rbx, %rbx
je 0x14caa
movb %r12b, (%rbx)
movq %rax, 0x8(%rbx)
movq 0x38(%r13), %rcx
movq %rcx, 0x10(%rbx)
cmpq $0x7, %rax
ja 0x14f4d
movzbl %r12b, %edi
movl %r15d, %esi
movl $0xf5e, %edx            # imm = 0xF5E
callq 0x151ae
movq %rax, %rbx
movq %r14, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x1466e
movq %rax, %r15
movq 0x20(%r14), %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x15391
movq %r15, %rdi
jmp 0x14fc3
movq %r14, %rax
movl %r15d, %r14d
movb 0x60(%r12), %r15b
movzbl %r15b, %ecx
movl %ecx, -0x30(%rbp)
movq 0x68(%r12), %r13
movq %rax, -0x60(%rbp)
movq (%rax), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x2ad41
testq %rbx, %rbx
je 0x14d28
movb %r15b, (%rbx)
movq %rax, 0x8(%rbx)
movq %r13, 0x10(%rbx)
movb %r15b, -0x29(%rbp)
movl -0x30(%rbp), %r13d
movl %r13d, %edi
callq 0x2b31a
testb %al, %al
je 0x14de0
leaq -0x40(%rbp), %rbx
movq %rbx, %rdi
callq 0x7508
leaq -0x58(%rbp), %r13
movq %r13, %rdi
callq 0x7508
movq -0x60(%rbp), %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r12, %rcx
movl %r14d, %r15d
movq %rdi, %r14
movl %r15d, %r8d
callq 0x154af
movq 0x20(%r14), %rbx
movb -0x29(%rbp), %r12b
cmpb $0x5, %r12b
jne 0x14ed9
movl %r15d, %eax
leaq (%rax,%rax,2), %rax
leaq 0x4698d(%rip), %r15     # 0x5b720
movq 0x10(%r15,%rax,8), %rdx
movq -0x38(%rbp), %rcx
testq %rcx, %rcx
leaq 0x2dcb5(%rip), %r12     # 0x42a5b
cmoveq %r12, %rcx
movq %rbx, %rdi
movl $0x4, %esi
callq 0x15262
movq 0x20(%r14), %rdi
movl -0x48(%rbp), %eax
leaq (%rax,%rax,2), %rax
movq 0x10(%r15,%rax,8), %rdx
movq -0x50(%rbp), %rcx
testq %rcx, %rcx
cmoveq %r12, %rcx
movb -0x29(%rbp), %r12b
movl $0x4, %esi
jmp 0x14ffc
movl %r13d, %edi
callq 0x2b32a
testb %al, %al
movl %r14d, %r15d
je 0x14eed
leaq -0x40(%rbp), %rbx
movq %rbx, %rdi
callq 0x7508
leaq -0x58(%rbp), %r13
movq %r13, %rdi
callq 0x7508
movq -0x60(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r12, %rcx
movl %r15d, %r8d
callq 0x154af
movq 0x20(%r14), %rbx
movb -0x29(%rbp), %r12b
cmpb $0x9, %r12b
jne 0x14fcd
movl %r15d, %eax
leaq (%rax,%rax,2), %rax
leaq 0x468dd(%rip), %r15     # 0x5b720
movq 0x10(%r15,%rax,8), %rdx
movq -0x38(%rbp), %rcx
testq %rcx, %rcx
leaq 0x2dc05(%rip), %r12     # 0x42a5b
cmoveq %r12, %rcx
movq %rbx, %rdi
movl $0x8, %esi
callq 0x15262
movq 0x20(%r14), %rdi
movl -0x48(%rbp), %eax
leaq (%rax,%rax,2), %rax
movq 0x10(%r15,%rax,8), %rdx
movq -0x50(%rbp), %rcx
testq %rcx, %rcx
cmoveq %r12, %rcx
movb -0x29(%rbp), %r12b
movl $0x8, %esi
jmp 0x14ffc
testq %rbx, %rbx
je 0x14eaf
movq 0x58(%r13), %rdx
movq %rdx, 0x10(%rbx)
movb $0x10, (%rbx)
movq (%r14), %rdi
movq %r12, %rsi
callq 0x2ad41
movq %rax, 0x8(%rbx)
movq 0x20(%r14), %rsi
movl %r15d, %eax
leaq (%rax,%rax,2), %rax
leaq 0x4685f(%rip), %rcx     # 0x5b720
movq 0x10(%rcx,%rax,8), %rdx
movq %r14, %rdi
movq %r13, %rcx
callq 0x149ad
movb $0x10, %r12b
jmp 0x15120
movl -0x30(%rbp), %r14d
movl %r14d, %edi
movl %r15d, %esi
movl $0xfc4, %edx            # imm = 0xFC4
jmp 0x14fdc
cmpl $0x10, %r13d
movq -0x60(%rbp), %r14
je 0x150a9
cmpl $0xb, %r13d
je 0x15018
cmpl $0xa, %r13d
jne 0x1518f
leaq -0x40(%rbp), %rdi
callq 0x7508
leaq -0x58(%rbp), %rbx
movq %rbx, %rdi
callq 0x7508
movq %r14, %rdi
leaq -0x40(%rbp), %rsi
movq %rbx, %rdx
movq %r12, %rcx
movl %r15d, %r8d
callq 0x154af
movq 0x20(%r14), %r14
movl %r13d, %edi
movl %r15d, %esi
movl $0x1007, %edx           # imm = 0x1007
jmp 0x150e2
movl %r15d, %eax
leaq (%rax,%rax,2), %rax
leaq 0x467c5(%rip), %rcx     # 0x5b720
movq 0x10(%rcx,%rax,8), %rbx
movl -0x48(%rbp), %eax
leaq (%rax,%rax,2), %rax
movq 0x10(%rcx,%rax,8), %rax
movq %rax, -0x48(%rbp)
movq %r14, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x1466e
movl %r12d, %r15d
movq %rax, %r12
movq %r14, %rdi
movq %r13, %rsi
movl $0x4, %edx
callq 0x1466e
movq %rax, %r13
movq 0x20(%r14), %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x15391
movq 0x20(%r14), %rdi
movq -0x48(%rbp), %rsi
movq %r13, %rdx
callq 0x15391
movq %r12, %rdi
movl %r15d, %r12d
callq 0x14956
movq %r13, %rdi
callq 0x14956
jmp 0x15120
movl -0x30(%rbp), %r14d
movl %r14d, %edi
movl %r15d, %esi
movl $0xfee, %edx            # imm = 0xFEE
callq 0x151ae
movq -0x38(%rbp), %rdx
testq %rdx, %rdx
leaq 0x2da6c(%rip), %rcx     # 0x42a5b
cmovneq %rdx, %rcx
movq %rbx, %rdi
movl %r14d, %esi
movq %rax, %rdx
callq 0x15262
leaq -0x40(%rbp), %rdi
callq 0x79f8
leaq -0x58(%rbp), %rdi
callq 0x79f8
jmp 0x15120
leaq -0x40(%rbp), %rbx
movq %rbx, %rdi
callq 0x7508
leaq -0x58(%rbp), %r13
movq %r13, %rdi
callq 0x7508
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r12, %rcx
movl %r15d, %r8d
callq 0x154af
movq 0x20(%r14), %rdi
movl %r15d, %eax
leaq (%rax,%rax,2), %rax
leaq 0x466ca(%rip), %r15     # 0x5b720
movq 0x10(%r15,%rax,8), %rdx
movq 0x8(%rbx), %rcx
testq %rcx, %rcx
leaq 0x2d9f2(%rip), %r12     # 0x42a5b
cmoveq %r12, %rcx
movl $0x8, %esi
callq 0x15262
movq 0x20(%r14), %rdi
movl -0x48(%rbp), %eax
leaq (%rax,%rax,2), %rax
movq 0x10(%r15,%rax,8), %rdx
movq 0x8(%r13), %rcx
testq %rcx, %rcx
cmoveq %r12, %rcx
movl $0x8, %esi
callq 0x15262
movq %rbx, %rdi
callq 0x79f8
movq %r13, %rdi
jmp 0x15117
leaq -0x40(%rbp), %rdi
callq 0x7508
leaq -0x58(%rbp), %rbx
movq %rbx, %rdi
callq 0x7508
movq %r14, %rdi
leaq -0x40(%rbp), %rsi
movq %rbx, %rdx
movq %r12, %rcx
movl %r15d, %r8d
callq 0x154af
movq 0x20(%r14), %r14
movl %r13d, %edi
movl %r15d, %esi
movl $0x103f, %edx           # imm = 0x103F
callq 0x151ae
leaq -0x40(%rbp), %rbx
movq 0x8(%rbx), %rdx
testq %rdx, %rdx
leaq 0x2d962(%rip), %rcx     # 0x42a5b
cmovneq %rdx, %rcx
movq %r14, %rdi
movl %r13d, %esi
movq %rax, %rdx
callq 0x15262
movq %rbx, %rdi
callq 0x79f8
leaq -0x58(%rbp), %rdi
callq 0x79f8
movb -0x29(%rbp), %r12b
movl %r12d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2e20d(%rip), %rdi     # 0x43346
leaq 0x2d338(%rip), %rsi     # 0x42478
leaq 0x2e184(%rip), %rcx     # 0x432cb
movl $0xf50, %edx            # imm = 0xF50
callq 0x30a0
leaq 0x2b235(%rip), %rdi     # 0x4038d
leaq 0x2d319(%rip), %rsi     # 0x42478
leaq 0x2e165(%rip), %rcx     # 0x432cb
movl $0x104b, %edx           # imm = 0x104B
callq 0x30a0
leaq 0x2b216(%rip), %rdi     # 0x4038d
leaq 0x2d2fa(%rip), %rsi     # 0x42478
leaq 0x2e146(%rip), %rcx     # 0x432cb
movl $0xf94, %edx            # imm = 0xF94
callq 0x30a0
leaq 0x2b1f7(%rip), %rdi     # 0x4038d
leaq 0x2d2db(%rip), %rsi     # 0x42478
leaq 0x2e127(%rip), %rcx     # 0x432cb
movl $0x1046, %edx           # imm = 0x1046
callq 0x30a0