// File: /workspace/github_c_makefile_star2_O2/theovosse[P]llgen/regexp.c
// Function: N2DFA
RegExp N2DFA(RegExp nfa) {
	long int mark = ++lastVisit;
	RegExp dfa;
	RegExp currState;
	ESet stateSet;
	RegExp newState;
	int ch;
	Boolean allMarked = false;
	
	dfa = InitRegExp();
	currentAutomaton = dfa;
	dfa->state.set = EClosure(AddElement(nfa, NULL));
	while (!allMarked) {
		 allMarked = true;
		 currState = dfa;
		 while (allMarked && currState != NULL) {
			 if (currState->lastVisit != mark) {
				 allMarked = false;
			 } else {
				 currState = currState->next;
			 }
		 }
		 if (currState != NULL) {
			 currState->lastVisit = mark;
			 for (ch = 0; ch != charSetSize; ch++) {
				 if ((stateSet = CollectTransitions(currState->state.set, ch)) != NULL) {
					 stateSet = EClosure(stateSet);
					 if ((newState = Member(stateSet, dfa)) == NULL) {
						 newState = InitRegExp();
						 newState->state.set = stateSet;
						 newState->info = CollectInfo(stateSet);
						 newState->next = dfa->next;
						 dfa->next = newState;
					 } else {
						 RemoveSet(stateSet);
					 }
					 currState->transitions = MakeTransition(ch, newState, currState->transitions);
				 }
			 }
		 }
	}
	for (currState = dfa; currState != NULL; currState = currState->next) {
		RemoveSet(currState->state.set);
		currState->state.set = NULL;
	}
	RenumberDFA(dfa);
	return (dfa);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
movq 0xe199(%rip), %r15      # 0x1ace8
incq %r15
movq %r15, 0xe18f(%rip)      # 0x1ace8
callq 0xc0c7
movq %rax, %rbx
movq %rax, 0xe178(%rip)      # 0x1ace0
xorl %r13d, %r13d
movq %r14, %rdi
xorl %esi, %esi
callq 0xbec0
movq %rax, %r14
movq %rax, %rdi
callq 0xcd17
movq %rbx, 0x8(%rsp)
movq %r14, 0x28(%rbx)
movq %r15, 0x10(%rsp)
testw %r13w, %r13w
jne 0xccda
movw $0xffff, %ax            # imm = 0xFFFF
movq 0x8(%rsp), %rcx
movl %eax, %r13d
testw %ax, %ax
je 0xcbbf
testq %rcx, %rcx
je 0xcbbf
xorl %eax, %eax
cmpq %r15, 0x20(%rcx)
jne 0xcba1
movq 0x18(%rcx), %rcx
movl %r13d, %eax
jmp 0xcba1
testq %rcx, %rcx
je 0xcb8e
movq %r15, 0x20(%rcx)
movq %rcx, 0x18(%rsp)
leaq 0x28(%rcx), %rax
movq %rax, 0x20(%rsp)
xorl %ebp, %ebp
cmpl 0xb67e(%rip), %ebp      # 0x1825c
je 0xccd0
movq 0x20(%rsp), %r12
xorl %r14d, %r14d
movq (%r12), %r12
testq %r12, %r12
je 0xcc33
movq (%r12), %rbx
movq (%rbx), %rbx
testq %rbx, %rbx
je 0xcc2d
cmpl %ebp, (%rbx)
jne 0xcc27
movq 0x8(%rbx), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xbf94
testw %ax, %ax
jne 0xcc27
movq %r15, %rdi
movq %r14, %rsi
callq 0xbec0
movq %rax, %r14
addq $0x10, %rbx
jmp 0xcbf9
addq $0x8, %r12
jmp 0xcbec
testq %r14, %r14
je 0xccc9
movq %r14, %rdi
callq 0xcd17
movq 0x8(%rsp), %r15
testq %r15, %r15
je 0xcc65
movq 0x28(%r15), %rsi
movq %r14, %rdi
callq 0xbfd5
testw %ax, %ax
jne 0xccac
movq 0x18(%r15), %r15
jmp 0xcc49
callq 0xc0c7
movq %rax, %r15
movq %r14, 0x28(%rax)
xorl %eax, %eax
testq %r14, %r14
je 0xcc95
movq (%r14), %rcx
movq 0x10(%rcx), %rcx
testq %rcx, %rcx
je 0xcc8f
movq (%rcx), %rdi
movq %rax, %rsi
callq 0xbec0
movq 0x8(%r14), %r14
jmp 0xcc73
movq %rax, 0x10(%r15)
movq 0x8(%rsp), %rcx
movq 0x18(%rcx), %rax
movq %rax, 0x18(%r15)
movq %r15, 0x18(%rcx)
jmp 0xccb4
movq %r14, %rdi
callq 0xbf31
movq 0x18(%rsp), %rbx
movq (%rbx), %rdx
movl %ebp, %edi
movq %r15, %rsi
callq 0xbe4d
movq %rax, (%rbx)
incl %ebp
jmp 0xcbd8
movq 0x10(%rsp), %r15
jmp 0xcb8e
movq 0x8(%rsp), %rbx
testq %rbx, %rbx
je 0xccf8
movq 0x28(%rbx), %rdi
callq 0xbf31
andq $0x0, 0x28(%rbx)
movq 0x18(%rbx), %rbx
jmp 0xccdf
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xcdb8
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq