// File: /workspace/github_c_makefile_star2_O2/theovosse[P]llgen/llgen.c
// Function: collectFirst
static Boolean collectFirst(TREE *firsts, TREE follow, Node rule) {
	NodeList rules;
	Boolean empty = true;
	TREE sym;
	Boolean emptyAlternative;

	while (empty && rule != NULL) {
		switch (rule->nodeType) {
			case single:
				if (rule->element.name->nameType == identifier) {
					for (sym = GetFirstNode(rule->element.name->first); sym != NULL; sym = GetNextNode(sym)) {
						Name key = GetKey(sym);
						if (key->nameType == token || key->nameType == string) {
							(void) InsertElement(firsts, key);
						}
					}
					empty = rule->element.name->empty;
				} else if (rule->element.name->nameType == token || rule->element.name->nameType == string) {
					(void) InsertElement(firsts, rule->element.name);
					empty = false;
				}
				break;
			case option:
				(void) collectFirst(firsts, NULL, rule->element.sub);
				break;
			case sequence:
				empty = collectFirst(firsts, NULL, rule->element.sub);
				break;
			case chain:
				empty = collectFirst(firsts, NULL, rule->element.sub->element.sub);
				if (empty) /* Now also inspect the other chain part, but it remains empty */ {
					(void) collectFirst(firsts, NULL, rule->element.sub->next->element.sub);
				}
				break;
			case alternative: /* Try each one... */
				emptyAlternative = false;
				for (rules = rule->element.alternatives; rules != NULL; rules = rules->rest) {
					if (collectFirst(firsts, NULL, rules->first)) {
						emptyAlternative = true;
					}
				}
				if (!emptyAlternative) {
					empty = false;
				}
				break;
			case breakToken:
			case errorMessage:
				break;
			default:
				fprintf(stderr, "collectFirst: unknown nodetype %d\n", rule->nodeType);
				return (empty);
		}
		rule = rule->next;
	}
	if (empty) {
		Unite(firsts, follow);
	}
	return empty;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, (%rsp)
movq %rdi, %r14
movw $0xffff, %r12w          # imm = 0xFFFF
leaq 0x9cb7(%rip), %r13      # 0x10050
testw %r12w, %r12w
je 0x64df
testq %r15, %r15
je 0x64df
movl 0x4(%r15), %edx
cmpq $0x6, %rdx
ja 0x6503
movslq (%r13,%rdx,4), %rax
addq %r13, %rax
jmpq *%rax
movq 0x18(%r15), %rsi
movl 0x38(%rsi), %eax
cmpl $0x4, %eax
je 0x64c0
cmpl $0x1, %eax
je 0x64c0
testl %eax, %eax
jne 0x64d6
movq 0x8(%rsi), %rdi
callq 0xb236
movq %rax, %r12
testq %rax, %rax
je 0x64cd
movq %r12, %rdi
callq 0xb272
movl 0x38(%rax), %ecx
cmpl $0x4, %ecx
je 0x640f
cmpl $0x1, %ecx
jne 0x641a
movq %r14, %rdi
movq %rax, %rsi
callq 0x6168
movq %r12, %rdi
callq 0xb27e
jmp 0x63ee
movq 0x18(%r15), %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x6378
jmp 0x64d6
movq 0x18(%r15), %rax
movq 0x18(%rax), %rdx
xorl %r12d, %r12d
movq %r14, %rdi
xorl %esi, %esi
callq 0x6378
testw %ax, %ax
je 0x64d6
movl %eax, %ebp
movq 0x18(%r15), %rax
movq 0x28(%rax), %rax
movq 0x18(%rax), %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x6378
movl %ebp, %r12d
jmp 0x64d6
leaq 0x18(%r15), %rbx
xorl %ebp, %ebp
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x649f
movq (%rbx), %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x6378
negw %ax
movl $0x0, %eax
sbbl %eax, %eax
orl %eax, %ebp
addq $0x8, %rbx
jmp 0x6478
testw %bp, %bp
movl $0x0, %eax
cmovel %eax, %r12d
jmp 0x64d6
movq 0x18(%r15), %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x6378
movl %eax, %r12d
jmp 0x64d6
movq %r14, %rdi
callq 0x6168
xorl %r12d, %r12d
jmp 0x64d6
movq 0x18(%r15), %rax
movzwl 0x30(%rax), %r12d
movq 0x28(%r15), %r15
jmp 0x6399
testw %r12w, %r12w
je 0x64f1
movq %r14, %rdi
movq (%rsp), %rsi
callq 0x651d
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x11aee(%rip), %rax     # 0x17ff8
movq (%rax), %rdi
leaq 0x9e21(%rip), %rsi      # 0x10335
xorl %eax, %eax
callq 0x3150
jmp 0x64f1