// File: /workspace/github_c_makefile_star2_O2/mmcco[P]sljit/sljit_src/sljitNativeX86_common.c
// Function: sljit_emit_op0
int sljit_emit_op0(struct sljit_compiler *compiler, int op)
{
	u_char *inst;
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
	int size;
#endif

	CHECK_ERROR();
	CHECK(check_sljit_emit_op0(compiler, op));

	switch (GET_OPCODE(op)) {
	case SLJIT_BREAKPOINT:
		inst = ensure_buf(compiler, 1 + 1);
		FAIL_IF(!inst);
		INC_SIZE(1);
		*inst = INT3;
		break;
	case SLJIT_NOP:
		inst = ensure_buf(compiler, 1 + 1);
		FAIL_IF(!inst);
		INC_SIZE(1);
		*inst = NOP;
		break;
	case SLJIT_LUMUL:
	case SLJIT_LSMUL:
	case SLJIT_LUDIV:
	case SLJIT_LSDIV:
		compiler->flags_saved = 0;
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
#ifdef _WIN64
		SLJIT_COMPILE_ASSERT(
			reg_map[SLJIT_R0] == 0
			&& reg_map[SLJIT_R1] == 2
			&& reg_map[TMP_REG1] > 7,
			invalid_reg_assignment_for_div_mul);
#else
		SLJIT_COMPILE_ASSERT(
			reg_map[SLJIT_R0] == 0
			&& reg_map[SLJIT_R1] < 7
			&& reg_map[TMP_REG1] == 2,
			invalid_reg_assignment_for_div_mul);
#endif
		compiler->mode32 = op & SLJIT_INT_OP;
#endif

		op = GET_OPCODE(op);
		if (op == SLJIT_LUDIV) {
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || defined(_WIN64)
			EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_R1, 0);
			inst = emit_x86_instruction(compiler, 1, SLJIT_R1, 0, SLJIT_R1, 0);
#else
			inst = emit_x86_instruction(compiler, 1, TMP_REG1, 0, TMP_REG1, 0);
#endif
			FAIL_IF(!inst);
			*inst = XOR_r_rm;
		}

		if (op == SLJIT_LSDIV) {
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || defined(_WIN64)
			EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_R1, 0);
#endif

#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
			inst = ensure_buf(compiler, 1 + 1);
			FAIL_IF(!inst);
			INC_SIZE(1);
			*inst = CDQ;
#else
			if (compiler->mode32) {
				inst = ensure_buf(compiler, 1 + 1);
				FAIL_IF(!inst);
				INC_SIZE(1);
				*inst = CDQ;
			} else {
				inst = ensure_buf(compiler, 1 + 2);
				FAIL_IF(!inst);
				INC_SIZE(2);
				*inst++ = REX_W;
				*inst = CDQ;
			}
#endif
		}

#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
		inst = ensure_buf(compiler, 1 + 2);
		FAIL_IF(!inst);
		INC_SIZE(2);
		*inst++ = GROUP_F7;
		*inst = MOD_REG | ((op >= SLJIT_LUDIV) ? reg_map[TMP_REG1] : reg_map[SLJIT_R1]);
#else
#ifdef _WIN64
		size = (!compiler->mode32 || op >= SLJIT_LUDIV) ? 3 : 2;
#else
		size = (!compiler->mode32) ? 3 : 2;
#endif
		inst = ensure_buf(compiler, 1 + size);
		FAIL_IF(!inst);
		INC_SIZE(size);
#ifdef _WIN64
		if (!compiler->mode32)
			*inst++ = REX_W | ((op >= SLJIT_LUDIV) ? REX_B : 0);
		else if (op >= SLJIT_LUDIV)
			*inst++ = REX_B;
		*inst++ = GROUP_F7;
		*inst = MOD_REG | ((op >= SLJIT_LUDIV) ? reg_lmap[TMP_REG1] : reg_lmap[SLJIT_R1]);
#else
		if (!compiler->mode32)
			*inst++ = REX_W;
		*inst++ = GROUP_F7;
		*inst = MOD_REG | reg_map[SLJIT_R1];
#endif
#endif
		switch (op) {
		case SLJIT_LUMUL:
			*inst |= MUL;
			break;
		case SLJIT_LSMUL:
			*inst |= IMUL;
			break;
		case SLJIT_LUDIV:
			*inst |= DIV;
			break;
		case SLJIT_LSDIV:
			*inst |= IDIV;
			break;
		}
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) && !defined(_WIN64)
		EMIT_MOV(compiler, SLJIT_R1, 0, TMP_REG1, 0);
#endif
		break;
	}

	return SLJIT_SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl (%rdi), %r14d
testl %r14d, %r14d
jne 0x14ce0
movl %esi, %ebp
cmpl $0x4, %esi
setb %al
movl %esi, %ecx
andl $0xfffffefe, %ecx       # imm = 0xFFFFFEFE
cmpl $0x4, %ecx
sete %cl
orb %al, %cl
je 0x14cee
movq %rdi, %rbx
cmpl $0x2, %ebp
jb 0x14b40
cmpl $0x1, 0x48(%rbx)
jle 0x14cfc
movq 0x78(%rbx), %rdi
testq %rdi, %rdi
je 0x14b86
cmpl $0x100, %ebp            # imm = 0x100
leaq 0x98a2(%rip), %rax      # 0x1e3f8
leaq 0xc92f(%rip), %rdx      # 0x2148c
cmovbq %rax, %rdx
movl %ebp, %r15d
andl $0x7, %r15d
leaq 0xc655(%rip), %rax      # 0x211c4
movslq (%rax,%r15,4), %rcx
addq %rax, %rcx
leaq 0xc941(%rip), %rsi      # 0x214be
xorl %eax, %eax
callq 0x20c0
jmp 0x14b8d
movl %ebp, %r15d
andl $0x7, %r15d
leal -0x2(%r15), %eax
cmpl $0x4, %eax
jae 0x14bda
andl $0x0, 0x74(%rbx)
andl $0x100, %ebp            # imm = 0x100
movl %ebp, 0x70(%rbx)
cmpl $0x5, %r15d
je 0x14c10
cmpl $0x4, %r15d
jne 0x14c77
pushq $0x1
popq %rsi
pushq $0xe
popq %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
movl %edx, %r8d
xorl %r9d, %r9d
callq 0x14061
testq %rax, %rax
je 0x14cdd
movb $0x33, (%rax)
jmp 0x14c77
xorl %r14d, %r14d
cmpl $0x1, %r15d
je 0x14c38
testl %r15d, %r15d
jne 0x14ce0
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x1354f
testq %rax, %rax
je 0x14cdd
movb $0x1, (%rax)
incq 0x60(%rbx)
movb $-0x34, 0x1(%rax)
jmp 0x14ce0
testl %ebp, %ebp
jne 0x14c5c
pushq $0x3
popq %rsi
movq %rbx, %rdi
callq 0x1354f
testq %rax, %rax
je 0x14cdd
movb $0x2, (%rax)
addq $0x2, 0x60(%rbx)
movw $0x9948, 0x1(%rax)      # imm = 0x9948
jmp 0x14c77
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x1354f
testq %rax, %rax
je 0x14cdd
movb $0x1, (%rax)
incq 0x60(%rbx)
movb $-0x70, 0x1(%rax)
jmp 0x14ce0
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x1354f
testq %rax, %rax
je 0x14cdd
movb $0x1, (%rax)
incq 0x60(%rbx)
movb $-0x67, 0x1(%rax)
xorl %r14d, %r14d
cmpl $0x0, 0x70(%rbx)
sete %r14b
leal 0x3(%r14), %esi
movq %rbx, %rdi
callq 0x1354f
testq %rax, %rax
je 0x14cdd
orl $0x2, %r14d
movb %r14b, (%rax)
movl %r14d, %ecx
addq %rcx, 0x60(%rbx)
cmpl $0x0, 0x70(%rbx)
je 0x14cac
incq %rax
jmp 0x14cb4
movb $0x48, 0x1(%rax)
addq $0x2, %rax
movb $-0x9, (%rax)
shlb $0x3, %r15b
addb $-0x2a, %r15b
movb %r15b, 0x1(%rax)
xorl %r14d, %r14d
pushq $0x2
popq %rsi
pushq $0xe
popq %rcx
movq %rbx, %rdi
xorl %edx, %edx
xorl %r8d, %r8d
callq 0x14d14
testl %eax, %eax
je 0x14ce0
movl (%rbx), %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc60a(%rip), %rdi      # 0x212ff
movl $0x3f9, %esi            # imm = 0x3F9
jmp 0x14d08
leaq 0xc5fc(%rip), %rdi      # 0x212ff
movl $0x3fa, %esi            # imm = 0x3FA
xorl %eax, %eax
callq 0x2080
callq 0x2040