// File: /workspace/github_c_makefile_star2_O3/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 %rdi, %rbx
testq %rdx, %rdx
je 0x6612
movq %rdx, %r15
movq %rsi, (%rsp)
movw $0xffff, %bp            # imm = 0xFFFF
leaq 0xab75(%rip), %r13      # 0x11050
movl 0x4(%r15), %edx
cmpq $0x6, %rdx
ja 0x663b
movslq (%r13,%rdx,4), %rax
addq %r13, %rax
jmpq *%rax
movq 0x18(%r15), %rsi
movl 0x38(%rsi), %eax
testl %eax, %eax
je 0x65ac
cmpl $0x1, %eax
je 0x6620
cmpl $0x4, %eax
jne 0x65f5
jmp 0x6620
movq 0x18(%r15), %rdx
jmp 0x6548
movq 0x18(%r15), %rax
movq 0x18(%rax), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x64b2
testw %ax, %ax
je 0x6628
movl %eax, %ebp
movq 0x18(%r15), %rax
movq 0x28(%rax), %rax
movq 0x18(%rax), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x64b2
jmp 0x65f5
movq 0x18(%r15), %r12
testq %r12, %r12
je 0x6628
xorl %r14d, %r14d
movq (%r12), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x64b2
negw %ax
movl $0x0, %eax
sbbl %eax, %eax
orl %eax, %r14d
movq 0x8(%r12), %r12
testq %r12, %r12
jne 0x6567
testw %r14w, %r14w
movl $0x0, %eax
cmovel %eax, %ebp
jmp 0x65f5
movq 0x18(%r15), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x64b2
movl %eax, %ebp
jmp 0x65f5
movq 0x8(%rsi), %rdi
callq 0xbbcb
testq %rax, %rax
je 0x65ed
movq %rax, %r12
movq %r12, %rdi
callq 0xbc07
movl 0x38(%rax), %ecx
cmpl $0x4, %ecx
je 0x65d2
cmpl $0x1, %ecx
jne 0x65dd
movq %rbx, %rdi
movq %rax, %rsi
callq 0x62d3
movq %r12, %rdi
callq 0xbc13
movq %rax, %r12
testq %rax, %rax
jne 0x65bd
movq 0x18(%r15), %rax
movzwl 0x30(%rax), %ebp
testw %bp, %bp
je 0x6607
movq 0x28(%r15), %r15
testq %r15, %r15
jne 0x64db
testw %bp, %bp
movq (%rsp), %rsi
jne 0x6616
jmp 0x6628
movw $0xffff, %bp            # imm = 0xFFFF
movq %rbx, %rdi
callq 0x6655
jmp 0x662a
movq %rbx, %rdi
callq 0x62d3
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x129b6(%rip), %rax     # 0x18ff8
movq (%rax), %rdi
leaq 0xad09(%rip), %rsi      # 0x11355
xorl %eax, %eax
callq 0x3160
jmp 0x662a