// File: /workspace/github_c_makefile_star2_O0/anuwu[P]ERPLAG-Compiler/parser.c
// Function: traverse_grammar
void traverse_grammar()
{
	for(int i=0;i<150;i++)
	{
		for(int j=0;j<150;j++)
		{
			parsetable[i][j]=-1;
		}
	}	

	for(int i=0;i<rule_count;i++)
	{
		int lhs_enum_value=rule[i].LHS;
		node* temp=rule[i].RHS;


		// NT -> eps 
		if(temp->key==TK_EPS)
		{
			node* temp3=follows[lhs_enum_value];
			while(temp3!=NULL)
			{
				parsetable[lhs_enum_value][temp3->key]=i;
				temp3=temp3->next;
			}
			continue;
		}	

		// traversing on rhs T/NT sequentially	
		while(temp!=NULL)
		{	
			// temp2 is Terminals in first of T/NT
			node* temp2=firsts[temp->key];

			int flag=0;
			while(temp2!=NULL)
			{
				if(temp2->key!=TK_EPS)
					parsetable[lhs_enum_value][temp2->key]=i;
				else
					flag=1;

				temp2=temp2->next;
			}

			if(flag==0)
				break;
			else // haven't encountered eps yet so keep filling by next T/NT's first
				temp=temp->next;

		}

		if(temp==NULL)
		{
			// all firsts are consumed and all are nullable
			node* temp3=follows[lhs_enum_value];
			while(temp3!=NULL)
			{
				parsetable[lhs_enum_value][temp3->key]=i;
				temp3=temp3->next;
			}
		}
		
	}	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl $0x0, -0x4(%rbp)
cmpl $0x96, -0x4(%rbp)
jge 0xe8fc
movl $0x0, -0x8(%rbp)
cmpl $0x96, -0x8(%rbp)
jge 0xe8ef
movslq -0x4(%rbp), %rcx
leaq 0x10e81(%rip), %rax     # 0x1f750
imulq $0x258, %rcx, %rcx      # imm = 0x258
addq %rcx, %rax
movslq -0x8(%rbp), %rcx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0xe8bb
jmp 0xe8f1
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0xe8ab
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl 0x26dd4(%rip), %eax     # 0x356e0
jge 0xea84
movslq -0xc(%rbp), %rcx
leaq 0x26dd3(%rip), %rax     # 0x356f0
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x10(%rbp)
movslq -0xc(%rbp), %rcx
leaq 0x26dbc(%rip), %rax     # 0x356f0
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x36, (%rax)
jne 0xe99a
movslq -0x10(%rbp), %rcx
leaq 0x27a19(%rip), %rax     # 0x36370
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xe995
movl -0xc(%rbp), %edx
movslq -0x10(%rbp), %rcx
leaq 0x10ddc(%rip), %rax     # 0x1f750
imulq $0x258, %rcx, %rcx      # imm = 0x258
addq %rcx, %rax
movq -0x20(%rbp), %rcx
movl (%rcx), %ecx
movl %edx, (%rax,%rcx,4)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0xe95f
jmp 0xea76
jmp 0xe99c
cmpq $0x0, -0x18(%rbp)
je 0xea22
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, %ecx
leaq 0x27ffe(%rip), %rax     # 0x369b0
movq (%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0xea09
movq -0x28(%rbp), %rax
cmpl $0x36, (%rax)
je 0xe9f4
movl -0xc(%rbp), %edx
movslq -0x10(%rbp), %rcx
leaq 0x10d71(%rip), %rax     # 0x1f750
imulq $0x258, %rcx, %rcx      # imm = 0x258
addq %rcx, %rax
movq -0x28(%rbp), %rcx
movl (%rcx), %ecx
movl %edx, (%rax,%rcx,4)
jmp 0xe9fb
movl $0x1, -0x2c(%rbp)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0xe9c1
cmpl $0x0, -0x2c(%rbp)
jne 0xea11
jmp 0xea22
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0xe99c
cmpq $0x0, -0x18(%rbp)
jne 0xea74
movslq -0x10(%rbp), %rcx
leaq 0x2793c(%rip), %rax     # 0x36370
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0xea72
movl -0xc(%rbp), %edx
movslq -0x10(%rbp), %rcx
leaq 0x10cff(%rip), %rax     # 0x1f750
imulq $0x258, %rcx, %rcx      # imm = 0x258
addq %rcx, %rax
movq -0x38(%rbp), %rcx
movl (%rcx), %ecx
movl %edx, (%rax,%rcx,4)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0xea3c
jmp 0xea74
jmp 0xea76
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xe903
popq %rbp
retq
nopw %cs:(%rax,%rax)