// File: /workspace/github_c_makefile_star2_O1/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 0x16ac8
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 0x16ad6
movq %rdi, %rbx
cmpl $0x2, %ebp
jl 0x168d3
cmpl $0x1, 0x48(%rbx)
jle 0x16ae4
movq 0x78(%rbx), %rdi
testq %rdi, %rdi
je 0x16915
cmpl $0x100, %ebp            # imm = 0x100
leaq 0x9a77(%rip), %rax      # 0x20360
leaq 0xcb0c(%rip), %rdx      # 0x233fc
cmovbq %rax, %rdx
movl %ebp, %eax
andl $0x7, %eax
leaq 0xc834(%rip), %rsi      # 0x23134
movslq (%rsi,%rax,4), %rcx
addq %rsi, %rcx
leaq 0xcb20(%rip), %rsi      # 0x2342e
xorl %eax, %eax
callq 0x20b0
movl %ebp, %r15d
andl $0x7, %r15d
leal -0x2(%r15), %r14d
cmpl $0x4, %r14d
jae 0x169af
movl $0x0, 0x74(%rbx)
andl $0x100, %ebp            # imm = 0x100
movl %ebp, 0x70(%rbx)
cmpl $0x5, %r15d
je 0x1697d
cmpl $0x4, %r15d
jne 0x16a39
movq %rbx, %rdi
movl $0x1, %esi
movl $0xe, %edx
xorl %ecx, %ecx
movl $0xe, %r8d
xorl %r9d, %r9d
callq 0x15e07
testq %rax, %rax
je 0x16ac5
movb $0x33, (%rax)
cmpl $0x5, %r15d
jne 0x16a39
cmpl $0x0, 0x70(%rbx)
je 0x16a0d
movl $0x2, %esi
movq %rbx, %rdi
callq 0x152be
testq %rax, %rax
je 0x16ac5
movq %rax, %rcx
incq %rcx
movb $0x1, (%rax)
incq 0x60(%rbx)
jmp 0x16a36
xorl %r14d, %r14d
cmpl $0x1, %r15d
je 0x169e7
testl %r15d, %r15d
jne 0x16ac8
movl $0x2, %esi
movq %rbx, %rdi
callq 0x152be
testq %rax, %rax
je 0x16ac5
movb $0x1, (%rax)
incq 0x60(%rbx)
movb $-0x34, 0x1(%rax)
jmp 0x16ac8
movl $0x2, %esi
movq %rbx, %rdi
callq 0x152be
testq %rax, %rax
je 0x16ac5
movb $0x1, (%rax)
incq 0x60(%rbx)
movb $-0x70, 0x1(%rax)
jmp 0x16ac8
movl $0x3, %esi
movq %rbx, %rdi
callq 0x152be
testq %rax, %rax
je 0x16ac5
movb $0x2, (%rax)
addq $0x2, 0x60(%rbx)
movq %rax, %rcx
addq $0x2, %rcx
movb $0x48, 0x1(%rax)
movb $-0x67, (%rcx)
xorl %r15d, %r15d
cmpl $0x0, 0x70(%rbx)
sete %r15b
leal 0x3(%r15), %esi
movq %rbx, %rdi
callq 0x152be
testq %rax, %rax
je 0x16ac5
orl $0x2, %r15d
movb %r15b, (%rax)
movl %r15d, %ecx
addq %rcx, 0x60(%rbx)
cmpl $0x0, 0x70(%rbx)
je 0x16a6e
incq %rax
jmp 0x16a76
movb $0x48, 0x1(%rax)
addq $0x2, %rax
movb $-0x9, (%rax)
leal (,%r14,8), %ecx
orb $-0x1a, %cl
cmpl $0x4, %r14d
movzbl %cl, %ecx
movl $0xc6, %edx
cmovbl %ecx, %edx
movb %dl, 0x1(%rax)
xorl %r14d, %r14d
movq %rbx, %rdi
movl $0x1, %esi
movl $0xe, %edx
xorl %ecx, %ecx
movl $0x2, %r8d
xorl %r9d, %r9d
callq 0x15e07
testq %rax, %rax
je 0x16ac0
movb $-0x77, (%rax)
jmp 0x16ac8
cmpl $0x0, (%rbx)
je 0x16ac8
movl (%rbx), %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc792(%rip), %rdi      # 0x2326f
movl $0x3f9, %esi            # imm = 0x3F9
jmp 0x16af0
leaq 0xc784(%rip), %rdi      # 0x2326f
movl $0x3fa, %esi            # imm = 0x3FA
xorl %eax, %eax
callq 0x2080
callq 0x2040