// File: davinash[P]regex/src/regex.cpp
// Function: RegEx::ReduceDFA()
void RegEx::ReduceDFA() {
	std::set<RegExState*> DeadEndSet;
	for(int i = 0; i < (int)m_DFATable.size(); ++i) {
		if(m_DFATable[i]->IsDeadEnd()) {
			DeadEndSet.insert(m_DFATable[i]);
		}
	}
	if(DeadEndSet.empty())
		return;
	StateIterator iter;
	for(iter = DeadEndSet.begin(); iter != DeadEndSet.end(); ++iter) {
		for(int i = 0; i < (int)m_DFATable.size(); ++i)
			m_DFATable[i]->RemoveTransition(*iter);

		TableIterator pos;
		for(pos = m_DFATable.begin(); pos != m_DFATable.end(); ++pos) {
			if(*pos == *iter) {
				break;
			}
		}
		m_DFATable.erase(pos);
		delete *iter;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xb8(%rbp)
leaq -0x38(%rbp), %rdi
callq 0xb220
movl $0x0, -0x3c(%rbp)
movq -0xb8(%rbp), %rdi
movl -0x3c(%rbp), %eax
movl %eax, -0xbc(%rbp)
addq $0x18, %rdi
callq 0xa5d0
movq %rax, %rcx
movl -0xbc(%rbp), %eax
cmpl %ecx, %eax
jge 0x8f63
movq -0xb8(%rbp), %rdi
addq $0x18, %rdi
movslq -0x3c(%rbp), %rsi
callq 0xa5f0
movq (%rax), %rdi
callq 0x140a0
movb %al, -0xbd(%rbp)
jmp 0x8ee8
movb -0xbd(%rbp), %al
testb $0x1, %al
jne 0x8ef4
jmp 0x8f53
movq -0xb8(%rbp), %rdi
addq $0x18, %rdi
movslq -0x3c(%rbp), %rsi
callq 0xa5f0
movq %rax, %rsi
leaq -0x38(%rbp), %rdi
callq 0xb190
movb %dl, -0xc9(%rbp)
movq %rax, -0xc8(%rbp)
jmp 0x8f23
movb -0xc9(%rbp), %al
movq -0xc8(%rbp), %rcx
movq %rcx, -0x60(%rbp)
movb %al, -0x58(%rbp)
jmp 0x8f53
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0xb270
jmp 0x917f
jmp 0x8f55
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x8e9a
leaq -0x38(%rbp), %rdi
callq 0xb430
testb $0x1, %al
jne 0x8f72
jmp 0x8f7e
movl $0x1, -0x64(%rbp)
jmp 0x916d
leaq -0x70(%rbp), %rdi
callq 0xaf20
leaq -0x38(%rbp), %rdi
callq 0xaf40
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x70(%rbp)
leaq -0x38(%rbp), %rdi
callq 0xafa0
movq %rax, -0x80(%rbp)
leaq -0x70(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0xaf70
testb $0x1, %al
jne 0x8fbf
jmp 0x9166
movl $0x0, -0x84(%rbp)
movq -0xb8(%rbp), %rdi
movl -0x84(%rbp), %eax
movl %eax, -0xd0(%rbp)
addq $0x18, %rdi
callq 0xa5d0
movq %rax, %rcx
movl -0xd0(%rbp), %eax
cmpl %ecx, %eax
jge 0x9040
movq -0xb8(%rbp), %rdi
addq $0x18, %rdi
movslq -0x84(%rbp), %rsi
callq 0xa5f0
movq (%rax), %rax
movq %rax, -0xd8(%rbp)
leaq -0x70(%rbp), %rdi
callq 0xb000
movq -0xd8(%rbp), %rdi
movq (%rax), %rsi
callq 0x13f10
jmp 0x902d
jmp 0x902f
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x8fc9
leaq -0x90(%rbp), %rdi
callq 0xb0c0
movq -0xb8(%rbp), %rdi
addq $0x18, %rdi
callq 0xa9e0
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0xb8(%rbp), %rdi
addq $0x18, %rdi
callq 0xaae0
movq %rax, -0xa0(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0xb0e0
testb $0x1, %al
jne 0x90a1
jmp 0x90e1
leaq -0x90(%rbp), %rdi
callq 0xaa10
movq (%rax), %rax
movq %rax, -0xe0(%rbp)
leaq -0x70(%rbp), %rdi
callq 0xb000
movq %rax, %rcx
movq -0xe0(%rbp), %rax
cmpq (%rcx), %rax
jne 0x90d1
jmp 0x90e1
jmp 0x90d3
leaq -0x90(%rbp), %rdi
callq 0xb1e0
jmp 0x9071
movq -0xb8(%rbp), %rax
addq $0x18, %rax
movq %rax, -0xf0(%rbp)
leaq -0xa8(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0xab10
movq -0xf0(%rbp), %rdi
movq -0xa8(%rbp), %rsi
callq 0xb450
movq %rax, -0xe8(%rbp)
jmp 0x9122
movq -0xe8(%rbp), %rax
movq %rax, -0xb0(%rbp)
leaq -0x70(%rbp), %rdi
callq 0xb000
movq (%rax), %rax
movq %rax, -0xf8(%rbp)
cmpq $0x0, %rax
je 0x9156
movq -0xf8(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x9158
leaq -0x70(%rbp), %rdi
callq 0xb030
jmp 0x8f9c
movl $0x0, -0x64(%rbp)
leaq -0x38(%rbp), %rdi
callq 0xb270
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x33a0
nopl (%rax,%rax)