// File: /workspace/github_c_makefile_star2_O1/mmcco[P]sljit/sljit_src/sljitNativeX86_common.c
// Function: emit_shift
static int emit_shift(struct sljit_compiler *compiler,
	u_char mode,
	int dst, long dstw,
	int src1, long src1w,
	int src2, long src2w)
{
	u_char* inst;

	if ((src2 & SLJIT_IMM) || (src2 == SLJIT_PREF_SHIFT_REG)) {
		if (dst == src1 && dstw == src1w) {
			inst = emit_x86_instruction(compiler, 1 | EX86_SHIFT_INS, src2, src2w, dst, dstw);
			FAIL_IF(!inst);
			*inst |= mode;
			return SLJIT_SUCCESS;
		}
		if (dst == SLJIT_UNUSED) {
			EMIT_MOV(compiler, TMP_REG1, 0, src1, src1w);
			inst = emit_x86_instruction(compiler, 1 | EX86_SHIFT_INS, src2, src2w, TMP_REG1, 0);
			FAIL_IF(!inst);
			*inst |= mode;
			return SLJIT_SUCCESS;
		}
		if (dst == SLJIT_PREF_SHIFT_REG && src2 == SLJIT_PREF_SHIFT_REG) {
			EMIT_MOV(compiler, TMP_REG1, 0, src1, src1w);
			inst = emit_x86_instruction(compiler, 1 | EX86_SHIFT_INS, SLJIT_PREF_SHIFT_REG, 0, TMP_REG1, 0);
			FAIL_IF(!inst);
			*inst |= mode;
			EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, TMP_REG1, 0);
			return SLJIT_SUCCESS;
		}
		if (FAST_IS_REG(dst)) {
			EMIT_MOV(compiler, dst, 0, src1, src1w);
			inst = emit_x86_instruction(compiler, 1 | EX86_SHIFT_INS, src2, src2w, dst, 0);
			FAIL_IF(!inst);
			*inst |= mode;
			return SLJIT_SUCCESS;
		}

		EMIT_MOV(compiler, TMP_REG1, 0, src1, src1w);
		inst = emit_x86_instruction(compiler, 1 | EX86_SHIFT_INS, src2, src2w, TMP_REG1, 0);
		FAIL_IF(!inst);
		*inst |= mode;
		EMIT_MOV(compiler, dst, dstw, TMP_REG1, 0);
		return SLJIT_SUCCESS;
	}

	if (dst == SLJIT_PREF_SHIFT_REG) {
		EMIT_MOV(compiler, TMP_REG1, 0, src1, src1w);
		EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, src2, src2w);
		inst = emit_x86_instruction(compiler, 1 | EX86_SHIFT_INS, SLJIT_PREF_SHIFT_REG, 0, TMP_REG1, 0);
		FAIL_IF(!inst);
		*inst |= mode;
		EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, TMP_REG1, 0);
	}
	else if (FAST_IS_REG(dst) && dst != src2 && !ADDRESSING_DEPENDS_ON(src2, dst)) {
		if (src1 != dst)
			EMIT_MOV(compiler, dst, 0, src1, src1w);
		EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_PREF_SHIFT_REG, 0);
		EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, src2, src2w);
		inst = emit_x86_instruction(compiler, 1 | EX86_SHIFT_INS, SLJIT_PREF_SHIFT_REG, 0, dst, 0);
		FAIL_IF(!inst);
		*inst |= mode;
		EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, TMP_REG1, 0);
	}
	else {
		/* This case is really difficult, since ecx itself may used for
		   addressing, and we must ensure to work even in that case. */
		EMIT_MOV(compiler, TMP_REG1, 0, src1, src1w);
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
		EMIT_MOV(compiler, TMP_REG2, 0, SLJIT_PREF_SHIFT_REG, 0);
#else
		/* [esp+0] contains the flags. */
		EMIT_MOV(compiler, SLJIT_MEM1(SLJIT_SP), sizeof(long), SLJIT_PREF_SHIFT_REG, 0);
#endif
		EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, src2, src2w);
		inst = emit_x86_instruction(compiler, 1 | EX86_SHIFT_INS, SLJIT_PREF_SHIFT_REG, 0, TMP_REG1, 0);
		FAIL_IF(!inst);
		*inst |= mode;
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
		EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, TMP_REG2, 0);
#else
		EMIT_MOV(compiler, SLJIT_PREF_SHIFT_REG, 0, SLJIT_MEM1(SLJIT_SP), sizeof(long));
#endif
		EMIT_MOV(compiler, dst, dstw, TMP_REG1, 0);
	}

	return SLJIT_SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movl %edx, %r14d
movl %esi, %ebp
movq %rdi, %rbx
movq 0x48(%rsp), %r13
movl 0x40(%rsp), %r12d
testb $0x40, %r12b
sete %al
cmpl $0x3, %r12d
setne %cl
testb %al, %cl
jne 0x1f04c
cmpl %r8d, %r14d
setne %al
cmpq %r9, %r15
setne %cl
orb %al, %cl
jne 0x1f085
movq %rbx, %rdi
movl $0x21, %esi
movl %r12d, %edx
movq %r13, %rcx
movl %r14d, %r8d
movq %r15, %r9
callq 0x15e07
testq %rax, %rax
je 0x1f388
orb %bpl, (%rax)
xorl %r13d, %r13d
jmp 0x1f38b
cmpl $0x3, %r14d
jne 0x1f108
movq %rbx, %rdi
movl $0xe, %esi
xorl %edx, %edx
movl %r8d, %ecx
movq %r9, %r8
callq 0x16afc
testl %eax, %eax
jne 0x1f388
movq %rbx, %rdi
movl $0x3, %esi
xorl %edx, %edx
movl %r12d, %ecx
movq %r13, %r8
jmp 0x1f0b2
testl %r14d, %r14d
je 0x1f266
movl %r12d, %eax
xorl $0x3, %eax
movl %r14d, %ecx
xorl $0x3, %ecx
movq %rbx, %rdi
orl %eax, %ecx
jne 0x1f29c
movl $0xe, %esi
xorl %edx, %edx
movl %r8d, %ecx
movq %r9, %r8
callq 0x16afc
testl %eax, %eax
jne 0x1f388
movq %rbx, %rdi
movl $0x21, %esi
movl $0x3, %edx
xorl %ecx, %ecx
movl $0xe, %r8d
xorl %r9d, %r9d
callq 0x15e07
testq %rax, %rax
je 0x1f388
orb %bpl, (%rax)
xorl %r13d, %r13d
movq %rbx, %rdi
movl $0x1, %esi
movl $0xe, %edx
xorl %ecx, %ecx
movl $0x3, %r8d
xorl %r9d, %r9d
jmp 0x1f35f
cmpl $0x40, %r14d
setge %al
cmpl %r12d, %r14d
sete %cl
orb %al, %cl
je 0x1f1e0
movq %rbx, %rdi
movl $0xe, %esi
xorl %edx, %edx
movl %r8d, %ecx
movq %r9, %r8
callq 0x16afc
testl %eax, %eax
jne 0x1f388
movq %rbx, %rdi
movl $0x1, %esi
movl $0x3, %edx
xorl %ecx, %ecx
movl $0xf, %r8d
xorl %r9d, %r9d
callq 0x15e07
testq %rax, %rax
je 0x1f375
movb $-0x77, (%rax)
movq %rbx, %rdi
movl $0x3, %esi
xorl %edx, %edx
movl %r12d, %ecx
movq %r13, %r8
callq 0x16afc
testl %eax, %eax
jne 0x1f388
movq %rbx, %rdi
movl $0x21, %esi
movl $0x3, %edx
xorl %ecx, %ecx
movl $0xe, %r8d
xorl %r9d, %r9d
callq 0x15e07
testq %rax, %rax
je 0x1f388
orb %bpl, (%rax)
movq %rbx, %rdi
movl $0x1, %esi
movl $0xf, %edx
xorl %ecx, %ecx
movl $0x3, %r8d
xorl %r9d, %r9d
callq 0x15e07
testq %rax, %rax
je 0x1f39d
movb $-0x77, (%rax)
testl %r14d, %r14d
jne 0x1f347
jmp 0x1f044
testb %r12b, %r12b
js 0x1f2e7
cmpl %r14d, %r8d
je 0x1f209
movq %rbx, %rdi
movl %r14d, %esi
xorl %edx, %edx
movl %r8d, %ecx
movq %r9, %r8
callq 0x16afc
testl %eax, %eax
jne 0x1f388
movq %rbx, %rdi
movl $0x1, %esi
movl $0x3, %edx
xorl %ecx, %ecx
movl $0xe, %r8d
xorl %r9d, %r9d
callq 0x15e07
testq %rax, %rax
je 0x1f37f
movb $-0x77, (%rax)
movq %rbx, %rdi
movl $0x3, %esi
xorl %edx, %edx
movl %r12d, %ecx
movq %r13, %r8
callq 0x16afc
testl %eax, %eax
jne 0x1f388
movq %rbx, %rdi
movl $0x21, %esi
movl $0x3, %edx
xorl %ecx, %ecx
movl %r14d, %r8d
jmp 0x1f0d4
movq %rbx, %rdi
movl $0xe, %esi
xorl %edx, %edx
movl %r8d, %ecx
movq %r9, %r8
callq 0x16afc
testl %eax, %eax
jne 0x1f388
movq %r13, %rcx
xorl %r13d, %r13d
movq %rbx, %rdi
movl $0x21, %esi
movl %r12d, %edx
movl $0xe, %r8d
jmp 0x1f2ce
cmpl $0x3f, %r14d
jg 0x1f30d
movl %r14d, %esi
xorl %edx, %edx
movl %r8d, %ecx
movq %r9, %r8
callq 0x16afc
testl %eax, %eax
jne 0x1f388
movq %r13, %rcx
xorl %r13d, %r13d
movq %rbx, %rdi
movl $0x21, %esi
movl %r12d, %edx
movl %r14d, %r8d
xorl %r9d, %r9d
callq 0x15e07
testq %rax, %rax
je 0x1f388
orb %bpl, (%rax)
jmp 0x1f38b
movl %r12d, %eax
andl $0x3f, %eax
cmpl %r14d, %eax
je 0x1f11d
movl %r12d, %eax
shrl $0x8, %eax
andl $0x3f, %eax
cmpl %r14d, %eax
je 0x1f11d
jmp 0x1f1e9
movl $0xe, %esi
xorl %edx, %edx
movl %r8d, %ecx
movq %r9, %r8
callq 0x16afc
testl %eax, %eax
jne 0x1f388
movq %rbx, %rdi
movl $0x21, %esi
movl %r12d, %edx
movq %r13, %rcx
movl $0xe, %r8d
xorl %r9d, %r9d
callq 0x15e07
testq %rax, %rax
je 0x1f388
orb %bpl, (%rax)
xorl %r13d, %r13d
movq %rbx, %rdi
movl $0x1, %esi
movl $0xe, %edx
xorl %ecx, %ecx
movl %r14d, %r8d
movq %r15, %r9
callq 0x15e07
testq %rax, %rax
je 0x1f36e
movb $-0x77, (%rax)
jmp 0x1f38b
cmpl $0x0, (%rbx)
jne 0x1f388
jmp 0x1f38b
cmpl $0x0, (%rbx)
jne 0x1f388
jmp 0x1f163
cmpl $0x0, (%rbx)
je 0x1f232
movl (%rbx), %r13d
movl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x0, (%rbx)
jne 0x1f388
jmp 0x1f1d2