// File: /workspace/github_c_makefile_star2_O1/theovosse[P]llgen/regexp.c
// Function: PrintDFA
void PrintDFA(RegExp dfa) {
	RegExp state;
	Transition tr, tr2;
	ESet transitions;
	int mCount = charSetSize, count;
	RegExp mState = NULL;
	ESet elt;
	int i, tCount;
	Boolean cSet[256];

	printf("int PMatch(char *str)\n{\n    int pos = 0, lLen = -1;\n\n");
	for (state = dfa; state != NULL; state = state->next) {
		tCount = charSetSize;
		for (i = 0; i != charSetSize; i++) cSet[i] = false;
		for (tr = state->transitions; tr != NULL; tr = tr->next) {
			cSet[tr->transitionChar] = true;
			mCount--;
			tCount--;
		}
		/* mCount is nr. of fails, mState == NULL, the fail state */
		for (tr = state->transitions; tr != NULL; tr = tr->next) {
			if (tr->destination != mState) /* not the most efficient check, but ok */ {
				for (count = 0, tr2 = tr; tr2 != NULL; tr2 = tr2->next)
					if (tr2->destination == tr->destination) count++;
				if (count > mCount) {
					mCount = count;
					mState = tr->destination;
				}
			}
		}
		/* mCount is max. nr. of transitions to the same state, mState is that state */
		printf("  l%ld:\n", state->state.number);
		if (state->info != NULL) {
			Answer first;
			printf("    lLen = pos;\n");
			for (elt = state->info, first = elt->element; elt != NULL; elt = elt->next) {
				if (singleAnswer) {
					if (first->number > ((Answer) elt->element)->number) {
						first = elt->element;
					}
				} else {
					printf("    Accept(%d, \"%s\");\n", ((Answer) elt->element)->number, (const char*) ((Answer) elt->element)->info);
				}
			}
			if (singleAnswer) {
				printf("    Accept(\"%s\");\n", (const char*) first->info);
			}
		}
		if (state->transitions == NULL) {
			printf("    goto fail;\n");
		} else {
			printf("    if (*str == '\\0') goto fail;\n");
			printf("    pos++;\n    switch (*str++)\n    {\n");
			transitions = NULL;
			for (tr = state->transitions; tr != NULL; tr = tr->next) {
				if (tr->destination != mState && !SetMember(tr->destination, transitions)) {
					transitions = AddElement(tr->destination, transitions);
					for (tr2 = tr; tr2 != NULL; tr2 = tr2->next) {
						if (tr2->destination == tr->destination) {
							printf("        case ");
							if (tr2->transitionChar < ' ' || tr2->transitionChar > '~') {
								printf("\\%03x:\n", tr2->transitionChar);
							} else {
								printf("'%c':\n", tr2->transitionChar);
							}
						}
					}
					printf("            goto l%ld;\n", tr->destination->state.number);
				}
			}
			if (mState == NULL) {
				printf("        default:\n            goto fail;\n");
			} else {
				if (tCount != 0) {
					for (i = 0; i != charSetSize; i++) {
						if (!cSet[i]) {
							printf("        case ");
							if (i < ' ' || i > '~') {
								printf("\\%03x:\n", i);
							} else {
								printf("'%c':\n", i);
							}
						}
					}
					printf("            goto fail;\n");
				}
				printf("        default:\n            goto l%ld;\n", mState->state.number);
			}
			RemoveSet(transitions);
			printf("    }\n");
		}
	}
	printf("  fail:\n    return (lLen);\n}\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %rdi, %r12
movl 0xaf76(%rip), %ebp      # 0x1925c
leaq 0x4e67(%rip), %rdi      # 0x13154
callq 0x3090
testq %r12, %r12
je 0xe5ca
xorl %ebx, %ebx
movl 0xaf58(%rip), %r14d     # 0x1925c
testq %r14, %r14
je 0xe319
leaq (%r14,%r14), %rdx
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
callq 0x3120
movq (%r12), %rax
testq %rax, %rax
je 0xe337
movslq (%rax), %rcx
movw $0xffff, 0x10(%rsp,%rcx,2) # imm = 0xFFFF
decl %ebp
decl %r14d
movq 0x10(%rax), %rax
jmp 0xe31d
movq (%r12), %rax
testq %rax, %rax
je 0xe375
movq 0x8(%rax), %rcx
cmpq %rbx, %rcx
je 0xe36f
xorl %edx, %edx
movq %rax, %rsi
xorl %edi, %edi
cmpq %rcx, 0x8(%rsi)
movq 0x10(%rsi), %r8
sete %dil
addl %edi, %edx
movq %r8, %rsi
testq %r8, %r8
jne 0xe34e
cmpl %ebp, %edx
cmovgl %edx, %ebp
cmovgq %rcx, %rbx
movq 0x10(%rax), %rax
jmp 0xe33b
movq 0x28(%r12), %rsi
leaq 0x4b96(%rip), %rdi      # 0x12f17
xorl %eax, %eax
callq 0x30f0
cmpq $0x0, 0x10(%r12)
je 0xe3fb
leaq 0x4e0f(%rip), %rdi      # 0x131a6
callq 0x3090
movq 0x10(%r12), %r13
movq (%r13), %r15
cmpw $0x0, 0xd92b(%rip)      # 0x1bcd8
je 0xe3be
movl (%r15), %eax
movq (%r13), %rcx
cmpl (%rcx), %eax
cmovgq %rcx, %r15
jmp 0xe3d6
movq (%r13), %rax
movl (%rax), %esi
movq 0x8(%rax), %rdx
leaq 0x4b51(%rip), %rdi      # 0x12f20
xorl %eax, %eax
callq 0x30f0
movq 0x8(%r13), %r13
testq %r13, %r13
jne 0xe3a5
cmpw $0x0, 0xd8f1(%rip)      # 0x1bcd8
je 0xe3fb
movq 0x8(%r15), %rsi
leaq 0x4b43(%rip), %rdi      # 0x12f37
xorl %eax, %eax
callq 0x30f0
cmpq $0x0, (%r12)
leaq 0x4e0e(%rip), %rdi      # 0x13215
je 0xe5b7
leaq 0x4da2(%rip), %rdi      # 0x131b6
callq 0x3090
leaq 0x4db7(%rip), %rdi      # 0x131d7
callq 0x3090
movq %r12, 0x8(%rsp)
movq (%r12), %r12
xorl %r15d, %r15d
testq %r12, %r12
je 0xe4cc
movq 0x8(%r12), %rdi
cmpq %rbx, %rdi
je 0xe4c2
testq %r15, %r15
je 0xe45a
movq %r15, %rax
cmpq %rdi, (%rax)
je 0xe4c2
movq 0x8(%rax), %rax
testq %rax, %rax
jne 0xe44c
movq %r15, %rsi
callq 0xcbc4
movq %rax, %r15
movq %r12, %r13
movq 0x8(%r13), %rax
cmpq 0x8(%r12), %rax
jne 0xe4a2
leaq 0x4ad0(%rip), %rdi      # 0x12f4a
xorl %eax, %eax
callq 0x30f0
movl (%r13), %esi
leal -0x7f(%rsi), %eax
leaq 0x4ac9(%rip), %rdi      # 0x12f58
cmpl $-0x5f, %eax
jb 0xe49b
leaq 0x4ac5(%rip), %rdi      # 0x12f60
xorl %eax, %eax
callq 0x30f0
movq 0x10(%r13), %r13
testq %r13, %r13
jne 0xe468
movq 0x8(%r12), %rax
movq 0x28(%rax), %rsi
leaq 0x4abd(%rip), %rdi      # 0x12f78
xorl %eax, %eax
callq 0x30f0
movq 0x10(%r12), %r12
jmp 0xe431
testq %rbx, %rbx
je 0xe54f
testl %r14d, %r14d
movq 0x8(%rsp), %r12
je 0xe53b
cmpl $0x0, 0xad7a(%rip)      # 0x1925c
je 0xe52f
xorl %r14d, %r14d
cmpw $0x0, 0x10(%rsp,%r14,2)
jne 0xe521
leaq 0x4a53(%rip), %rdi      # 0x12f4a
xorl %eax, %eax
callq 0x30f0
leal -0x7f(%r14), %eax
cmpl $-0x5f, %eax
leaq 0x4a54(%rip), %rdi      # 0x12f60
leaq 0x4a45(%rip), %rax      # 0x12f58
cmovbq %rax, %rdi
movl %r14d, %esi
xorl %eax, %eax
callq 0x30f0
incq %r14
movl 0xad32(%rip), %eax      # 0x1925c
cmpq %rax, %r14
jne 0xe4e7
leaq 0x4cd7(%rip), %rdi      # 0x1320d
callq 0x3090
movq 0x28(%rbx), %rsi
leaq 0x4a21(%rip), %rdi      # 0x12f67
xorl %eax, %eax
callq 0x30f0
jmp 0xe560
leaq 0x4ca6(%rip), %rdi      # 0x131fc
callq 0x3090
movq 0x8(%rsp), %r12
leaq 0x4cbd(%rip), %rdi      # 0x13224
testq %r15, %r15
je 0xe5b7
movq 0xd725(%rip), %rax      # 0x1bc98
movq 0xd72e(%rip), %rcx      # 0x1bca8
movq 0xd747(%rip), %rdx      # 0x1bcc8
movq %rdx, %rsi
movq %r15, %rdx
movq 0x8(%r15), %r15
movq %rsi, 0x8(%rdx)
incq %rcx
addq $0x10, %rax
testq %r15, %r15
jne 0xe581
movq %rdx, 0xd726(%rip)      # 0x1bcc8
movq %rcx, 0xd6ff(%rip)      # 0x1bca8
movq %rax, 0xd6e8(%rip)      # 0x1bc98
leaq 0x4c6d(%rip), %rdi      # 0x13224
callq 0x3090
movq 0x18(%r12), %r12
testq %r12, %r12
jne 0xe2fd
leaq 0x4bb8(%rip), %rdi      # 0x13189
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3090