// File: /workspace/github_c_makefile_star2_O0/theovosse[P]llgen/regexp.c
// Function: DisassembleDFA
void DisassembleDFA(RegExp dfa) {
	RegExp state;
	Transition tr, tr2;
	int mCount = charSetSize, count;
	RegExp mState = NULL;
	ESet elt;
	int i, tCount;
	RegExp cSet[256];
	int tempLabel = 1;
	Boolean justPrintedLabel = false;
	int nrStates = 0;

	for (state = dfa; state != NULL; state = state->next) nrStates++;
	tempLabel = nrStates + 1;
	printf(";\tNull-terminated string in A0.\n;\tResult in D0,A0\n");
	printf("\tMOVE.L A0,A1\n\tMOVE.W #$FFFF,D0\n\tCLR.W  D1\n");
	for (state = dfa; state != NULL; state = state->next) {
		tCount = charSetSize;
		for (i = 0; i != charSetSize; i++) cSet[i] = NULL;
		for (tr = state->transitions; tr != NULL; tr = tr->next) {
			cSet[tr->transitionChar] = tr->destination;
			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 */
		if (justPrintedLabel) printf("\n");
		printf("@%ld:", state->state.number);
		justPrintedLabel = true;
		if (state->info != NULL) {
			Answer first;
			printf("\tMOVE.W D1,D0\n");
			for (elt = state->info, first = elt->element; elt != NULL; elt = elt->next) {
				if (first->number > ((Answer) elt->element)->number) {
					first = elt->element;
				}
			}
			printf("\tMOVE.L #$%lx,A0\n", (long) first->info);
			justPrintedLabel = false;
		}
		if (state->transitions == NULL) {
			if (state->next != NULL) {
				printf("\tJMP    @%d\n", nrStates);
				justPrintedLabel = false;
			}
		} else {
			printf("\tADDQ.W #1,D1\n");
			printf("\tMOVE.B (A1)+,D2\n");
		 /* printf("\tTST.B  D2\n\tBEQ    @%d\n", nrStates); */
			justPrintedLabel = false;
			i = 0;
			while (i != charSetSize) {
				if (cSet[i] != mState) {
					if (i < charSetSize - 2 && cSet[i] == cSet[i + 1] && cSet[i] == cSet[i + 2]) {
						if (i != 0) {
							printf("\tCMP.B  #$%02x,D2\t; '", i);
							if (' ' <= i && i <= '~') printf("%c'\n", i);
							else printf("\\%03o'\n", i);
							printf("\tBLT    @%d\n", tempLabel);
							justPrintedLabel = false;
						}
						do {
							i++;
						}
						while (i != charSetSize && cSet[i] == cSet[i - 1]);
						i--;
						if (i == charSetSize - 1) {
							if (cSet[i] == NULL) {
								printf("\tJMP    @%d\n", nrStates);
							} else if (cSet[i] == state && state->info != NULL) {
								printf("\tJMP    @%ld+8\n", cSet[i]->state.number);
							} else {
								printf("\tJMP    @%ld\n", cSet[i]->state.number);
							}
						} else {
							printf("\tCMP.B  #$%02x,D2\t; '", i);
							if (' ' <= i && i <= '~') printf("%c'\n", i);
							else printf("\\%03o'\n", i);
							if (cSet[i] == NULL) {
								printf("\tBLE    @%d\n", nrStates);
							} else if (cSet[i] == state && state->info != NULL) {
								printf("\tBLE    @%ld+8\n", cSet[i]->state.number);
							} else {
								printf("\tBLE    @%ld\n", cSet[i]->state.number);
							}
						}
						printf("@%d:", tempLabel++);
						justPrintedLabel = true;
					} else {
						printf("\tCMP.B  #$%02x,D2\t; '", i);
						if (' ' <= i && i <= '~') printf("%c'\n", i);
						else printf("\\%03o'\n", i);
						if (cSet[i] == NULL) {
							printf("\tBEQ    @%d\n", nrStates);
						} else if (cSet[i] == state && state->info != NULL) {
							printf("\tBEQ    @%ld+8\n", cSet[i]->state.number);
						} else {
							printf("\tBEQ    @%ld\n", cSet[i]->state.number);
						}
						justPrintedLabel = false;
					}
				}
				i++;
			}
			if (mState == NULL) {
				if (state->next != NULL) {
					printf("\tJMP    @%d\n", nrStates);
				}
			} else if (mState == state && state->info != NULL) {
				printf("\tJMP    @%ld+8\n", mState->state.number);
			} else  {
				printf("\tJMP    @%ld\n", mState->state.number);
			}
			justPrintedLabel = false;
		}
	}
	if (justPrintedLabel) printf("\n");
	printf("@%d:\tRTS\n", nrStates);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x860, %rsp            # imm = 0x860
movq %rdi, -0x8(%rbp)
movl 0xbe0f(%rip), %eax      # 0x202a4
movl %eax, -0x24(%rbp)
movq $0x0, -0x30(%rbp)
movl $0x1, -0x844(%rbp)
movw $0x0, -0x846(%rbp)
movl $0x0, -0x84c(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x144e9
movl -0x84c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84c(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x144c5
movl -0x84c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x844(%rbp)
leaq 0x6ced(%rip), %rdi      # 0x1b1ec
movb $0x0, %al
callq 0x30e0
leaq 0x6d12(%rip), %rdi      # 0x1b21f
movb $0x0, %al
callq 0x30e0
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x14b9a
movl 0xbd77(%rip), %eax      # 0x202a4
movl %eax, -0x40(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl 0xbd64(%rip), %eax      # 0x202a4
je 0x1455d
movslq -0x3c(%rbp), %rax
movq $0x0, -0x840(%rbp,%rax,8)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x14537
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x145a6
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x18(%rbp), %rax
movslq (%rax), %rax
movq %rcx, -0x840(%rbp,%rax,8)
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
movl -0x40(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x14568
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x14636
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
cmpq -0x30(%rbp), %rax
je 0x14623
movl $0x0, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x14607
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x18(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x145f7
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x145f9
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x145d5
movl -0x28(%rbp), %eax
cmpl -0x24(%rbp), %eax
jle 0x14621
movl -0x28(%rbp), %eax
movl %eax, -0x24(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x14623
jmp 0x14625
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x145b1
cmpw $0x0, -0x846(%rbp)
je 0x1464e
leaq 0x6a83(%rip), %rdi      # 0x1b0ca
movb $0x0, %al
callq 0x30e0
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
leaq 0x6bee(%rip), %rdi      # 0x1b24b
movb $0x0, %al
callq 0x30e0
movw $0xffff, -0x846(%rbp)   # imm = 0xFFFF
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x146ff
leaq 0x6bce(%rip), %rdi      # 0x1b251
movb $0x0, %al
callq 0x30e0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x858(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x146dd
movq -0x858(%rbp), %rax
movl (%rax), %eax
movq -0x38(%rbp), %rcx
movq (%rcx), %rcx
cmpl (%rcx), %eax
jle 0x146cd
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x858(%rbp)
jmp 0x146cf
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x146a4
movq -0x858(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0x6b71(%rip), %rdi      # 0x1b260
movb $0x0, %al
callq 0x30e0
movw $0x0, -0x846(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x14736
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x14731
movl -0x84c(%rbp), %esi
leaq 0x6b51(%rip), %rdi      # 0x1b272
movb $0x0, %al
callq 0x30e0
movw $0x0, -0x846(%rbp)
jmp 0x14b87
leaq 0x6b42(%rip), %rdi      # 0x1b27f
movb $0x0, %al
callq 0x30e0
leaq 0x6b43(%rip), %rdi      # 0x1b28e
movb $0x0, %al
callq 0x30e0
movw $0x0, -0x846(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl 0xbb39(%rip), %eax      # 0x202a4
je 0x14b11
movslq -0x3c(%rbp), %rax
movq -0x840(%rbp,%rax,8), %rax
cmpq -0x30(%rbp), %rax
je 0x14b03
movl -0x3c(%rbp), %eax
movl 0xbb14(%rip), %ecx      # 0x202a4
subl $0x2, %ecx
cmpl %ecx, %eax
jge 0x14a31
movslq -0x3c(%rbp), %rax
movq -0x840(%rbp,%rax,8), %rax
movl -0x3c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
cmpq -0x840(%rbp,%rcx,8), %rax
jne 0x14a31
movslq -0x3c(%rbp), %rax
movq -0x840(%rbp,%rax,8), %rax
movl -0x3c(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
cmpq -0x840(%rbp,%rcx,8), %rax
jne 0x14a31
cmpl $0x0, -0x3c(%rbp)
je 0x14849
movl -0x3c(%rbp), %esi
leaq 0x6aaf(%rip), %rdi      # 0x1b2a0
movb $0x0, %al
callq 0x30e0
movl $0x20, %eax
cmpl -0x3c(%rbp), %eax
jg 0x1481b
cmpl $0x7e, -0x3c(%rbp)
jg 0x1481b
movl -0x3c(%rbp), %esi
leaq 0x6aa4(%rip), %rdi      # 0x1b2b6
movb $0x0, %al
callq 0x30e0
jmp 0x1482c
movl -0x3c(%rbp), %esi
leaq 0x6a96(%rip), %rdi      # 0x1b2bb
movb $0x0, %al
callq 0x30e0
movl -0x844(%rbp), %esi
leaq 0x6a8a(%rip), %rdi      # 0x1b2c3
movb $0x0, %al
callq 0x30e0
movw $0x0, -0x846(%rbp)
jmp 0x1484b
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %ecx
xorl %eax, %eax
cmpl 0xba45(%rip), %ecx      # 0x202a4
movb %al, -0x859(%rbp)
je 0x1488d
movslq -0x3c(%rbp), %rax
movq -0x840(%rbp,%rax,8), %rax
movl -0x3c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
cmpq -0x840(%rbp,%rcx,8), %rax
sete %al
movb %al, -0x859(%rbp)
movb -0x859(%rbp), %al
testb $0x1, %al
jne 0x1484b
movl -0x3c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movl 0xb9fb(%rip), %ecx      # 0x202a4
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1493b
movslq -0x3c(%rbp), %rax
cmpq $0x0, -0x840(%rbp,%rax,8)
jne 0x148d9
movl -0x84c(%rbp), %esi
leaq 0x69a2(%rip), %rdi      # 0x1b272
movb $0x0, %al
callq 0x30e0
jmp 0x14936
movslq -0x3c(%rbp), %rax
movq -0x840(%rbp,%rax,8), %rax
cmpq -0x10(%rbp), %rax
jne 0x14916
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x14916
movslq -0x3c(%rbp), %rax
movq -0x840(%rbp,%rax,8), %rax
movq 0x28(%rax), %rsi
leaq 0x69c3(%rip), %rdi      # 0x1b2d0
movb $0x0, %al
callq 0x30e0
jmp 0x14934
movslq -0x3c(%rbp), %rax
movq -0x840(%rbp,%rax,8), %rax
movq 0x28(%rax), %rsi
leaq 0x69b3(%rip), %rdi      # 0x1b2e0
movb $0x0, %al
callq 0x30e0
jmp 0x14936
jmp 0x14a04
movl -0x3c(%rbp), %esi
leaq 0x695b(%rip), %rdi      # 0x1b2a0
movb $0x0, %al
callq 0x30e0
movl $0x20, %eax
cmpl -0x3c(%rbp), %eax
jg 0x1496f
cmpl $0x7e, -0x3c(%rbp)
jg 0x1496f
movl -0x3c(%rbp), %esi
leaq 0x6950(%rip), %rdi      # 0x1b2b6
movb $0x0, %al
callq 0x30e0
jmp 0x14980
movl -0x3c(%rbp), %esi
leaq 0x6942(%rip), %rdi      # 0x1b2bb
movb $0x0, %al
callq 0x30e0
movslq -0x3c(%rbp), %rax
cmpq $0x0, -0x840(%rbp,%rax,8)
jne 0x149a5
movl -0x84c(%rbp), %esi
leaq 0x6952(%rip), %rdi      # 0x1b2ee
movb $0x0, %al
callq 0x30e0
jmp 0x14a02
movslq -0x3c(%rbp), %rax
movq -0x840(%rbp,%rax,8), %rax
cmpq -0x10(%rbp), %rax
jne 0x149e2
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x149e2
movslq -0x3c(%rbp), %rax
movq -0x840(%rbp,%rax,8), %rax
movq 0x28(%rax), %rsi
leaq 0x6922(%rip), %rdi      # 0x1b2fb
movb $0x0, %al
callq 0x30e0
jmp 0x14a00
movslq -0x3c(%rbp), %rax
movq -0x840(%rbp,%rax,8), %rax
movq 0x28(%rax), %rsi
leaq 0x6912(%rip), %rdi      # 0x1b30b
movb $0x0, %al
callq 0x30e0
jmp 0x14a02
jmp 0x14a04
movl -0x844(%rbp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, -0x844(%rbp)
leaq 0x68fd(%rip), %rdi      # 0x1b319
movb $0x0, %al
callq 0x30e0
movw $0xffff, -0x846(%rbp)   # imm = 0xFFFF
jmp 0x14b01
movl -0x3c(%rbp), %esi
leaq 0x6865(%rip), %rdi      # 0x1b2a0
movb $0x0, %al
callq 0x30e0
movl $0x20, %eax
cmpl -0x3c(%rbp), %eax
jg 0x14a65
cmpl $0x7e, -0x3c(%rbp)
jg 0x14a65
movl -0x3c(%rbp), %esi
leaq 0x685a(%rip), %rdi      # 0x1b2b6
movb $0x0, %al
callq 0x30e0
jmp 0x14a76
movl -0x3c(%rbp), %esi
leaq 0x684c(%rip), %rdi      # 0x1b2bb
movb $0x0, %al
callq 0x30e0
movslq -0x3c(%rbp), %rax
cmpq $0x0, -0x840(%rbp,%rax,8)
jne 0x14a9b
movl -0x84c(%rbp), %esi
leaq 0x688c(%rip), %rdi      # 0x1b31e
movb $0x0, %al
callq 0x30e0
jmp 0x14af8
movslq -0x3c(%rbp), %rax
movq -0x840(%rbp,%rax,8), %rax
cmpq -0x10(%rbp), %rax
jne 0x14ad8
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x14ad8
movslq -0x3c(%rbp), %rax
movq -0x840(%rbp,%rax,8), %rax
movq 0x28(%rax), %rsi
leaq 0x685c(%rip), %rdi      # 0x1b32b
movb $0x0, %al
callq 0x30e0
jmp 0x14af6
movslq -0x3c(%rbp), %rax
movq -0x840(%rbp,%rax,8), %rax
movq 0x28(%rax), %rsi
leaq 0x684c(%rip), %rdi      # 0x1b33b
movb $0x0, %al
callq 0x30e0
jmp 0x14af8
movw $0x0, -0x846(%rbp)
jmp 0x14b03
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x14762
cmpq $0x0, -0x30(%rbp)
jne 0x14b39
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x14b37
movl -0x84c(%rbp), %esi
leaq 0x6742(%rip), %rdi      # 0x1b272
movb $0x0, %al
callq 0x30e0
jmp 0x14b7e
movq -0x30(%rbp), %rax
cmpq -0x10(%rbp), %rax
jne 0x14b66
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x14b66
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rsi
leaq 0x6773(%rip), %rdi      # 0x1b2d0
movb $0x0, %al
callq 0x30e0
jmp 0x14b7c
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rsi
leaq 0x676b(%rip), %rdi      # 0x1b2e0
movb $0x0, %al
callq 0x30e0
jmp 0x14b7e
movw $0x0, -0x846(%rbp)
jmp 0x14b89
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x1451c
cmpw $0x0, -0x846(%rbp)
je 0x14bb2
leaq 0x651f(%rip), %rdi      # 0x1b0ca
movb $0x0, %al
callq 0x30e0
movl -0x84c(%rbp), %esi
leaq 0x678a(%rip), %rdi      # 0x1b349
movb $0x0, %al
callq 0x30e0
addq $0x860, %rsp            # imm = 0x860
popq %rbp
retq
nop