// File: /workspace/github_c_makefile_star2_O1/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 0xcaae
testq %rbx, %rbx
je 0x6ba0
xorl %r12d, %r12d
cmpq $0x0, (%rbx)
je 0x6b8b
movslq %r12d, %rax
movq %rax, 0x28(%rbx)
callq 0xcaae
movl %eax, %ebp
testl %eax, %eax
je 0x6a8e
movl %ebp, %edx
addq %rdx, %rdx
movq %rsp, %rdi
xorl %esi, %esi
callq 0x3120
movq (%rbx), %rax
testq %rax, %rax
je 0x6aae
movslq (%rax), %rcx
cmpw $0x0, (%rsp,%rcx,2)
jne 0x6aa8
movw $0xffff, (%rsp,%rcx,2)  # imm = 0xFFFF
decl %ebp
movq 0x10(%rax), %rax
jmp 0x6a91
movq (%rbx), %rax
xorl %r13d, %r13d
testq %rax, %rax
je 0x6af5
movl %ebp, %ecx
movq 0x8(%rax), %rdx
cmpq %r13, %rdx
je 0x6aec
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 0x6ac9
cmpl %ecx, %esi
cmovgl %esi, %ecx
cmovgq %rdx, %r13
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x6abb
movq (%rbx), %r14
xorl %r15d, %r15d
testq %r14, %r14
je 0x6b4a
movq 0x8(%r14), %rdi
cmpq %r13, %rdi
je 0x6b44
movq %r15, %rsi
callq 0xcc87
testw %ax, %ax
jne 0x6b44
movq 0x8(%r14), %rdi
movq %r15, %rsi
callq 0xcbc4
movq %rax, %r15
movq 0x8(%r14), %rax
movq %r14, %rcx
xorl %edx, %edx
cmpq %rax, 0x8(%rcx)
movq 0x10(%rcx), %rsi
sete %dl
addl %edx, %r12d
movq %rsi, %rcx
testq %rsi, %rsi
jne 0x6b2c
movq 0x10(%r14), %r14
jmp 0x6afb
testq %r13, %r13
sete %al
testl %ebp, %ebp
sete %cl
orb %al, %cl
jne 0x6b7e
callq 0xcaae
testl %eax, %eax
je 0x6b7e
xorl %r14d, %r14d
cmpw $0x1, (%rsp,%r14,2)
adcl $0x0, %r12d
incq %r14
callq 0xcaae
movl %eax, %eax
cmpq %rax, %r14
jne 0x6b65
incl %r12d
movq %r15, %rdi
callq 0xcc28
jmp 0x6b93
movq $-0x1, 0x28(%rbx)
movq 0x18(%rbx), %rbx
testq %rbx, %rbx
jne 0x6a63
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq