// File: /workspace/github_c_makefile_star2_O0/mmcco[P]sljit/sljit_src/sljitNativeX86_common.c
// Function: emit_mov_half
static int emit_mov_half(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_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_HALF_ARG | EX86_NO_REXW | EX86_PREF_66, SLJIT_IMM, srcw, dst, dstw);
		FAIL_IF(!inst);
		*inst = MOV_rm_i32;
		return SLJIT_SUCCESS;
	}

	dst_r = FAST_IS_REG(dst) ? dst : TMP_REG1;

	if ((dst & SLJIT_MEM) && FAST_IS_REG(src))
		dst_r = src;
	else {
		inst = emit_x86_instruction(compiler, 2, dst_r, 0, src, srcw);
		FAIL_IF(!inst);
		*inst++ = GROUP_0F;
		*inst = sign ? MOVSX_r_rm16 : MOVZX_r_rm16;
	}

	if (dst & SLJIT_MEM) {
		inst = emit_x86_instruction(compiler, 1 | EX86_NO_REXW | EX86_PREF_66, dst_r, 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)
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 0x1e9e8
movl -0x24(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
jne 0x1e9e8
movl $0x0, -0x4(%rbp)
jmp 0x1eb83
movl -0x24(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x1ea98
cmpl $0x3f, -0x18(%rbp)
jg 0x1ea4b
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 0x1ea36
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x1eb83
jmp 0x1ea38
movq -0x38(%rbp), %rax
movb $-0x39, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x1eb83
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rcx
movl -0x18(%rbp), %r8d
movq -0x20(%rbp), %r9
movl $0x681, %esi            # imm = 0x681
movl $0x40, %edx
callq 0x1b8f0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1ea83
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x1eb83
jmp 0x1ea85
movq -0x38(%rbp), %rax
movb $-0x39, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x1eb83
cmpl $0x3f, -0x18(%rbp)
jg 0x1eaa6
movl -0x18(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x1eab0
movl $0xe, %eax
movl %eax, -0x40(%rbp)
jmp 0x1eab0
movl -0x40(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x18(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x1ead1
cmpl $0x3f, -0x24(%rbp)
jg 0x1ead1
movl -0x24(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0x1eb33
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 0x1eb04
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x1eb83
jmp 0x1eb06
movq -0x38(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x38(%rbp)
movb $0xf, (%rax)
movl -0x14(%rbp), %edx
movl $0xb7, %eax
movl $0xbf, %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 0x1eb7c
movq -0x10(%rbp), %rdi
movl -0x3c(%rbp), %edx
movl -0x18(%rbp), %r8d
movq -0x20(%rbp), %r9
movl $0x481, %esi            # imm = 0x481
xorl %eax, %eax
movl %eax, %ecx
callq 0x1b8f0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1eb73
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x1eb83
jmp 0x1eb75
movq -0x38(%rbp), %rax
movb $-0x77, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)