// File: /workspace/github_c_makefile_star2_O3/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 0x16aa3
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 0x16ab1
movq %rdi, %rbx
cmpl $0x2, %ebp
jb 0x168dd
cmpl $0x1, 0x48(%rbx)
jle 0x16abf
movq 0x78(%rbx), %rdi
testq %rdi, %rdi
je 0x16923
cmpl $0x100, %ebp            # imm = 0x100
leaq 0x9b45(%rip), %rax      # 0x20438
leaq 0xcbd2(%rip), %rdx      # 0x234cc
cmovbq %rax, %rdx
movl %ebp, %r15d
andl $0x7, %r15d
leaq 0xc8f8(%rip), %rax      # 0x23204
movslq (%rax,%r15,4), %rcx
addq %rax, %rcx
leaq 0xcbe4(%rip), %rsi      # 0x234fe
xorl %eax, %eax
callq 0x20c0
jmp 0x1692a
movl %ebp, %r15d
andl $0x7, %r15d
leal -0x2(%r15), %eax
cmpl $0x4, %eax
jae 0x16981
movl $0x0, 0x74(%rbx)
andl $0x100, %ebp            # imm = 0x100
movl %ebp, 0x70(%rbx)
cmpl $0x5, %r15d
je 0x169b9
cmpl $0x4, %r15d
jne 0x16a2a
movq %rbx, %rdi
movl $0x1, %esi
movl $0xe, %edx
xorl %ecx, %ecx
movl $0xe, %r8d
xorl %r9d, %r9d
callq 0x15da2
testq %rax, %rax
je 0x16aa0
movb $0x33, (%rax)
jmp 0x16a2a
xorl %r14d, %r14d
cmpl $0x1, %r15d
je 0x169e3
testl %r15d, %r15d
jne 0x16aa3
movl $0x2, %esi
movq %rbx, %rdi
callq 0x15218
testq %rax, %rax
je 0x16aa0
movb $0x1, (%rax)
incq 0x60(%rbx)
movb $-0x34, 0x1(%rax)
jmp 0x16aa3
testl %ebp, %ebp
jne 0x16a09
movl $0x3, %esi
movq %rbx, %rdi
callq 0x15218
testq %rax, %rax
je 0x16aa0
movb $0x2, (%rax)
addq $0x2, 0x60(%rbx)
movw $0x9948, 0x1(%rax)      # imm = 0x9948
jmp 0x16a2a
movl $0x2, %esi
movq %rbx, %rdi
callq 0x15218
testq %rax, %rax
je 0x16aa0
movb $0x1, (%rax)
incq 0x60(%rbx)
movb $-0x70, 0x1(%rax)
jmp 0x16aa3
movl $0x2, %esi
movq %rbx, %rdi
callq 0x15218
testq %rax, %rax
je 0x16aa0
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 0x15218
testq %rax, %rax
je 0x16aa0
orl $0x2, %r14d
movb %r14b, (%rax)
movl %r14d, %ecx
addq %rcx, 0x60(%rbx)
cmpl $0x0, 0x70(%rbx)
je 0x16a5f
incq %rax
jmp 0x16a67
movb $0x48, 0x1(%rax)
addq $0x2, %rax
movb $-0x9, (%rax)
shlb $0x3, %r15b
addb $-0x2a, %r15b
movb %r15b, 0x1(%rax)
xorl %r14d, %r14d
movq %rbx, %rdi
movl $0x1, %esi
movl $0xe, %edx
xorl %ecx, %ecx
movl $0x2, %r8d
xorl %r9d, %r9d
callq 0x15da2
testq %rax, %rax
je 0x16aa0
movb $-0x77, (%rax)
jmp 0x16aa3
movl (%rbx), %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc887(%rip), %rdi      # 0x2333f
movl $0x3f9, %esi            # imm = 0x3F9
jmp 0x16acb
leaq 0xc879(%rip), %rdi      # 0x2333f
movl $0x3fa, %esi            # imm = 0x3FA
xorl %eax, %eax
callq 0x2080
callq 0x2040