// File: /workspace/github_c_makefile_star2_O0/mmcco[P]sljit/regex_src/regexJIT.c
// Function: generate_transitions
static int generate_transitions(struct compiler_common *compiler_common)
{
	struct stack *stack = &compiler_common->stack;
	struct stack *depth = &compiler_common->depth;
	struct stack_item *transitions_ptr;
	struct stack_item *item;

	stack_init(depth);
	compiler_common->dfa_transitions = malloc(sizeof(struct stack_item) * compiler_common->dfa_size);
	if (!compiler_common->dfa_transitions)
		return REGEX_MEMORY_ERROR;

	/* Go through the items of the stack and generate the necessary branches and jumps (edges of DFA). */
	transitions_ptr = compiler_common->dfa_transitions + compiler_common->dfa_size;
	while (stack->count > 0) {
		item = stack_pop(stack);
		switch (item->type) {
		case type_begin:
		case type_open_br:
			item = stack_pop(depth);
			if (item->type == type_select)
				PUT_TRANSITION(type_branch, item->value + 1);
			else
				SLJIT_ASSERT(item->type == type_close_br);
			if (stack->count == 0)
				PUT_TRANSITION(type_begin, 0);
			else
				transitions_ptr = handle_iteratives(transitions_ptr, compiler_common->dfa_transitions, depth);
			break;

		case type_end:
		case type_close_br:
			if (item->type == type_end)
				*--transitions_ptr = *item;
			if (stack_push(depth, type_close_br, transitions_ptr - compiler_common->dfa_transitions))
				return REGEX_MEMORY_ERROR;
			break;

		case type_select:
			item = stack_top(depth);
			if (item->type == type_select) {
				SLJIT_ASSERT(compiler_common->dfa_transitions[item->value].type == type_jump);
				PUT_TRANSITION(type_branch, item->value + 1);
				PUT_TRANSITION(type_jump, item->value);
				item->value = transitions_ptr - compiler_common->dfa_transitions;
			}
			else {
				SLJIT_ASSERT(item->type == type_close_br);
				item->type = type_select;
				PUT_TRANSITION(type_jump, item->value);
				item->value = transitions_ptr - compiler_common->dfa_transitions;
			}
			break;

		case type_asterisk:
		case type_plus_sign:
		case type_qestion_mark:
			if (item->type != type_qestion_mark)
				PUT_TRANSITION(type_branch, 0);
			if (stack_push(depth, item->type, transitions_ptr - compiler_common->dfa_transitions))
				return REGEX_MEMORY_ERROR;
			break;

		case type_char:
		case type_newline:
		case type_rng_start:
			/* Requires handle_iteratives. */
			*--transitions_ptr = *item;
			transitions_ptr = handle_iteratives(transitions_ptr, compiler_common->dfa_transitions, depth);
			break;

		default:
			*--transitions_ptr = *item;
			break;
		}
	}

	SLJIT_ASSERT(compiler_common->dfa_transitions == transitions_ptr);
	SLJIT_ASSERT(depth->count == 0);
	return REGEX_NO_ERROR;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x5930
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
shlq $0x3, %rdi
callq 0x20b0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x58(%rax)
jne 0x4f4c
movl $0x1, -0x4(%rbp)
jmp 0x52f8
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x38(%rcx), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x14(%rax)
jle 0x52a1
movq -0x18(%rbp), %rdi
callq 0x5b40
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x38(%rbp)
subq $0x11, %rax
ja 0x5282
movq -0x38(%rbp), %rax
leaq 0x1a7a3(%rip), %rcx     # 0x1f744
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x20(%rbp), %rdi
callq 0x5b40
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpl $0xe, (%rax)
jne 0x4feb
jmp 0x4fc2
movq -0x28(%rbp), %rax
addq $-0x8, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl $0xa, (%rax)
movq -0x30(%rbp), %rax
movl 0x4(%rax), %ecx
addl $0x1, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x4(%rax)
jmp 0x5012
jmp 0x4fed
movq -0x30(%rbp), %rax
cmpl $0xd, (%rax)
je 0x500e
leaq 0x1a813(%rip), %rdi     # 0x1f810
movl $0x3e7, %esi            # imm = 0x3E7
movb $0x0, %al
callq 0x2060
callq 0x2040
jmp 0x5010
jmp 0x5012
movq -0x18(%rbp), %rax
cmpl $0x0, 0x14(%rax)
jne 0x5041
jmp 0x501e
movq -0x28(%rbp), %rax
addq $-0x8, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl $0x0, (%rax)
movq -0x28(%rbp), %rax
movl $0x0, 0x4(%rax)
jmp 0x505a
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rsi
movq -0x20(%rbp), %rdx
callq 0x9bc0
movq %rax, -0x28(%rbp)
jmp 0x529c
movq -0x30(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x5082
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $-0x8, %rcx
movq %rcx, -0x28(%rbp)
movq -0x30(%rbp), %rcx
movq (%rcx), %rcx
movq %rcx, -0x8(%rax)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x58(%rcx), %rcx
subq %rcx, %rax
sarq $0x3, %rax
movl %eax, %edx
movl $0xd, %esi
callq 0x8980
cmpl $0x0, %eax
je 0x50b6
movl $0x1, -0x4(%rbp)
jmp 0x52f8
jmp 0x529c
movq -0x20(%rbp), %rdi
callq 0x9d20
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpl $0xe, (%rax)
jne 0x5174
jmp 0x50d7
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x30(%rbp), %rcx
movslq 0x4(%rcx), %rcx
cmpl $0xb, (%rax,%rcx,8)
je 0x5105
leaq 0x1a71c(%rip), %rdi     # 0x1f810
movl $0x3f9, %esi            # imm = 0x3F9
movb $0x0, %al
callq 0x2060
callq 0x2040
jmp 0x5107
jmp 0x5109
movq -0x28(%rbp), %rax
addq $-0x8, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl $0xa, (%rax)
movq -0x30(%rbp), %rax
movl 0x4(%rax), %ecx
addl $0x1, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x4(%rax)
jmp 0x5132
movq -0x28(%rbp), %rax
addq $-0x8, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl $0xb, (%rax)
movq -0x30(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x58(%rcx), %rcx
subq %rcx, %rax
sarq $0x3, %rax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x4(%rax)
jmp 0x51e3
jmp 0x5176
movq -0x30(%rbp), %rax
cmpl $0xd, (%rax)
je 0x5197
leaq 0x1a68a(%rip), %rdi     # 0x1f810
movl $0x3ff, %esi            # imm = 0x3FF
movb $0x0, %al
callq 0x2060
callq 0x2040
jmp 0x5199
movq -0x30(%rbp), %rax
movl $0xe, (%rax)
movq -0x28(%rbp), %rax
addq $-0x8, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl $0xb, (%rax)
movq -0x30(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x58(%rcx), %rcx
subq %rcx, %rax
sarq $0x3, %rax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x4(%rax)
jmp 0x529c
movq -0x30(%rbp), %rax
cmpl $0x11, (%rax)
je 0x5216
jmp 0x51f3
movq -0x28(%rbp), %rax
addq $-0x8, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl $0xa, (%rax)
movq -0x28(%rbp), %rax
movl $0x0, 0x4(%rax)
jmp 0x5216
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movl (%rax), %esi
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x58(%rcx), %rcx
subq %rcx, %rax
sarq $0x3, %rax
movl %eax, %edx
callq 0x8980
cmpl $0x0, %eax
je 0x524b
movl $0x1, -0x4(%rbp)
jmp 0x52f8
jmp 0x529c
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $-0x8, %rcx
movq %rcx, -0x28(%rbp)
movq -0x30(%rbp), %rcx
movq (%rcx), %rcx
movq %rcx, -0x8(%rax)
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rsi
movq -0x20(%rbp), %rdx
callq 0x9bc0
movq %rax, -0x28(%rbp)
jmp 0x529c
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $-0x8, %rcx
movq %rcx, -0x28(%rbp)
movq -0x30(%rbp), %rcx
movq (%rcx), %rcx
movq %rcx, -0x8(%rax)
jmp 0x4f67
jmp 0x52a3
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
cmpq -0x28(%rbp), %rax
je 0x52c9
leaq 0x1a558(%rip), %rdi     # 0x1f810
movl $0x41d, %esi            # imm = 0x41D
movb $0x0, %al
callq 0x2060
callq 0x2040
jmp 0x52cb
jmp 0x52cd
movq -0x20(%rbp), %rax
cmpl $0x0, 0x14(%rax)
je 0x52ef
leaq 0x1a532(%rip), %rdi     # 0x1f810
movl $0x41e, %esi            # imm = 0x41E
movb $0x0, %al
callq 0x2060
callq 0x2040
jmp 0x52f1
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)