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

	dst_r = FAST_IS_REG(dst) ? dst : TMP_REG1;

	/* Register destination. */
	if (dst_r == src1 && !(src2 & SLJIT_IMM)) {
		inst = emit_x86_instruction(compiler, 2, dst_r, 0, src2, src2w);
		FAIL_IF(!inst);
		*inst++ = GROUP_0F;
		*inst = IMUL_r_rm;
	}
	else if (dst_r == src2 && !(src1 & SLJIT_IMM)) {
		inst = emit_x86_instruction(compiler, 2, dst_r, 0, src1, src1w);
		FAIL_IF(!inst);
		*inst++ = GROUP_0F;
		*inst = IMUL_r_rm;
	}
	else if (src1 & SLJIT_IMM) {
		if (src2 & SLJIT_IMM) {
			EMIT_MOV(compiler, dst_r, 0, SLJIT_IMM, src2w);
			src2 = dst_r;
			src2w = 0;
		}

		if (src1w <= 127 && src1w >= -128) {
			inst = emit_x86_instruction(compiler, 1, dst_r, 0, src2, src2w);
			FAIL_IF(!inst);
			*inst = IMUL_r_rm_i8;
			inst = ensure_buf(compiler, 1 + 1);
			FAIL_IF(!inst);
			INC_SIZE(1);
			*inst = (s_char)src1w;
		}
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
		else {
			inst = emit_x86_instruction(compiler, 1, dst_r, 0, src2, src2w);
			FAIL_IF(!inst);
			*inst = IMUL_r_rm_i32;
			inst = ensure_buf(compiler, 1 + 4);
			FAIL_IF(!inst);
			INC_SIZE(4);
			*(long*)inst = src1w;
		}
#else
		else if (IS_HALFWORD(src1w)) {
			inst = emit_x86_instruction(compiler, 1, dst_r, 0, src2, src2w);
			FAIL_IF(!inst);
			*inst = IMUL_r_rm_i32;
			inst = ensure_buf(compiler, 1 + 4);
			FAIL_IF(!inst);
			INC_SIZE(4);
			*(int*)inst = (int)src1w;
		}
		else {
			EMIT_MOV(compiler, TMP_REG2, 0, SLJIT_IMM, src1w);
			if (dst_r != src2)
				EMIT_MOV(compiler, dst_r, 0, src2, src2w);
			inst = emit_x86_instruction(compiler, 2, dst_r, 0, TMP_REG2, 0);
			FAIL_IF(!inst);
			*inst++ = GROUP_0F;
			*inst = IMUL_r_rm;
		}
#endif
	}
	else if (src2 & SLJIT_IMM) {
		/* Note: src1 is NOT immediate. */

		if (src2w <= 127 && src2w >= -128) {
			inst = emit_x86_instruction(compiler, 1, dst_r, 0, src1, src1w);
			FAIL_IF(!inst);
			*inst = IMUL_r_rm_i8;
			inst = ensure_buf(compiler, 1 + 1);
			FAIL_IF(!inst);
			INC_SIZE(1);
			*inst = (s_char)src2w;
		}
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
		else {
			inst = emit_x86_instruction(compiler, 1, dst_r, 0, src1, src1w);
			FAIL_IF(!inst);
			*inst = IMUL_r_rm_i32;
			inst = ensure_buf(compiler, 1 + 4);
			FAIL_IF(!inst);
			INC_SIZE(4);
			*(long*)inst = src2w;
		}
#else
		else if (IS_HALFWORD(src2w)) {
			inst = emit_x86_instruction(compiler, 1, dst_r, 0, src1, src1w);
			FAIL_IF(!inst);
			*inst = IMUL_r_rm_i32;
			inst = ensure_buf(compiler, 1 + 4);
			FAIL_IF(!inst);
			INC_SIZE(4);
			*(int*)inst = (int)src2w;
		}
		else {
			EMIT_MOV(compiler, TMP_REG2, 0, SLJIT_IMM, src2w);
			if (dst_r != src1)
				EMIT_MOV(compiler, dst_r, 0, src1, src1w);
			inst = emit_x86_instruction(compiler, 2, dst_r, 0, TMP_REG2, 0);
			FAIL_IF(!inst);
			*inst++ = GROUP_0F;
			*inst = IMUL_r_rm;
		}
#endif
	}
	else {
		/* Neither argument is immediate. */
		if (ADDRESSING_DEPENDS_ON(src2, dst_r))
			dst_r = TMP_REG1;
		EMIT_MOV(compiler, dst_r, 0, src1, src1w);
		inst = emit_x86_instruction(compiler, 2, dst_r, 0, src2, src2w);
		FAIL_IF(!inst);
		*inst++ = GROUP_0F;
		*inst = IMUL_r_rm;
	}

	if (dst_r == TMP_REG1)
		EMIT_MOV(compiler, dst, dstw, TMP_REG1, 0);

	return SLJIT_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq %r8, -0x30(%rbp)
movl %r9d, -0x34(%rbp)
cmpl $0x3f, -0x14(%rbp)
jg 0x22a10
movl -0x14(%rbp), %eax
movl %eax, -0x48(%rbp)
jmp 0x22a1a
movl $0xe, %eax
movl %eax, -0x48(%rbp)
jmp 0x22a1a
movl -0x48(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x24(%rbp), %eax
jne 0x22a89
movl -0x34(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
jne 0x22a89
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %edx
movl -0x34(%rbp), %r8d
movq 0x10(%rbp), %r9
movl $0x2, %esi
xorl %eax, %eax
movl %eax, %ecx
callq 0x1b8f0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x22a69
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2309d
jmp 0x22a6b
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x40(%rbp)
movb $0xf, (%rax)
movq -0x40(%rbp), %rax
movb $-0x51, (%rax)
jmp 0x23060
movl -0x44(%rbp), %eax
cmpl -0x34(%rbp), %eax
jne 0x22af2
movl -0x24(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
jne 0x22af2
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %edx
movl -0x24(%rbp), %r8d
movq -0x30(%rbp), %r9
movl $0x2, %esi
xorl %eax, %eax
movl %eax, %ecx
callq 0x1b8f0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x22ad2
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2309d
jmp 0x22ad4
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x40(%rbp)
movb $0xf, (%rax)
movq -0x40(%rbp), %rax
movb $-0x51, (%rax)
jmp 0x2305e
movl -0x24(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x22d76
movl -0x34(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x22b4a
jmp 0x22b0e
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %esi
movq 0x10(%rbp), %r8
xorl %eax, %eax
movl %eax, %edx
movl $0x40, %ecx
callq 0x1d0a0
cmpl $0x0, %eax
je 0x22b3a
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2309d
jmp 0x22b3c
movl -0x44(%rbp), %eax
movl %eax, -0x34(%rbp)
movq $0x0, 0x10(%rbp)
cmpq $0x7f, -0x30(%rbp)
jg 0x22bfb
cmpq $-0x80, -0x30(%rbp)
jl 0x22bfb
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %edx
movl -0x34(%rbp), %r8d
movq 0x10(%rbp), %r9
movl $0x1, %esi
xorl %eax, %eax
movl %eax, %ecx
callq 0x1b8f0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x22b96
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2309d
jmp 0x22b98
movq -0x40(%rbp), %rax
movb $0x6b, (%rax)
movq -0x10(%rbp), %rdi
movl $0x2, %esi
callq 0x1a330
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x22bc6
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2309d
jmp 0x22bc8
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x40(%rbp)
movb $0x1, (%rax)
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x60(%rax)
movq -0x30(%rbp), %rax
movb %al, %cl
movq -0x40(%rbp), %rax
movb %cl, (%rax)
jmp 0x22d71
cmpq $0x7fffffff, -0x30(%rbp) # imm = 0x7FFFFFFF
jg 0x22cb2
cmpq $-0x80000000, -0x30(%rbp) # imm = 0x80000000
jl 0x22cb2
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %edx
movl -0x34(%rbp), %r8d
movq 0x10(%rbp), %r9
movl $0x1, %esi
xorl %eax, %eax
movl %eax, %ecx
callq 0x1b8f0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x22c4d
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2309d
jmp 0x22c4f
movq -0x40(%rbp), %rax
movb $0x69, (%rax)
movq -0x10(%rbp), %rdi
movl $0x5, %esi
callq 0x1a330
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x22c7d
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2309d
jmp 0x22c7f
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x40(%rbp)
movb $0x4, (%rax)
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rcx
addq $0x4, %rcx
movq %rcx, 0x60(%rax)
movq -0x30(%rbp), %rax
movl %eax, %ecx
movq -0x40(%rbp), %rax
movl %ecx, (%rax)
jmp 0x22d6f
jmp 0x22cb4
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %r8
movl $0xf, %esi
xorl %eax, %eax
movl %eax, %edx
movl $0x40, %ecx
callq 0x1d0a0
cmpl $0x0, %eax
je 0x22ce2
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2309d
jmp 0x22ce4
movl -0x44(%rbp), %eax
cmpl -0x34(%rbp), %eax
je 0x22d1c
jmp 0x22cee
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %esi
movl -0x34(%rbp), %ecx
movq 0x10(%rbp), %r8
xorl %eax, %eax
movl %eax, %edx
callq 0x1d0a0
cmpl $0x0, %eax
je 0x22d18
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2309d
jmp 0x22d1a
jmp 0x22d1c
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %edx
movl $0x2, %esi
xorl %eax, %eax
movl %eax, %r9d
movl $0xf, %r8d
movq %r9, %rcx
callq 0x1b8f0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x22d54
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2309d
jmp 0x22d56
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x40(%rbp)
movb $0xf, (%rax)
movq -0x40(%rbp), %rax
movb $-0x51, (%rax)
jmp 0x22d71
jmp 0x2305c
movl -0x34(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x22fb1
cmpq $0x7f, 0x10(%rbp)
jg 0x22e36
cmpq $-0x80, 0x10(%rbp)
jl 0x22e36
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %edx
movl -0x24(%rbp), %r8d
movq -0x30(%rbp), %r9
movl $0x1, %esi
xorl %eax, %eax
movl %eax, %ecx
callq 0x1b8f0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x22dd1
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2309d
jmp 0x22dd3
movq -0x40(%rbp), %rax
movb $0x6b, (%rax)
movq -0x10(%rbp), %rdi
movl $0x2, %esi
callq 0x1a330
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x22e01
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2309d
jmp 0x22e03
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x40(%rbp)
movb $0x1, (%rax)
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x60(%rax)
movq 0x10(%rbp), %rax
movb %al, %cl
movq -0x40(%rbp), %rax
movb %cl, (%rax)
jmp 0x22fac
cmpq $0x7fffffff, 0x10(%rbp) # imm = 0x7FFFFFFF
jg 0x22eed
cmpq $-0x80000000, 0x10(%rbp) # imm = 0x80000000
jl 0x22eed
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %edx
movl -0x24(%rbp), %r8d
movq -0x30(%rbp), %r9
movl $0x1, %esi
xorl %eax, %eax
movl %eax, %ecx
callq 0x1b8f0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x22e88
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2309d
jmp 0x22e8a
movq -0x40(%rbp), %rax
movb $0x69, (%rax)
movq -0x10(%rbp), %rdi
movl $0x5, %esi
callq 0x1a330
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x22eb8
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2309d
jmp 0x22eba
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x40(%rbp)
movb $0x4, (%rax)
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rcx
addq $0x4, %rcx
movq %rcx, 0x60(%rax)
movq 0x10(%rbp), %rax
movl %eax, %ecx
movq -0x40(%rbp), %rax
movl %ecx, (%rax)
jmp 0x22faa
jmp 0x22eef
movq -0x10(%rbp), %rdi
movq 0x10(%rbp), %r8
movl $0xf, %esi
xorl %eax, %eax
movl %eax, %edx
movl $0x40, %ecx
callq 0x1d0a0
cmpl $0x0, %eax
je 0x22f1d
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2309d
jmp 0x22f1f
movl -0x44(%rbp), %eax
cmpl -0x24(%rbp), %eax
je 0x22f57
jmp 0x22f29
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %esi
movl -0x24(%rbp), %ecx
movq -0x30(%rbp), %r8
xorl %eax, %eax
movl %eax, %edx
callq 0x1d0a0
cmpl $0x0, %eax
je 0x22f53
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2309d
jmp 0x22f55
jmp 0x22f57
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %edx
movl $0x2, %esi
xorl %eax, %eax
movl %eax, %r9d
movl $0xf, %r8d
movq %r9, %rcx
callq 0x1b8f0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x22f8f
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2309d
jmp 0x22f91
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x40(%rbp)
movb $0xf, (%rax)
movq -0x40(%rbp), %rax
movb $-0x51, (%rax)
jmp 0x22fac
jmp 0x2305a
movl -0x34(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x22fde
movl -0x34(%rbp), %eax
andl $0x3f, %eax
cmpl -0x44(%rbp), %eax
je 0x22fd7
movl -0x34(%rbp), %eax
sarl $0x8, %eax
andl $0x3f, %eax
cmpl -0x44(%rbp), %eax
jne 0x22fde
movl $0xe, -0x44(%rbp)
jmp 0x22fe0
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %esi
movl -0x24(%rbp), %ecx
movq -0x30(%rbp), %r8
xorl %eax, %eax
movl %eax, %edx
callq 0x1d0a0
cmpl $0x0, %eax
je 0x2300a
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2309d
jmp 0x2300c
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %edx
movl -0x34(%rbp), %r8d
movq 0x10(%rbp), %r9
movl $0x2, %esi
xorl %eax, %eax
movl %eax, %ecx
callq 0x1b8f0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x2303f
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2309d
jmp 0x23041
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x40(%rbp)
movb $0xf, (%rax)
movq -0x40(%rbp), %rax
movb $-0x51, (%rax)
jmp 0x2305c
jmp 0x2305e
jmp 0x23060
cmpl $0xe, -0x44(%rbp)
jne 0x23096
jmp 0x23068
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x20(%rbp), %rdx
movl $0xe, %ecx
xorl %eax, %eax
movl %eax, %r8d
callq 0x1d0a0
cmpl $0x0, %eax
je 0x23092
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x2309d
jmp 0x23094
jmp 0x23096
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)