// File: /workspace/github_c_makefile_star2_O1/mmcco[P]sljit/regex_src/regexJIT.c
// Function: compile_range_check
static long compile_range_check(struct compiler_common *compiler_common, long ind)
{
	struct sljit_compiler *compiler = compiler_common->compiler;
	struct stack_item *dfa_transitions = compiler_common->dfa_transitions;
	struct sljit_jump **range_jump_list = compiler_common->range_jump_list;
	int invert = dfa_transitions[ind].value;
	struct sljit_label *label;
	long no_states;
	long offset;
	int init_range = 1, prev_value = 0;

	ind++;

	while (dfa_transitions[ind].type != type_rng_end) {
		if (dfa_transitions[ind].type == type_rng_char) {
			EMIT_CMP(*range_jump_list, SLJIT_EQUAL, R_CURR_CHAR, 0, SLJIT_IMM, dfa_transitions[ind].value);
			range_jump_list++;
		}
		else {
			SLJIT_ASSERT(dfa_transitions[ind].type == type_rng_left);
			if (init_range) {
				EMIT_OP1(SLJIT_MOV, R_TEMP, 0, R_CURR_CHAR, 0);
				init_range = 0;
			}
			if (dfa_transitions[ind].value != prev_value) {
				/* Best compatibility to all archs. */
				prev_value -= dfa_transitions[ind].value;
				if (prev_value < 0) {
					EMIT_OP2(SLJIT_SUB, R_TEMP, 0, R_TEMP, 0, SLJIT_IMM, -prev_value);
				}
				else {
					EMIT_OP2(SLJIT_ADD, R_TEMP, 0, R_TEMP, 0, SLJIT_IMM, prev_value);
				}
				prev_value = dfa_transitions[ind].value;
			}
			EMIT_CMP(*range_jump_list, SLJIT_LESS_EQUAL, R_TEMP, 0, SLJIT_IMM, dfa_transitions[ind + 1].value - dfa_transitions[ind].value);
			range_jump_list++;
			ind++;
		}
		ind++;
	}

	*range_jump_list = NULL;

	if (!invert) {
		no_states = compiler_common->no_states;
		offset = TERM_OFFSET_OF(compiler_common->search_states[ind].type, 1);
		EMIT_OP1(SLJIT_MOV, R_TEMP, 0, SLJIT_MEM1(R_CURR_STATE), offset);
		EMIT_OP1(SLJIT_MOV, SLJIT_MEM1(R_CURR_STATE), offset, SLJIT_IMM, -1);
		CHECK(sljit_emit_ijump(compiler, SLJIT_JUMP, SLJIT_MEM2(R_CURR_STATE, R_TEMP), 0));

		EMIT_LABEL(label);
		range_set_label(compiler_common->range_jump_list, label);
		/* Clears the jump list. */
		*compiler_common->range_jump_list = NULL;
	}
	return ind;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r15
movq 0x58(%rdi), %rbp
movq 0x68(%rdi), %rdx
movq %rdi, 0x10(%rsp)
movq 0x78(%rdi), %r13
movl 0x4(%rbp,%rsi,8), %eax
movl %eax, 0x1c(%rsp)
movq $0x0, 0x20(%rsp)
movl $0x1, %r14d
movq %rdx, 0x8(%rsp)
leaq 0x1(%r15), %rbx
movl 0x8(%rbp,%r15,8), %eax
cmpl $0x7, %eax
je 0x5b37
cmpl $0x8, %eax
jne 0x5c08
testl %r14d, %r14d
je 0x5b19
movq %rdx, %rdi
movl $0x20, %esi
movl $0x3, %edx
xorl %ecx, %ecx
movl $0x2, %r8d
xorl %r9d, %r9d
callq 0x9cef
movq 0x8(%rsp), %rdx
movl $0x0, %r12d
testl %eax, %eax
jne 0x5cb2
movq 0x20(%rsp), %rax
subl 0xc(%rbp,%r15,8), %eax
je 0x5bb3
js 0x5b70
movl %eax, %eax
movq %rdx, %rdi
movl $0x60, %esi
jmp 0x5b7a
movslq 0xc(%rbp,%r15,8), %r9
movq %rdx, %rdi
xorl %esi, %esi
movl $0x2, %edx
xorl %ecx, %ecx
movl $0x40, %r8d
callq 0x1133a
movq 0x8(%rsp), %rdx
movq %rax, (%r13)
movl $0x0, %r12d
testq %rax, %rax
jne 0x5bfc
jmp 0x5cb2
negl %eax
movq %rdx, %rdi
movl $0x62, %esi
movl $0x3, %edx
xorl %ecx, %ecx
movl $0x3, %r8d
xorl %r9d, %r9d
pushq %rax
pushq $0x40
callq 0xb069
movq 0x18(%rsp), %rdx
addq $0x10, %rsp
movl $0x0, %r12d
testl %eax, %eax
jne 0x5cb2
movl 0xc(%rbp,%r15,8), %eax
movq %rax, 0x20(%rsp)
movslq 0x14(%rbp,%r15,8), %r9
movslq 0xc(%rbp,%r15,8), %rax
subq %rax, %r9
xorl %r14d, %r14d
movq %rdx, %rdi
movl $0x5, %esi
movl $0x3, %edx
xorl %ecx, %ecx
movl $0x40, %r8d
callq 0x1133a
movq 0x8(%rsp), %rdx
movq %rax, (%r13)
movl $0x0, %r12d
testq %rax, %rax
je 0x5cb2
addq $0x2, %r15
movq %r15, %rbx
addq $0x8, %r13
movq %rbx, %r15
jmp 0x5acd
cmpl $0x6, %eax
jne 0x5d12
movq $0x0, (%r13)
cmpl $0x0, 0x1c(%rsp)
je 0x5c28
movq %rbx, %r12
jmp 0x5cb2
movq 0x10(%rsp), %rcx
movq 0x60(%rcx), %rax
movslq 0x8(%rax,%r15,8), %rax
imulq 0x48(%rcx), %rax
leaq 0x8(,%rax,8), %r15
xorl %r12d, %r12d
movq %rdx, %rdi
movl $0x20, %esi
movl $0x3, %edx
xorl %ecx, %ecx
movl $0x8c, %r8d
movq %r15, %r9
callq 0x9cef
movq 0x8(%rsp), %r14
testl %eax, %eax
jne 0x5cb2
movq %r14, %rdi
movl $0x20, %esi
movl $0x8c, %edx
movq %r15, %rcx
movl $0x40, %r8d
movq $-0x1, %r9
callq 0x9cef
testl %eax, %eax
je 0x5c97
xorl %r12d, %r12d
jmp 0x5cb2
xorl %r12d, %r12d
movq %r14, %rdi
movl $0x16, %esi
movl $0x38c, %edx            # imm = 0x38C
xorl %ecx, %ecx
callq 0xfee5
testl %eax, %eax
je 0x5cc4
movq %r12, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0xfbc1
testq %rax, %rax
je 0x5c92
movq %rax, %r14
movq 0x10(%rsp), %rax
movq 0x78(%rax), %r15
movq (%r15), %rdi
testq %rdi, %rdi
je 0x5cfd
addq $0x8, %r15
movq %r14, %rsi
callq 0x79c2
movq (%r15), %rdi
addq $0x8, %r15
testq %rdi, %rdi
jne 0x5ce9
movq 0x10(%rsp), %rax
movq 0x78(%rax), %rax
movq $0x0, (%rax)
jmp 0x5c20
leaq 0xd9c3(%rip), %rdi      # 0x136dc
movl $0x6d8, %esi            # imm = 0x6D8
xorl %eax, %eax
callq 0x2080
callq 0x2050