// File: /workspace/github_c_makefile_star2_O3/theovosse[P]llgen/llgen.c
// Function: RenumberRegExp
static void RenumberRegExp(RegExp regExp) {
	Transition tr, tr2;
	ESet transitions;
	int mCount = CharSetSize(), count;
	RegExp mState = NULL;
	Boolean cSet[256];
	int i, tCount;
	int sNum = 0;

	while (regExp != NULL) {
		mState = NULL;
		if (regExp->transitions == NULL) {
			regExp->state.number = -1;
		} else {
			regExp->state.number = sNum;
			transitions = NULL;
			tCount = CharSetSize();
			for (i = 0; i != tCount; i++) cSet[i] = false;
			for (tr = regExp->transitions; tr != NULL; tr = tr->next) {
				if (!cSet[tr->transitionChar]) {
					mCount--;
					cSet[tr->transitionChar] = true;
					tCount--;
				}
			}
			mCount = tCount;
			/* mCount is nr. of fails, mState == NULL, the fail state */
			for (tr = regExp->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 */
			for (tr = regExp->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)
							sNum++;
				}
			}
			if (mState == NULL) {
				sNum++;
			} else {
				if (tCount != 0) {
					for (i = 0; i != CharSetSize(); i++) {
						if (!cSet[i]) sNum++;
					}
				}
				sNum++;
			}
			RemoveSet(transitions);
		}
		regExp = regExp->next;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rdi, %rbx
callq 0xc75e
testq %rbx, %rbx
je 0x6a61
xorl %r12d, %r12d
cmpq $0x0, (%rbx)
je 0x6a0b
movslq %r12d, %rax
movq %rax, 0x28(%rbx)
callq 0xc75e
movl %eax, %ebp
testl %eax, %eax
je 0x693f
movl %ebp, %edx
addq %rdx, %rdx
movq %rsp, %rdi
xorl %esi, %esi
callq 0x3120
movq (%rbx), %r13
movq %r13, %rax
testq %r13, %r13
je 0x6a06
movslq (%rax), %rcx
cmpw $0x0, (%rsp,%rcx,2)
jne 0x6960
movw $0xffff, (%rsp,%rcx,2)  # imm = 0xFFFF
decl %ebp
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x694e
testq %r13, %r13
je 0x6a06
movq %r13, %rax
xorl %r14d, %r14d
movl %ebp, %ecx
movq 0x8(%rax), %rdx
cmpq %r14, %rdx
je 0x69ab
xorl %esi, %esi
movq %rax, %rdi
xorl %r8d, %r8d
cmpq %rdx, 0x8(%rdi)
movq 0x10(%rdi), %r9
sete %r8b
addl %r8d, %esi
movq %r9, %rdi
testq %r9, %r9
jne 0x6988
cmpl %ecx, %esi
cmovgl %esi, %ecx
cmovgq %rdx, %r14
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x697a
xorl %r15d, %r15d
testq %r13, %r13
je 0x6a15
movq 0x8(%r13), %rdi
cmpq %r14, %rdi
je 0x6a00
movq %r15, %rsi
callq 0xc937
testw %ax, %ax
jne 0x6a00
movq 0x8(%r13), %rdi
movq %r15, %rsi
callq 0xc874
movq %rax, %r15
movq 0x8(%r13), %rax
movq %r13, %rcx
xorl %edx, %edx
cmpq %rax, 0x8(%rcx)
movq 0x10(%rcx), %rsi
sete %dl
addl %edx, %r12d
movq %rsi, %rcx
testq %rsi, %rsi
jne 0x69e8
movq 0x10(%r13), %r13
jmp 0x69b7
xorl %r15d, %r15d
jmp 0x6a49
movq $-0x1, 0x28(%rbx)
jmp 0x6a54
testq %r14, %r14
sete %al
testl %ebp, %ebp
sete %cl
orb %al, %cl
jne 0x6a49
callq 0xc75e
testl %eax, %eax
je 0x6a49
xorl %r14d, %r14d
cmpw $0x1, (%rsp,%r14,2)
adcl $0x0, %r12d
incq %r14
callq 0xc75e
movl %eax, %eax
cmpq %rax, %r14
jne 0x6a30
incl %r12d
movq %r15, %rdi
callq 0xc8d8
movq 0x18(%rbx), %rbx
testq %rbx, %rbx
jne 0x6914
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq