// File: /workspace/github_c_makefile_star2_O0/anuwu[P]ERPLAG-Compiler/parser.c
// Function: populateFollow
void populateFollow (tokenID id)
{
	int rule_index ;

	for (rule_index = 0 ; rule_index < rule_count ; rule_index++)
	{

		tokenID current_rule_lhs = (tokenID) rule[rule_index].LHS;
		node * tmp_of_rhs_of_current_rule = rule[rule_index].RHS;

		while(tmp_of_rhs_of_current_rule != NULL)
		{		
			if(tmp_of_rhs_of_current_rule->key == id)
			{ // if my key is id

				if(tmp_of_rhs_of_current_rule->next == NULL)
				{ // i am last element of this rule

					if(follows[current_rule_lhs] == NULL)
						populateFollow(current_rule_lhs);

					if (id != current_rule_lhs)
						unionFollow (id, current_rule_lhs) ;
				}
				else
				{

					if(containsEpsilon(tmp_of_rhs_of_current_rule->next->key))
					{ // next can go to null firsts[next] contains eps
		
						node * tmp = tmp_of_rhs_of_current_rule->next;
						while(tmp!=NULL && containsEpsilon(tmp->key))
						{
							UnionFollowFirst(id,tmp->key);
							tmp = tmp->next;
						}
						// while can exit either tmp == NULL
						if(tmp == NULL)
						{
							if(follows[current_rule_lhs] == NULL)
								populateFollow(current_rule_lhs);

							unionFollow(id,current_rule_lhs);
						}
						else
							UnionFollowFirst(id,tmp->key);

					}
					else
						UnionFollowFirst(id,tmp_of_rhs_of_current_rule->next->key);
					
				}
			}
			tmp_of_rhs_of_current_rule = tmp_of_rhs_of_current_rule->next;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
cmpl 0x26855(%rip), %eax     # 0x356e0
jge 0xeff9
movslq -0x8(%rbp), %rcx
leaq 0x26854(%rip), %rax     # 0x356f0
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0xc(%rbp)
movslq -0x8(%rbp), %rcx
leaq 0x2683d(%rip), %rax     # 0x356f0
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0xefe9
movq -0x18(%rbp), %rax
movl (%rax), %eax
cmpl -0x4(%rbp), %eax
jne 0xefd8
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0xef1a
movl -0xc(%rbp), %eax
movl %eax, %ecx
leaq 0x2747d(%rip), %rax     # 0x36370
cmpq $0x0, (%rax,%rcx,8)
jne 0xef02
movl -0xc(%rbp), %edi
callq 0xee70
movl -0x4(%rbp), %eax
cmpl -0xc(%rbp), %eax
je 0xef15
movl -0x4(%rbp), %edi
movl -0xc(%rbp), %esi
callq 0xf000
jmp 0xefd6
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movl (%rax), %edi
callq 0xeca0
cmpl $0x0, %eax
je 0xefc2
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x20(%rbp)
movb %al, -0x21(%rbp)
je 0xef5e
movq -0x20(%rbp), %rax
movl (%rax), %edi
callq 0xeca0
cmpl $0x0, %eax
setne %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
testb $0x1, %al
jne 0xef67
jmp 0xef83
movl -0x4(%rbp), %edi
movq -0x20(%rbp), %rax
movl (%rax), %esi
callq 0xf100
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0xef3e
cmpq $0x0, -0x20(%rbp)
jne 0xefb2
movl -0xc(%rbp), %eax
movl %eax, %ecx
leaq 0x273da(%rip), %rax     # 0x36370
cmpq $0x0, (%rax,%rcx,8)
jne 0xefa5
movl -0xc(%rbp), %edi
callq 0xee70
movl -0x4(%rbp), %edi
movl -0xc(%rbp), %esi
callq 0xf000
jmp 0xefc0
movl -0x4(%rbp), %edi
movq -0x20(%rbp), %rax
movl (%rax), %esi
callq 0xf100
jmp 0xefd4
movl -0x4(%rbp), %edi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movl (%rax), %esi
callq 0xf100
jmp 0xefd6
jmp 0xefd8
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0xeec2
jmp 0xefeb
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0xee82
addq $0x30, %rsp
popq %rbp
retq
nop