// File: /workspace/github_c_makefile_star2_O3/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 0x14e4b
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 0x149dc
cmpl $0x200, %eax            # imm = 0x200
jne 0x14e6a
movq %rbx, %rdi
movq %r13, %rsi
callq 0x142d5
movq %rax, %r12
movl (%rax), %eax
cmpl $0x3, %eax
je 0x14b61
cmpl $0x1, %eax
jne 0x14e89
movb 0x30(%r12), %r13b
movq 0x70(%r12), %rax
testq %r15, %r15
je 0x14997
movb %r13b, (%r15)
movq %rax, 0x8(%r15)
movq 0x38(%r12), %rcx
movq %rcx, 0x10(%r15)
cmpq $0x7, %rax
ja 0x14c5c
movzbl %r13b, %edi
movl %r14d, %esi
movl $0xf5e, %edx            # imm = 0xF5E
callq 0x14ec7
movq %rax, %r14
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x14358
movq %rax, %r15
movq 0x20(%rbx), %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x150aa
movq %r15, %rdi
jmp 0x14cd2
movl %r14d, -0x2c(%rbp)
movb 0x60(%r13), %r14b
movzbl %r14b, %eax
movl %eax, -0x30(%rbp)
movq 0x68(%r13), %r12
movq (%rbx), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x2a367
testq %r15, %r15
je 0x14a0d
movb %r14b, (%r15)
movq %rax, 0x8(%r15)
movq %r12, 0x10(%r15)
movl -0x30(%rbp), %r15d
movl %r15d, %edi
callq 0x2a937
testb %al, %al
je 0x14ab9
leaq -0x48(%rbp), %r12
movq %r12, %rdi
callq 0x7314
leaq -0x58(%rbp), %r15
movq %r15, %rdi
callq 0x7314
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r13, %rcx
movl -0x2c(%rbp), %r12d
movl %r12d, %r8d
callq 0x151c8
movq 0x20(%rbx), %r15
movl %r14d, %r13d
cmpb $0x5, %r14b
jne 0x14bac
movl %r12d, %eax
leaq (%rax,%rax,2), %rax
leaq 0x44cb0(%rip), %r14     # 0x59720
movq 0x10(%r14,%rax,8), %rdx
movq -0x40(%rbp), %rcx
testq %rcx, %rcx
leaq 0x2bf98(%rip), %r12     # 0x40a1b
cmoveq %r12, %rcx
movq %r15, %rdi
movl $0x4, %esi
callq 0x14f7b
movq 0x20(%rbx), %rdi
movl -0x38(%rbp), %eax
leaq (%rax,%rax,2), %rax
movq 0x10(%r14,%rax,8), %rdx
movq -0x50(%rbp), %rcx
testq %rcx, %rcx
cmoveq %r12, %rcx
movl $0x4, %esi
jmp 0x14d05
movl %r15d, %edi
callq 0x2a947
testb %al, %al
je 0x14bbe
leaq -0x48(%rbp), %r12
movq %r12, %rdi
callq 0x7314
leaq -0x58(%rbp), %r15
movq %r15, %rdi
callq 0x7314
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r13, %rcx
movl -0x2c(%rbp), %r12d
movl %r12d, %r8d
callq 0x151c8
movq 0x20(%rbx), %r15
movl %r14d, %r13d
cmpb $0x9, %r14b
jne 0x14cd9
movl %r12d, %eax
leaq (%rax,%rax,2), %rax
leaq 0x44c08(%rip), %r14     # 0x59720
movq 0x10(%r14,%rax,8), %rdx
movq -0x40(%rbp), %rcx
testq %rcx, %rcx
leaq 0x2bef0(%rip), %r12     # 0x40a1b
cmoveq %r12, %rcx
movq %r15, %rdi
movl $0x8, %esi
callq 0x14f7b
movq 0x20(%rbx), %rdi
movl -0x38(%rbp), %eax
leaq (%rax,%rax,2), %rax
movq 0x10(%r14,%rax,8), %rdx
movq -0x50(%rbp), %rcx
testq %rcx, %rcx
cmoveq %r12, %rcx
movl $0x8, %esi
jmp 0x14d05
testq %r15, %r15
je 0x14b82
movq 0x58(%r12), %rdx
movq %rdx, 0x10(%r15)
movb $0x10, (%r15)
movq (%rbx), %rdi
movq %r13, %rsi
callq 0x2a367
movq %rax, 0x8(%r15)
movq 0x20(%rbx), %rsi
movl %r14d, %eax
leaq (%rax,%rax,2), %rax
leaq 0x44b8c(%rip), %rcx     # 0x59720
movq 0x10(%rcx,%rax,8), %rdx
movq %rbx, %rdi
movq %r12, %rcx
callq 0x14697
movb $0x10, %r13b
jmp 0x14d1c
movl -0x30(%rbp), %ebx
movl %ebx, %edi
movl %r12d, %esi
movl $0xfc4, %edx            # imm = 0xFC4
jmp 0x14ce6
cmpl $0x10, %r15d
je 0x14dce
cmpl $0xb, %r15d
je 0x14d2e
cmpl $0xa, %r15d
jne 0x14ea8
leaq -0x48(%rbp), %r14
movq %r14, %rdi
callq 0x7314
leaq -0x58(%rbp), %r15
movq %r15, %rdi
callq 0x7314
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r13, %rcx
movl -0x2c(%rbp), %r12d
movl %r12d, %r8d
callq 0x151c8
movq 0x20(%rbx), %rbx
movl $0xa, %edi
movl %r12d, %esi
movl $0x1007, %edx           # imm = 0x1007
callq 0x14ec7
movq 0x8(%r14), %rdx
testq %rdx, %rdx
leaq 0x2bdeb(%rip), %rcx     # 0x40a1b
cmovneq %rdx, %rcx
movq %rbx, %rdi
movl $0xa, %esi
movq %rax, %rdx
callq 0x14f7b
movq %r14, %rdi
callq 0x7812
movq %r15, %rdi
callq 0x7812
movb $0xa, %r13b
jmp 0x14d1c
movl %r14d, %eax
leaq (%rax,%rax,2), %rax
leaq 0x44ab6(%rip), %rcx     # 0x59720
movq 0x10(%rcx,%rax,8), %r14
movl -0x38(%rbp), %eax
leaq (%rax,%rax,2), %rax
movq 0x10(%rcx,%rax,8), %rax
movq %rax, -0x38(%rbp)
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x14358
movl %r13d, %r15d
movq %rax, %r13
movq %rbx, %rdi
movq %r12, %rsi
movl $0x4, %edx
callq 0x14358
movq %rax, %r12
movq 0x20(%rbx), %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x150aa
movq 0x20(%rbx), %rdi
movq -0x38(%rbp), %rsi
movq %r12, %rdx
callq 0x150aa
movq %r13, %rdi
movl %r15d, %r13d
callq 0x14640
movq %r12, %rdi
callq 0x14640
jmp 0x14d1c
movl -0x30(%rbp), %ebx
movl %ebx, %edi
movl %r12d, %esi
movl $0xfee, %edx            # imm = 0xFEE
callq 0x14ec7
movq -0x40(%rbp), %rdx
testq %rdx, %rdx
leaq 0x2bd22(%rip), %rcx     # 0x40a1b
cmovneq %rdx, %rcx
movq %r15, %rdi
movl %ebx, %esi
movq %rax, %rdx
callq 0x14f7b
leaq -0x48(%rbp), %rdi
callq 0x7812
leaq -0x58(%rbp), %rdi
callq 0x7812
movl %r13d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x48(%rbp), %r14
movq %r14, %rdi
callq 0x7314
leaq -0x58(%rbp), %r15
movq %r15, %rdi
callq 0x7314
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r13, %rcx
movl -0x2c(%rbp), %r12d
movl %r12d, %r8d
callq 0x151c8
movq 0x20(%rbx), %rdi
movl %r12d, %eax
leaq (%rax,%rax,2), %rax
leaq 0x449b0(%rip), %r12     # 0x59720
movq 0x10(%r12,%rax,8), %rdx
movq 0x8(%r14), %rcx
testq %rcx, %rcx
leaq 0x2bc98(%rip), %r13     # 0x40a1b
cmoveq %r13, %rcx
movl $0x8, %esi
callq 0x14f7b
movq 0x20(%rbx), %rdi
movl -0x38(%rbp), %eax
leaq (%rax,%rax,2), %rax
movq 0x10(%r12,%rax,8), %rdx
movq 0x8(%r15), %rcx
testq %rcx, %rcx
cmoveq %r13, %rcx
movl $0x8, %esi
callq 0x14f7b
movq %r14, %rdi
callq 0x7812
movq %r15, %rdi
callq 0x7812
movb $0xb, %r13b
jmp 0x14d1c
leaq -0x48(%rbp), %r14
movq %r14, %rdi
callq 0x7314
leaq -0x58(%rbp), %r15
movq %r15, %rdi
callq 0x7314
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r13, %rcx
movl -0x2c(%rbp), %r12d
movl %r12d, %r8d
callq 0x151c8
movq 0x20(%rbx), %rbx
movl $0x10, %edi
movl %r12d, %esi
movl $0x103f, %edx           # imm = 0x103F
callq 0x14ec7
movq 0x8(%r14), %rdx
testq %rdx, %rdx
leaq 0x2bbf9(%rip), %rcx     # 0x40a1b
cmovneq %rdx, %rcx
movq %rbx, %rdi
movl $0x10, %esi
movq %rax, %rdx
callq 0x14f7b
movq %r14, %rdi
callq 0x7812
movq %r15, %rdi
callq 0x7812
jmp 0x14ba4
leaq 0x2c4b4(%rip), %rdi     # 0x41306
leaq 0x2b5df(%rip), %rsi     # 0x40438
leaq 0x2c42b(%rip), %rcx     # 0x4128b
movl $0xf50, %edx            # imm = 0xF50
callq 0x30a0
leaq 0x294f8(%rip), %rdi     # 0x3e369
leaq 0x2b5c0(%rip), %rsi     # 0x40438
leaq 0x2c40c(%rip), %rcx     # 0x4128b
movl $0x104b, %edx           # imm = 0x104B
callq 0x30a0
leaq 0x294d9(%rip), %rdi     # 0x3e369
leaq 0x2b5a1(%rip), %rsi     # 0x40438
leaq 0x2c3ed(%rip), %rcx     # 0x4128b
movl $0xf94, %edx            # imm = 0xF94
callq 0x30a0
leaq 0x294ba(%rip), %rdi     # 0x3e369
leaq 0x2b582(%rip), %rsi     # 0x40438
leaq 0x2c3ce(%rip), %rcx     # 0x4128b
movl $0x1046, %edx           # imm = 0x1046
callq 0x30a0