// File: /workspace/github_c_makefile_star2_O0/mmcco[P]sljit/sljit_src/sljitNativeX86_common.c
// Function: generate_near_jump_code
static u_char* generate_near_jump_code(struct sljit_jump *jump, u_char *code_ptr, u_char *code, int type)
{
	int short_jump;
	unsigned long label_addr;

	if (jump->flags & JUMP_LABEL)
		label_addr = (unsigned long)(code + jump->u.label->size);
	else
		label_addr = jump->u.target;
	short_jump = (long)(label_addr - (jump->addr + 2)) >= -128 && (long)(label_addr - (jump->addr + 2)) <= 127;

#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
	if ((long)(label_addr - (jump->addr + 1)) > HALFWORD_MAX || (long)(label_addr - (jump->addr + 1)) < HALFWORD_MIN)
		return generate_far_jump_code(jump, code_ptr, type);
#endif

	if (type == SLJIT_JUMP) {
		if (short_jump)
			*code_ptr++ = JMP_i8;
		else
			*code_ptr++ = JMP_i32;
		jump->addr++;
	}
	else if (type >= SLJIT_FAST_CALL) {
		short_jump = 0;
		*code_ptr++ = CALL_i32;
		jump->addr++;
	}
	else if (short_jump) {
		*code_ptr++ = get_jump_code(type) - 0x10;
		jump->addr++;
	}
	else {
		*code_ptr++ = GROUP_0F;
		*code_ptr++ = get_jump_code(type);
		jump->addr += 2;
	}

	if (short_jump) {
		jump->flags |= PATCH_MB;
		code_ptr += sizeof(s_char);
	} else {
		jump->flags |= PATCH_MW;
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
		code_ptr += sizeof(long);
#else
		code_ptr += sizeof(int);
#endif
	}

	return code_ptr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0x1970f
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rcx
addq 0x10(%rcx), %rax
movq %rax, -0x30(%rbp)
jmp 0x1971b
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
addq $0x2, %rax
subq %rax, %rcx
xorl %eax, %eax
cmpq $-0x80, %rcx
movb %al, -0x31(%rbp)
jl 0x19756
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
addq $0x2, %rcx
subq %rcx, %rax
cmpq $0x7f, %rax
setle %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x28(%rbp)
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
addq $0x1, %rcx
subq %rcx, %rax
cmpq $0x7fffffff, %rax       # imm = 0x7FFFFFFF
jg 0x19797
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
addq $0x1, %rcx
subq %rcx, %rax
cmpq $-0x80000000, %rax      # imm = 0x80000000
jge 0x197b0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x24(%rbp), %edx
callq 0x19900
movq %rax, -0x8(%rbp)
jmp 0x198ea
cmpl $0x16, -0x24(%rbp)
jne 0x197f7
cmpl $0x0, -0x28(%rbp)
je 0x197d0
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
movb $-0x15, (%rax)
jmp 0x197e2
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
movb $-0x17, (%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
jmp 0x198a2
cmpl $0x17, -0x24(%rbp)
jl 0x19828
movl $0x0, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
movb $-0x18, (%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
jmp 0x198a0
cmpl $0x0, -0x28(%rbp)
je 0x19861
movl -0x24(%rbp), %edi
callq 0x29e90
movzbl %al, %eax
subl $0x10, %eax
movb %al, %cl
movq -0x18(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x18(%rbp)
movb %cl, (%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
jmp 0x1989e
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
movb $0xf, (%rax)
movl -0x24(%rbp), %edi
callq 0x29e90
movb %al, %cl
movq -0x18(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x18(%rbp)
movb %cl, (%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x2, %rcx
movq %rcx, 0x8(%rax)
jmp 0x198a0
jmp 0x198a2
cmpl $0x0, -0x28(%rbp)
je 0x198c6
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
orq $0x4, %rcx
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x198e2
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
orq $0x8, %rcx
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)