// File: /workspace/github_c_makefile_star2_O0/mmcco[P]sljit/sljit_src/sljitNativeX86_common.c
// Function: emit_mov_byte
static int emit_mov_byte(struct sljit_compiler *compiler, int sign,
	int dst, long dstw,
	int src, long srcw)
{
	u_char* inst;
	int dst_r;
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
	int work_r;
#endif

#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
	compiler->mode32 = 0;
#endif

	if (dst == SLJIT_UNUSED && !(src & SLJIT_MEM))
		return SLJIT_SUCCESS; /* Empty instruction. */

	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
			inst = emit_x86_instruction(compiler, 1, SLJIT_IMM, srcw, dst, 0);
			FAIL_IF(!inst);
			*inst = MOV_rm_i32;
			return SLJIT_SUCCESS;
#endif
		}
		inst = emit_x86_instruction(compiler, 1 | EX86_BYTE_ARG | EX86_NO_REXW, SLJIT_IMM, srcw, dst, dstw);
		FAIL_IF(!inst);
		*inst = MOV_rm8_i8;
		return SLJIT_SUCCESS;
	}

	dst_r = FAST_IS_REG(dst) ? dst : TMP_REG1;

	if ((dst & SLJIT_MEM) && FAST_IS_REG(src)) {
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
		if (reg_map[src] >= 4) {
			SLJIT_ASSERT(dst_r == TMP_REG1);
			EMIT_MOV(compiler, TMP_REG1, 0, src, 0);
		} else
			dst_r = src;
#else
		dst_r = src;
#endif
	}
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
	else if (FAST_IS_REG(src) && reg_map[src] >= 4) {
		/* src, dst are regs. */
		SLJIT_ASSERT(SLOW_IS_REG(dst));
		if (reg_map[dst] < 4) {
			if (dst != src)
				EMIT_MOV(compiler, dst, 0, src, 0);
			inst = emit_x86_instruction(compiler, 2, dst, 0, dst, 0);
			FAIL_IF(!inst);
			*inst++ = GROUP_0F;
			*inst = sign ? MOVSX_r_rm8 : MOVZX_r_rm8;
		}
		else {
			if (dst != src)
				EMIT_MOV(compiler, dst, 0, src, 0);
			if (sign) {
				/* shl reg, 24 */
				inst = emit_x86_instruction(compiler, 1 | EX86_SHIFT_INS, SLJIT_IMM, 24, dst, 0);
				FAIL_IF(!inst);
				*inst |= SHL;
				/* sar reg, 24 */
				inst = emit_x86_instruction(compiler, 1 | EX86_SHIFT_INS, SLJIT_IMM, 24, dst, 0);
				FAIL_IF(!inst);
				*inst |= SAR;
			}
			else {
				inst = emit_x86_instruction(compiler, 1 | EX86_BIN_INS, SLJIT_IMM, 0xff, dst, 0);
				FAIL_IF(!inst);
				*(inst + 1) |= AND;
			}
		}
		return SLJIT_SUCCESS;
	}
#endif
	else {
		/* src can be memory addr or reg_map[src] < 4 on x86_32 architectures. */
		inst = emit_x86_instruction(compiler, 2, dst_r, 0, src, srcw);
		FAIL_IF(!inst);
		*inst++ = GROUP_0F;
		*inst = sign ? MOVSX_r_rm8 : MOVZX_r_rm8;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq %r9, -0x30(%rbp)
movq -0x10(%rbp), %rax
movl $0x0, 0x70(%rax)
cmpl $0x0, -0x18(%rbp)
jne 0x1e7f8
movl -0x24(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
jne 0x1e7f8
movl $0x0, -0x4(%rbp)
jmp 0x1e993
movl -0x24(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x1e8a8
cmpl $0x3f, -0x18(%rbp)
jg 0x1e85b
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rcx
movl -0x18(%rbp), %r8d
movl $0x1, %esi
movl $0x40, %edx
xorl %eax, %eax
movl %eax, %r9d
callq 0x1b8f0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1e846
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x1e993
jmp 0x1e848
movq -0x38(%rbp), %rax
movb $-0x39, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x1e993
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rcx
movl -0x18(%rbp), %r8d
movq -0x20(%rbp), %r9
movl $0x181, %esi            # imm = 0x181
movl $0x40, %edx
callq 0x1b8f0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1e893
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x1e993
jmp 0x1e895
movq -0x38(%rbp), %rax
movb $-0x3a, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x1e993
cmpl $0x3f, -0x18(%rbp)
jg 0x1e8b6
movl -0x18(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x1e8c0
movl $0xe, %eax
movl %eax, -0x40(%rbp)
jmp 0x1e8c0
movl -0x40(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x18(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x1e8e1
cmpl $0x3f, -0x24(%rbp)
jg 0x1e8e1
movl -0x24(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0x1e943
movq -0x10(%rbp), %rdi
movl -0x3c(%rbp), %edx
movl -0x24(%rbp), %r8d
movq -0x30(%rbp), %r9
movl $0x2, %esi
xorl %eax, %eax
movl %eax, %ecx
callq 0x1b8f0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1e914
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x1e993
jmp 0x1e916
movq -0x38(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x38(%rbp)
movb $0xf, (%rax)
movl -0x14(%rbp), %edx
movl $0xb6, %eax
movl $0xbe, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movb %al, %cl
movq -0x38(%rbp), %rax
movb %cl, (%rax)
movl -0x18(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x1e98c
movq -0x10(%rbp), %rdi
movl -0x3c(%rbp), %edx
movl -0x18(%rbp), %r8d
movq -0x20(%rbp), %r9
movl $0xc1, %esi
xorl %eax, %eax
movl %eax, %ecx
callq 0x1b8f0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1e983
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x1e993
jmp 0x1e985
movq -0x38(%rbp), %rax
movb $-0x78, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)