// File: /workspace/github_c_makefile_star2_O1/theovosse[P]llgen/regexp.c
// Function: MinimizeDFA
void MinimizeDFA(RegExp dfa) {
	RegExp state;
	ESet partition = NULL, nPartition;
	ESet element, element2;
	ESet nSet1, nSet2;
	Boolean changes;
	Transition tr;

	currentAutomaton = dfa;
	push_localadm();
	/* Partitioning: one class for each type final state, plus one for the rest */
	for (state = dfa; state != NULL; state = state->next) {
		for (element = partition; element != NULL; element = element->next) {
			ESet stateSet = element->element;
			if ((singleAnswer? FirstAnswerIdentical(state->info, ((RegExp) (stateSet->element))->info):
							   SetEqual(state->info, ((RegExp) (stateSet->element))->info))) {
				element->element = AddElement(state, element->element);
				state->state.set = element;
				break;
			}
		}
		if (element == NULL) {
			ESet stateSet = AddElement(state, NULL);
			partition = AddElement(stateSet, partition);
			state->state.set = partition;
		}
	}
	/* Refine partitioning */
	do {
		changes = false;
		nPartition = NULL;
		for (element = partition; element != NULL; element = element->next) {
			element2 = element->element;
			nSet1 = AddElement(element2->element, NULL);
			nSet2 = NULL;
			element2 = element2->next;
			/* Check if all other members of this partition have the same destinations as the first element */
			while (element2 != NULL) {
				if (AllDestinationsEqual(nSet1->element, element2->element)) {
					nSet1 = AddElement(element2->element, nSet1);
				} else {
					nSet2 = AddElement(element2->element, nSet2);
				}
				element2 = element2->next;
			}
			nPartition = AddElement(nSet1, nPartition);
			for (element2 = nSet1; element2 != NULL; element2 = element2->next) {
				((RegExp) (element2->element))->state.set = nPartition;
			}
			if (nSet2 != NULL) {
				nPartition = AddElement(nSet2, nPartition);
				changes = true;
				for (element2 = nSet2; element2 != NULL; element2 = element2->next) {
					((RegExp) (element2->element))->state.set = nPartition;
				}
			}
		}
		RemoveSet(partition);
		partition = nPartition;
	}
	while (changes);
	/* Ensure that the first state stays the same when mapping... */
	for (element = partition; element != NULL; element = element->next) {
		if (SetMember(dfa, element->element)) {
			element->element = AddElement(dfa, element->element);
			break;
		}
	}
	/* Map states and transitions: pick first element of each partition */
	for (state = dfa; state != NULL; state = state->next) {
		for (tr = state->transitions; tr != NULL; tr = tr->next) {
			tr->destination = ((ESet) (tr->destination->state.set->element))->element;
		}
	}
	/* Clean up adm */
	pop_localadm();
	/* Remove unreachable states */
	lastVisit++;
	MarkDFA(dfa);
	RemoveUnreachableStates(dfa);
	RenumberDFA(dfa);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1038, %rsp           # imm = 0x1038
movq %rdi, %r13
movq %rdi, 0xde5a(%rip)      # 0x1bce0
callq 0xc92c
xorl %r8d, %r8d
testq %r13, %r13
je 0xdf74
movq %r13, %r15
movq %r8, %r14
testq %r8, %r8
je 0xdf35
movzwl 0xde2b(%rip), %ebp      # 0x1bcd8
movq %r14, %rbx
movq (%rbx), %r12
movq (%r12), %rax
movq 0x10(%rax), %rsi
testw %bp, %bp
je 0xdeec
movq 0x10(%r15), %rax
testq %rax, %rax
je 0xdefc
testq %rsi, %rsi
je 0xdefc
movq (%rax), %rdx
movq 0x8(%rax), %rcx
movl (%rdx), %eax
testq %rcx, %rcx
je 0xdf01
movq (%rcx), %rdx
movq 0x8(%rcx), %rcx
movl (%rdx), %edx
cmpl %eax, %edx
cmovll %edx, %eax
jmp 0xded7
movq 0x10(%r15), %rdi
callq 0xccd1
testw %ax, %ax
je 0xdf28
jmp 0xdf52
cmpq %rsi, %rax
jmp 0xdf21
movq (%rsi), %rcx
movq 0x8(%rsi), %rdx
movl (%rcx), %ecx
testq %rdx, %rdx
je 0xdf1f
movq (%rdx), %rsi
movq 0x8(%rdx), %rdx
movl (%rsi), %esi
cmpl %ecx, %esi
cmovll %esi, %ecx
jmp 0xdf0a
cmpl %ecx, %eax
sete %al
testb %al, %al
jne 0xdf52
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
jne 0xdeb0
movq %r15, %rdi
xorl %esi, %esi
callq 0xcbc4
movq %rax, %rdi
movq %r14, %rsi
callq 0xcbc4
movq %rax, %rbx
movq %rax, %r8
jmp 0xdf63
movq %r15, %rdi
movq %r12, %rsi
callq 0xcbc4
movq %rax, (%rbx)
movq %r14, %r8
movq %rbx, 0x28(%r15)
movq 0x18(%r15), %r15
testq %r15, %r15
jne 0xde9a
movq %r13, 0x8(%rsp)
testq %r8, %r8
je 0xe0f6
movq $0x0, (%rsp)
movq %r8, %rax
xorl %r14d, %r14d
movq %r8, 0x10(%rsp)
movq %r14, 0x20(%rsp)
movq %rax, 0x18(%rsp)
movq (%rax), %r14
movq (%r14), %rdi
xorl %esi, %esi
callq 0xcbc4
movq %rax, %rbx
movq 0x8(%r14), %r13
xorl %ebp, %ebp
testq %r13, %r13
je 0xe082
movq (%rbx), %r14
movq (%r13), %rdi
movl 0xb290(%rip), %r15d     # 0x1925c
testq %r15, %r15
je 0xe004
leaq (,%r15,8), %r12
movq %rdi, 0x28(%rsp)
leaq 0x30(%rsp), %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x3120
leaq 0x830(%rsp), %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x3120
movq 0x28(%rsp), %rdi
movq (%r14), %rax
testq %rax, %rax
je 0xe025
movq 0x8(%rax), %rcx
movq 0x28(%rcx), %rcx
movslq (%rax), %rdx
movq %rcx, 0x830(%rsp,%rdx,8)
movq 0x10(%rax), %rax
jmp 0xe007
movq (%rdi), %rax
testq %rax, %rax
je 0xe043
movq 0x8(%rax), %rcx
movq 0x28(%rcx), %rcx
movslq (%rax), %rdx
movq %rcx, 0x30(%rsp,%rdx,8)
movq 0x10(%rax), %rax
jmp 0xe028
testq %r15, %r15
je 0xe061
xorl %eax, %eax
movq 0x830(%rsp,%rax,8), %rcx
cmpq 0x30(%rsp,%rax,8), %rcx
jne 0xe06e
incq %rax
cmpq %rax, %r15
jne 0xe04a
movq %rbx, %rsi
callq 0xcbc4
movq %rax, %rbx
jmp 0xe079
movq %rbp, %rsi
callq 0xcbc4
movq %rax, %rbp
movq 0x8(%r13), %r13
jmp 0xdfb5
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
callq 0xcbc4
movq %rax, %r14
testq %rbx, %rbx
je 0xe0a4
movq (%rbx), %rax
movq %r14, 0x28(%rax)
movq 0x8(%rbx), %rbx
jmp 0xe092
testq %rbp, %rbp
je 0xe0d0
movq %rbp, %rdi
movq %r14, %rsi
callq 0xcbc4
movq %rax, %r14
movq (%rbp), %rax
movq %r14, 0x28(%rax)
movq 0x8(%rbp), %rbp
testq %rbp, %rbp
jne 0xe0b7
movw $0xffff, %ax            # imm = 0xFFFF
movq %rax, (%rsp)
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
movq 0x10(%rsp), %r8
jne 0xdf95
cmpw $0x0, (%rsp)
sete %al
movq 0x8(%rsp), %r13
jmp 0xe0fb
movb $0x1, %al
xorl %r14d, %r14d
testq %r8, %r8
je 0xe144
movq 0xdb91(%rip), %rcx      # 0x1bc98
movq 0xdb9a(%rip), %rdx      # 0x1bca8
movq 0xdbb3(%rip), %rsi      # 0x1bcc8
movq %rsi, %rdi
movq %r8, %rsi
movq 0x8(%r8), %r8
movq %rdi, 0x8(%rsi)
incq %rdx
addq $0x10, %rcx
testq %r8, %r8
jne 0xe115
movq %rsi, 0xdb92(%rip)      # 0x1bcc8
movq %rdx, 0xdb6b(%rip)      # 0x1bca8
movq %rcx, 0xdb54(%rip)      # 0x1bc98
movq %r14, %r8
testb %al, %al
je 0xdf79
jmp 0xe16e
movq (%r14), %rsi
testq %rsi, %rsi
je 0xe16a
movq %rsi, %rax
cmpq %r13, (%rax)
je 0xe175
movq 0x8(%rax), %rax
testq %rax, %rax
jne 0xe15c
movq 0x8(%r14), %r14
testq %r14, %r14
jne 0xe151
jmp 0xe180
movq %r13, %rdi
callq 0xcbc4
movq %rax, (%r14)
testq %r13, %r13
je 0xe1b7
movq %r13, %rax
movq (%rax), %rcx
testq %rcx, %rcx
je 0xe1ae
movq 0x8(%rcx), %rdx
movq 0x10(%rcx), %rsi
movq 0x28(%rdx), %rdx
movq (%rdx), %rdx
movq (%rdx), %rdx
movq %rdx, 0x8(%rcx)
movq %rsi, %rcx
testq %rsi, %rsi
jne 0xe190
movq 0x18(%rax), %rax
testq %rax, %rax
jne 0xe188
callq 0xca09
movq 0xdb25(%rip), %rbx      # 0x1bce8
incq %rbx
movq %rbx, 0xdb1b(%rip)      # 0x1bce8
movq %r13, %rdi
callq 0xe2a1
movq 0x18(%r13), %r8
movq %r13, %rdi
testq %r8, %r8
je 0xe280
movq 0xdab4(%rip), %rax      # 0x1bca0
movq 0xdac5(%rip), %r9       # 0x1bcb8
movq 0xda9e(%rip), %rcx      # 0x1bc98
movq 0xdaaf(%rip), %rdx      # 0x1bcb0
movq 0xdab8(%rip), %rsi      # 0x1bcc0
movq %r13, %rdi
movq 0x18(%r8), %r10
cmpq %rbx, 0x20(%r8)
jne 0xe21e
movq %r8, 0x18(%rdi)
movq %r8, %rdi
jmp 0xe278
movq (%r8), %r11
testq %r11, %r11
je 0xe255
movq %rsi, %r14
movq %r11, %rsi
movq 0x10(%r11), %r11
movq %r14, 0x10(%rsi)
incq %rdx
addq $0x18, %rcx
testq %r11, %r11
jne 0xe226
movq %rsi, 0xda79(%rip)      # 0x1bcc0
movq %rdx, 0xda62(%rip)      # 0x1bcb0
movq %rcx, 0xda43(%rip)      # 0x1bc98
movq %r9, 0x18(%r8)
movq %r8, 0xda58(%rip)       # 0x1bcb8
incq %rax
movq %rax, 0xda36(%rip)      # 0x1bca0
addq $0x30, %rcx
movq %rcx, 0xda23(%rip)      # 0x1bc98
movq %r8, %r9
movq %r10, %r8
testq %r10, %r10
jne 0xe20b
movq $0x0, 0x18(%rdi)
movq %r13, %rdi
addq $0x1038, %rsp           # imm = 0x1038
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xdd63