// File: /workspace/github_c_makefile_star2_O2/mmcco[P]sljit/sljit_src/sljitNativeX86_common.c
// Function: emit_mov
static int emit_mov(struct sljit_compiler *compiler,
	int dst, long dstw,
	int src, long srcw)
{
	u_char* inst;

	if (dst == SLJIT_UNUSED) {
		/* No destination, doesn't need to setup flags. */
		if (src & SLJIT_MEM) {
			inst = emit_x86_instruction(compiler, 1, TMP_REG1, 0, src, srcw);
			FAIL_IF(!inst);
			*inst = MOV_r_rm;
		}
		return SLJIT_SUCCESS;
	}
	if (FAST_IS_REG(src)) {
		inst = emit_x86_instruction(compiler, 1, src, 0, dst, dstw);
		FAIL_IF(!inst);
		*inst = MOV_rm_r;
		return SLJIT_SUCCESS;
	}
	if (src & SLJIT_IMM) {
		if (FAST_IS_REG(dst)) {
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
			return emit_do_imm(compiler, MOV_r_i32 + reg_map[dst], srcw);
#else
			if (!compiler->mode32) {
				if (NOT_HALFWORD(srcw))
					return emit_load_imm64(compiler, dst, srcw);
			}
			else
				return emit_do_imm32(compiler, (reg_map[dst] >= 8) ? REX_B : 0, MOV_r_i32 + reg_lmap[dst], srcw);
#endif
		}
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
		if (!compiler->mode32 && NOT_HALFWORD(srcw)) {
			FAIL_IF(emit_load_imm64(compiler, TMP_REG2, srcw));
			inst = emit_x86_instruction(compiler, 1, TMP_REG2, 0, dst, dstw);
			FAIL_IF(!inst);
			*inst = MOV_rm_r;
			return SLJIT_SUCCESS;
		}
#endif
		inst = emit_x86_instruction(compiler, 1, SLJIT_IMM, srcw, dst, dstw);
		FAIL_IF(!inst);
		*inst = MOV_rm_i32;
		return SLJIT_SUCCESS;
	}
	if (FAST_IS_REG(dst)) {
		inst = emit_x86_instruction(compiler, 1, dst, 0, src, srcw);
		FAIL_IF(!inst);
		*inst = MOV_r_rm;
		return SLJIT_SUCCESS;
	}

	/* Memory to memory move. Requires two instruction. */
	inst = emit_x86_instruction(compiler, 1, TMP_REG1, 0, src, srcw);
	FAIL_IF(!inst);
	*inst = MOV_r_rm;
	inst = emit_x86_instruction(compiler, 1, TMP_REG1, 0, dst, dstw);
	FAIL_IF(!inst);
	*inst = MOV_rm_r;
	return SLJIT_SUCCESS;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r9
movl %ecx, %r8d
movq %rdi, %rbx
testl %esi, %esi
je 0x14d5f
movq %rdx, %r12
movl %esi, %r15d
cmpl $0x3f, %r8d
jg 0x14d79
xorl %r14d, %r14d
pushq $0x1
popq %rsi
movq %rbx, %rdi
movl %r8d, %edx
xorl %ecx, %ecx
movl %r15d, %r8d
movq %r12, %r9
callq 0x14061
testq %rax, %rax
je 0x14e93
movb $-0x77, (%rax)
jmp 0x14e96
xorl %r14d, %r14d
testb %r8b, %r8b
jns 0x14e96
xorl %r14d, %r14d
pushq $0x1
popq %rsi
pushq $0xe
popq %rdx
movq %rbx, %rdi
jmp 0x14d91
testb $0x40, %r8b
jne 0x14da9
cmpl $0x3f, %r15d
jg 0x14df3
xorl %r14d, %r14d
pushq $0x1
popq %rsi
movq %rbx, %rdi
movl %r15d, %edx
xorl %ecx, %ecx
callq 0x14061
testq %rax, %rax
je 0x14e93
movb $-0x75, (%rax)
jmp 0x14e96
movl 0x70(%rbx), %eax
cmpl $0x3f, %r15d
jg 0x14e19
testl %eax, %eax
je 0x14e4e
movslq %r15d, %rax
leaq 0xc3ec(%rip), %rcx      # 0x211b0
movb (%rax,%rcx), %al
addb $-0x48, %al
xorl %ecx, %ecx
movl $0x10ef0, %edx          # imm = 0x10EF0
btq %r15, %rdx
pushq $0x41
popq %rsi
cmovael %ecx, %esi
movzbl %al, %edx
movq %rbx, %rdi
movq %r9, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1cdbb
pushq $0x1
popq %rsi
pushq $0xe
popq %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x14061
testq %rax, %rax
je 0x14e93
movb $-0x75, (%rax)
xorl %r14d, %r14d
pushq $0x1
popq %rsi
pushq $0xe
jmp 0x14e45
testl %eax, %eax
setne %al
movslq %r9d, %rcx
cmpq %r9, %rcx
sete %cl
orb %al, %cl
jne 0x14e6f
pushq $0xf
popq %rsi
movq %rbx, %rdi
movq %r9, %rdx
callq 0x14aa1
testl %eax, %eax
jne 0x14e93
xorl %r14d, %r14d
pushq $0x1
popq %rsi
pushq $0xf
popq %rdx
movq %rbx, %rdi
jmp 0x14d41
movslq %r9d, %rax
cmpq %r9, %rax
je 0x14e6f
movq %rbx, %rdi
movl %r15d, %esi
movq %r9, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x14aa1
pushq $0x1
popq %rsi
pushq $0x40
popq %rdx
movq %rbx, %rdi
movq %r9, %rcx
movl %r15d, %r8d
movq %r12, %r9
callq 0x14061
testq %rax, %rax
je 0x14e93
movb $-0x39, (%rax)
xorl %r14d, %r14d
jmp 0x14e96
movl (%rbx), %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq