// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq %r8, -0x30(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x1d11a
movl -0x24(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x1d10e
movq -0x10(%rbp), %rdi
movl -0x24(%rbp), %r8d
movq -0x30(%rbp), %r9
movl $0x1, %esi
movl $0xe, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x1b8f0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1d105
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x1d3c4
jmp 0x1d107
movq -0x38(%rbp), %rax
movb $-0x75, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x1d3c4
cmpl $0x3f, -0x24(%rbp)
jg 0x1d16b
movq -0x10(%rbp), %rdi
movl -0x24(%rbp), %edx
movl -0x14(%rbp), %r8d
movq -0x20(%rbp), %r9
movl $0x1, %esi
xorl %eax, %eax
movl %eax, %ecx
callq 0x1b8f0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1d156
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x1d3c4
jmp 0x1d158
movq -0x38(%rbp), %rax
movb $-0x77, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x1d3c4
movl -0x24(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x1d2f0
cmpl $0x3f, -0x14(%rbp)
jg 0x1d20b
movq -0x10(%rbp), %rax
cmpl $0x0, 0x70(%rax)
jne 0x1d1bc
cmpq $0x7fffffff, -0x30(%rbp) # imm = 0x7FFFFFFF
jg 0x1d1a2
cmpq $-0x80000000, -0x30(%rbp) # imm = 0x80000000
jge 0x1d1ba
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x30(%rbp), %rdx
callq 0x1cb30
movl %eax, -0x4(%rbp)
jmp 0x1d3c4
jmp 0x1d209
movq -0x10(%rbp), %rdi
movslq -0x14(%rbp), %rcx
leaq 0x13595(%rip), %rax     # 0x30760
movzbl (%rax,%rcx), %edx
xorl %eax, %eax
movl $0x41, %ecx
cmpl $0x8, %edx
cmovgel %ecx, %eax
movb %al, %dl
movslq -0x14(%rbp), %rcx
leaq 0x13597(%rip), %rax     # 0x30780
movzbl (%rax,%rcx), %eax
addl $0xb8, %eax
movq -0x30(%rbp), %rcx
movzbl %dl, %esi
movzbl %al, %edx
callq 0x2c390
movl %eax, -0x4(%rbp)
jmp 0x1d3c4
jmp 0x1d20b
movq -0x10(%rbp), %rax
cmpl $0x0, 0x70(%rax)
jne 0x1d2a3
cmpq $0x7fffffff, -0x30(%rbp) # imm = 0x7FFFFFFF
jg 0x1d22d
cmpq $-0x80000000, -0x30(%rbp) # imm = 0x80000000
jge 0x1d2a3
jmp 0x1d22f
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rdx
movl $0xf, %esi
callq 0x1cb30
cmpl $0x0, %eax
je 0x1d254
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x1d3c4
jmp 0x1d256
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %r8d
movq -0x20(%rbp), %r9
movl $0x1, %esi
movl $0xf, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x1b8f0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1d28e
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x1d3c4
jmp 0x1d290
movq -0x38(%rbp), %rax
movb $-0x77, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x1d3c4
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rcx
movl -0x14(%rbp), %r8d
movq -0x20(%rbp), %r9
movl $0x1, %esi
movl $0x40, %edx
callq 0x1b8f0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1d2db
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x1d3c4
jmp 0x1d2dd
movq -0x38(%rbp), %rax
movb $-0x39, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x1d3c4
cmpl $0x3f, -0x14(%rbp)
jg 0x1d341
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %edx
movl -0x24(%rbp), %r8d
movq -0x30(%rbp), %r9
movl $0x1, %esi
xorl %eax, %eax
movl %eax, %ecx
callq 0x1b8f0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1d32c
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x1d3c4
jmp 0x1d32e
movq -0x38(%rbp), %rax
movb $-0x75, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x1d3c4
movq -0x10(%rbp), %rdi
movl -0x24(%rbp), %r8d
movq -0x30(%rbp), %r9
movl $0x1, %esi
movl $0xe, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x1b8f0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1d376
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x1d3c4
jmp 0x1d378
movq -0x38(%rbp), %rax
movb $-0x75, (%rax)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %r8d
movq -0x20(%rbp), %r9
movl $0x1, %esi
movl $0xe, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x1b8f0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1d3b4
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x1d3c4
jmp 0x1d3b6
movq -0x38(%rbp), %rax
movb $-0x77, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)