// File: /workspace/github_c_makefile_star2_O3/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 $0x1048, %rsp           # imm = 0x1048
movq %rdi, %r15
movq %rdi, 0xe1ec(%rip)      # 0x1bce0
callq 0xc5dc
testq %r15, %r15
movq %r15, 0x10(%rsp)
je 0xdbdc
xorl %r14d, %r14d
testq %r14, %r14
je 0xdb9d
movzwl 0xe1be(%rip), %ebx      # 0x1bcd8
movq 0x10(%r15), %r13
movq %r14, %r12
movq (%r12), %rbp
movq (%rbp), %rax
movq 0x10(%rax), %rsi
testw %bx, %bx
je 0xdb5b
testq %r13, %r13
je 0xdb6a
testq %rsi, %rsi
je 0xdb6a
movq (%r13), %rax
movq 0x8(%r13), %rcx
movl (%rax), %eax
testq %rcx, %rcx
je 0xdb71
movq (%rcx), %rdx
movq 0x8(%rcx), %rcx
movl (%rdx), %edx
cmpl %eax, %edx
cmovll %edx, %eax
jmp 0xdb46
movq %r13, %rdi
callq 0xc981
testw %ax, %ax
je 0xdb93
jmp 0xdbba
cmpq %rsi, %r13
jne 0xdb93
jmp 0xdbba
movq (%rsi), %rcx
movq 0x8(%rsi), %rdx
movl (%rcx), %ecx
testq %rdx, %rdx
je 0xdb8f
movq (%rdx), %rsi
movq 0x8(%rdx), %rdx
movl (%rsi), %esi
cmpl %ecx, %esi
cmovll %esi, %ecx
jmp 0xdb7a
cmpl %ecx, %eax
je 0xdbba
movq 0x8(%r12), %r12
testq %r12, %r12
jne 0xdb21
movq %r15, %rdi
xorl %esi, %esi
callq 0xc874
movq %rax, %rdi
movq %r14, %rsi
callq 0xc874
movq %rax, %r12
movq %rax, %r14
jmp 0xdbc9
movq %r15, %rdi
movq %rbp, %rsi
callq 0xc874
movq %rax, (%r12)
movq %r12, 0x28(%r15)
movq 0x18(%r15), %r15
testq %r15, %r15
jne 0xdb0a
jmp 0xdbdf
xorl %r14d, %r14d
testq %r14, %r14
sete %al
movq 0x10(%rsp), %r15
je 0xddf7
movb %al, 0xf(%rsp)
movq %r14, %rdi
movq $0x0, 0x18(%rsp)
movq %r14, %rax
xorl %r14d, %r14d
movq %rdi, 0x20(%rsp)
movq %r14, 0x30(%rsp)
movq %rax, 0x28(%rsp)
movq (%rax), %rbx
movq (%rbx), %rdi
xorl %esi, %esi
callq 0xc874
movq %rax, %rbp
movq 0x8(%rbx), %r12
xorl %r13d, %r13d
testq %r12, %r12
je 0xdcfb
movq (%rbp), %rbx
movq (%r12), %rdi
movl 0xb618(%rip), %r14d     # 0x1925c
testq %r14, %r14
je 0xdc7c
leaq (,%r14,8), %r15
movq %rdi, 0x38(%rsp)
leaq 0x40(%rsp), %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x3120
leaq 0x840(%rsp), %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x3120
movq 0x38(%rsp), %rdi
movq (%rbx), %rax
testq %rax, %rax
je 0xdc9d
movq 0x8(%rax), %rcx
movq 0x28(%rcx), %rcx
movslq (%rax), %rdx
movq %rcx, 0x840(%rsp,%rdx,8)
movq 0x10(%rax), %rax
jmp 0xdc7f
movq (%rdi), %rax
testq %rax, %rax
je 0xdcbb
movq 0x8(%rax), %rcx
movq 0x28(%rcx), %rcx
movslq (%rax), %rdx
movq %rcx, 0x40(%rsp,%rdx,8)
movq 0x10(%rax), %rax
jmp 0xdca0
testq %r14, %r14
je 0xdcd9
xorl %eax, %eax
movq 0x840(%rsp,%rax,8), %rcx
cmpq 0x40(%rsp,%rax,8), %rcx
jne 0xdce6
incq %rax
cmpq %rax, %r14
jne 0xdcc2
movq %rbp, %rsi
callq 0xc874
movq %rax, %rbp
jmp 0xdcf1
movq %r13, %rsi
callq 0xc874
movq %rax, %r13
movq 0x8(%r12), %r12
jmp 0xdc2c
movq %rbp, %rdi
movq 0x30(%rsp), %rsi
callq 0xc874
movq %rax, %r14
testq %rbp, %rbp
je 0xdd1e
movq (%rbp), %rax
movq %r14, 0x28(%rax)
movq 0x8(%rbp), %rbp
jmp 0xdd0b
testq %r13, %r13
je 0xdd4b
movq %r13, %rdi
movq %r14, %rsi
callq 0xc874
movq %rax, %r14
movq (%r13), %rax
movq %r14, 0x28(%rax)
movq 0x8(%r13), %r13
testq %r13, %r13
jne 0xdd31
movw $0xffff, %ax            # imm = 0xFFFF
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
jne 0xdc0b
testb $0x1, 0xf(%rsp)
jne 0xddad
movq 0xdf28(%rip), %rax      # 0x1bc98
movq 0xdf31(%rip), %rcx      # 0x1bca8
movq 0xdf4a(%rip), %rdx      # 0x1bcc8
movq %rdx, %rsi
movq %rdi, %rdx
movq 0x8(%rdi), %rdi
movq %rsi, 0x8(%rdx)
incq %rcx
addq $0x10, %rax
testq %rdi, %rdi
jne 0xdd7e
movq %rdx, 0xdf29(%rip)      # 0x1bcc8
movq %rcx, 0xdf02(%rip)      # 0x1bca8
movq %rax, 0xdeeb(%rip)      # 0x1bc98
cmpw $0x0, 0x18(%rsp)
movq 0x10(%rsp), %r15
je 0xdde5
testq %r14, %r14
sete %al
jne 0xdbf0
jmp 0xddf7
movq (%r14), %rsi
testq %rsi, %rsi
je 0xdde1
movq %rsi, %rax
cmpq %r15, (%rax)
je 0xddec
movq 0x8(%rax), %rax
testq %rax, %rax
jne 0xddd3
movq 0x8(%r14), %r14
testq %r14, %r14
jne 0xddc8
jmp 0xddf7
movq %r15, %rdi
callq 0xc874
movq %rax, (%r14)
testq %r15, %r15
je 0xde2e
movq %r15, %rax
movq (%rax), %rcx
testq %rcx, %rcx
je 0xde25
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 0xde07
movq 0x18(%rax), %rax
testq %rax, %rax
jne 0xddff
callq 0xc6b9
movq 0xdeae(%rip), %rbx      # 0x1bce8
incq %rbx
movq %rbx, 0xdea4(%rip)      # 0x1bce8
movq %r15, %rdi
callq 0xdf11
movq 0x18(%r15), %r8
movq %r15, %rdi
testq %r8, %r8
je 0xdef0
movq 0xde3d(%rip), %rax      # 0x1bca0
movq 0xde4e(%rip), %r9       # 0x1bcb8
movq 0xde27(%rip), %rcx      # 0x1bc98
movq 0xde38(%rip), %rdx      # 0x1bcb0
movq 0xde41(%rip), %rsi      # 0x1bcc0
movq %r15, %rdi
movq 0x18(%r8), %r10
cmpq %rbx, 0x20(%r8)
jne 0xde95
movq %r8, 0x18(%rdi)
movq %r8, %rdi
jmp 0xdee8
movq (%r8), %r11
testq %r11, %r11
je 0xdec5
movq %rsi, %r14
movq %r11, %rsi
movq 0x10(%r11), %r11
movq %r14, 0x10(%rsi)
incq %rdx
addq $0x18, %rcx
testq %r11, %r11
jne 0xde9d
movq %rsi, 0xde02(%rip)      # 0x1bcc0
movq %rdx, 0xddeb(%rip)      # 0x1bcb0
movq %r9, 0x18(%r8)
movq %r8, 0xdde8(%rip)       # 0x1bcb8
incq %rax
movq %rax, 0xddc6(%rip)      # 0x1bca0
addq $0x30, %rcx
movq %rcx, 0xddb3(%rip)      # 0x1bc98
movq %r8, %r9
movq %r10, %r8
testq %r10, %r10
jne 0xde82
movq $0x0, 0x18(%rdi)
movq %r15, %rdi
addq $0x1048, %rsp           # imm = 0x1048
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xd9d1