// File: /workspace/github_c_makefile_star2_O1/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 %rsi, (%rsp)
movq %rdi, %r14
testq %rdx, %rdx
je 0x6761
movq %rdx, %r15
movw $0xffff, %r12w          # imm = 0xFFFF
leaq 0xaa30(%rip), %r13      # 0x11050
movl 0x4(%r15), %edx
cmpq $0x6, %rdx
ja 0x678a
movslq (%r13,%rdx,4), %rax
addq %r13, %rax
jmpq *%rax
movq 0x18(%r15), %rsi
movl 0x38(%rsi), %eax
cmpl $0x4, %eax
je 0x6741
cmpl $0x1, %eax
je 0x6741
testl %eax, %eax
jne 0x674c
movq 0x8(%rsi), %rdi
callq 0xbe8a
testq %rax, %rax
je 0x669a
movq %rax, %r12
movq %r12, %rdi
callq 0xbec6
movl 0x38(%rax), %ecx
cmpl $0x4, %ecx
je 0x667f
cmpl $0x1, %ecx
jne 0x668a
movq %r14, %rdi
movq %rax, %rsi
callq 0x63fc
movq %r12, %rdi
callq 0xbed2
movq %rax, %r12
testq %rax, %rax
jne 0x666a
movq 0x18(%r15), %rax
movzwl 0x30(%rax), %r12d
jmp 0x674c
movq 0x18(%r15), %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x65f6
jmp 0x674c
movq 0x18(%r15), %rax
movq 0x18(%rax), %rdx
xorl %r12d, %r12d
movq %r14, %rdi
xorl %esi, %esi
callq 0x65f6
testw %ax, %ax
je 0x674c
movl %eax, %ebp
movq 0x18(%r15), %rax
movq 0x28(%rax), %rax
movq 0x18(%rax), %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x65f6
movl %ebp, %r12d
jmp 0x674c
movq 0x18(%r15), %rbp
testq %rbp, %rbp
je 0x6749
xorl %ebx, %ebx
movq (%rbp), %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x65f6
negw %ax
movl $0x0, %eax
sbbl %eax, %eax
orl %eax, %ebx
movq 0x8(%rbp), %rbp
testq %rbp, %rbp
jne 0x66fd
testw %bx, %bx
movl $0x0, %eax
cmovel %eax, %r12d
jmp 0x674c
movq 0x18(%r15), %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x65f6
movl %eax, %r12d
jmp 0x674c
movq %r14, %rdi
callq 0x63fc
xorl %r12d, %r12d
testw %r12w, %r12w
je 0x6766
movq 0x28(%r15), %r15
testq %r15, %r15
jne 0x6620
jmp 0x6766
movw $0xffff, %r12w          # imm = 0xFFFF
testw %r12w, %r12w
je 0x6778
movq %r14, %rdi
movq (%rsp), %rsi
callq 0x67a4
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x12867(%rip), %rax     # 0x18ff8
movq (%rax), %rdi
leaq 0xabc2(%rip), %rsi      # 0x1135d
xorl %eax, %eax
callq 0x3160
jmp 0x6778