// File: /workspace/github_c_makefile_star2_O0/mmcco[P]sljit/regex_src/regexJIT.c
// Function: generate_search_states
static int generate_search_states(struct compiler_common *compiler_common)
{
	struct stack_item *transitions_ptr = compiler_common->dfa_transitions;
	struct stack_item *transitions_end = transitions_ptr + compiler_common->dfa_size;
	struct stack_item *search_states_ptr;
	struct stack_item *rng_start = NULL;

	compiler_common->terms_size = !(compiler_common->flags & REGEX_FAKE_MATCH_END) ? 1 : 2;
	compiler_common->longest_range_size = 0;
	compiler_common->search_states = malloc(sizeof(struct stack_item) * compiler_common->dfa_size);
	if (!compiler_common->search_states)
		return REGEX_MEMORY_ERROR;

	search_states_ptr = compiler_common->search_states;
	while (transitions_ptr < transitions_end) {
		switch (transitions_ptr->type) {
		case type_begin:
		case type_end:
			search_states_ptr->type = 0;
			break;

		case type_char:
			search_states_ptr->type = compiler_common->terms_size++;
			break;

		case type_newline:
			if (transitions_ptr->value)
				search_states_ptr->type = 1;
			else
				search_states_ptr->type = compiler_common->terms_size++;
			SLJIT_ASSERT(search_states_ptr->type == 1 || search_states_ptr->type == 2);
			break;

		case type_id:
			if (transitions_ptr->value > 0)
				compiler_common->flags |= REGEX_ID_CHECK;
			search_states_ptr->type = -1;
			break;

		case type_rng_start:
			search_states_ptr->type = compiler_common->terms_size;
			rng_start = search_states_ptr;
			break;

		case type_rng_end:
			search_states_ptr->type = compiler_common->terms_size++;
			/* Ok, this is a blunt over estimation :) */
			if (compiler_common->longest_range_size < search_states_ptr - rng_start)
				compiler_common->longest_range_size = search_states_ptr - rng_start;
			break;

		default:
			search_states_ptr->type = -1;
			break;
		}
		search_states_ptr->value = -1;
		search_states_ptr++;
		transitions_ptr++;
	}
	return REGEX_NO_ERROR;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x38(%rcx), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rax
movl 0x30(%rax), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
setne %dl
xorb $-0x1, %dl
movl $0x2, %eax
movl $0x1, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movslq %eax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x50(%rax)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
shlq $0x3, %rdi
callq 0x20b0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x60(%rax)
jne 0x53b6
movl $0x1, -0x4(%rbp)
jmp 0x5554
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x554d
movq -0x18(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x38(%rbp)
subq $0x6, %rax
ja 0x551b
movq -0x38(%rbp), %rax
leaq 0x1a39d(%rip), %rcx     # 0x1f78c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x28(%rbp), %rax
movl $0x0, (%rax)
jmp 0x5525
movq -0x10(%rbp), %rcx
movq 0x40(%rcx), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x40(%rcx)
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
jmp 0x5525
movq -0x18(%rbp), %rax
cmpl $0x0, 0x4(%rax)
je 0x543d
movq -0x28(%rbp), %rax
movl $0x1, (%rax)
jmp 0x5458
movq -0x10(%rbp), %rcx
movq 0x40(%rcx), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x40(%rcx)
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
jmp 0x545a
movq -0x28(%rbp), %rax
cmpl $0x1, (%rax)
je 0x5484
movq -0x28(%rbp), %rax
cmpl $0x2, (%rax)
je 0x5484
leaq 0x1a39d(%rip), %rdi     # 0x1f810
movl $0x4af, %esi            # imm = 0x4AF
movb $0x0, %al
callq 0x2060
callq 0x2040
jmp 0x5486
jmp 0x5525
movq -0x18(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jle 0x54a5
movq -0x10(%rbp), %rax
movl 0x30(%rax), %ecx
orl $0x100, %ecx            # imm = 0x100
movl %ecx, 0x30(%rax)
movq -0x28(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
jmp 0x5525
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0x5525
movq -0x10(%rbp), %rcx
movq 0x40(%rcx), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x40(%rcx)
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %rdx
subq %rdx, %rcx
sarq $0x3, %rcx
cmpq %rcx, %rax
jge 0x5519
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %rax
subq %rax, %rcx
sarq $0x3, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x50(%rax)
jmp 0x5525
movq -0x28(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movq -0x28(%rbp), %rax
movl $0xffffffff, 0x4(%rax)  # imm = 0xFFFFFFFF
movq -0x28(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x18(%rbp)
jmp 0x53c2
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)