// File: /workspace/github_cpp_makefile_star2_O3/zhengwangsun[P]pas2c/grammar.cpp
// Function: GetFirst(int, int)
void GetFirst(int num,int start)       //求编号为num的生成式右部第start位置起之后字符串的FIRST集,并将结果存入数组First中
{
	int i,j,k,m,flag;
	for(i=0;i<FIRSTnum;i++)
		First[i]=-1;
	if(g[num].right[start+1]==-1)      //start之后字符串为空
		First[0]=106;                  //将 ε加入到First中
	else
	{
		i=start+1;
		flag=1;
		while(flag==1&&g[num].right[i]!=-1)
		{
			if(g[num].right[i]>=100)   //是终结符 
			{
				flag=0;
				for(j=0;First[j]!=-1&&First[j]!=g[num].right[i]&&j<FIRSTnum;j++)
					;
				if(First[j]==-1)       //无重复的将此终结符加入到First中
					First[j]=g[num].right[i];
			}
			else                       //是非终结符 
			{                          //求 g[num].right[i]的FIRST集	
				for(j=0;j<GenerationNum;j++)
				{
					if(g[j].left==g[num].right[i])
					{
						for(k=0;g[j].FIRST[k]!=-1;k++)
						{              //无重复的将此非终结符的FIRST集元素加入到First中 
							for(m=0;First[m]!=-1&&First[m]!=g[j].FIRST[k]&&m<FIRSTnum;m++)
								;
							if(First[m]==-1)
								First[m]=g[j].FIRST[k];
						}
					}
				}
				for(j=0;First[j]!=-1&&First[j]!=106&&j<FIRSTnum;j++)
					;
				if(First[j]==-1)       //非终结符g[num].right[i]的FIRST集不含ε
					flag=0;
				else                   //非终结符g[num].right[i]的FIRST集含有ε
				{   
					if(g[num].right[i+1]==-1)//非终结符g[num].right[i]是最后一个元素
						flag=0;
					else               //非终结符g[num].right[i]不是最后一个元素
					{                  //将 ε从First中删除
						for(j=0;First[j]!=106;j++)
							;
						for(k=j;First[k]!=-1;k++)
							First[k]=First[k+1];
						
						i++;           //继续处理下一个元素 
					}	
				}
			}
		}
	}
}

// Assembly:
pcmpeqd %xmm0, %xmm0
movdqa %xmm0, 0xa56d9(%rip)    # 0xb76d0
movdqa %xmm0, 0xa56c1(%rip)    # 0xb76c0
movdqa %xmm0, 0xa56a9(%rip)    # 0xb76b0
movdqa %xmm0, 0xa5691(%rip)    # 0xb76a0
movdqa %xmm0, 0xa5679(%rip)    # 0xb7690
movslq %edi, %rax
movslq %esi, %rdx
imulq $0xd0, %rax, %rax
leaq 0xa18a5(%rip), %rcx     # 0xb38d0
addq %rcx, %rax
cmpl $-0x1, 0xc(%rax,%rdx,4)
je 0x12179
incl %esi
movslq %esi, %rdx
movl 0x8(%rax,%rdx,4), %r8d
cmpl $-0x1, %r8d
je 0x12183
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq 0xa5634(%rip), %rdx     # 0xb7690
leaq 0xa5631(%rip), %rdi     # 0xb7694
cmpl $0x63, %r8d
jg 0x12184
xorl %r9d, %r9d
imulq $0xd0, %r9, %r10
cmpl %r8d, 0x4(%r10,%rcx)
jne 0x120d6
addq %rcx, %r10
movl 0x30(%r10), %ebp
cmpl $-0x1, %ebp
je 0x120d6
movl 0xa5600(%rip), %ebx     # 0xb7690
xorl %r11d, %r11d
movq %rdx, %r14
cmpl $-0x1, %ebx
je 0x120c0
movq %rdx, %r14
xorl %r15d, %r15d
movl %ebx, %r12d
cmpq $0x13, %r15
ja 0x120c9
cmpl %ebp, %r12d
je 0x120c9
incq %r15
movl 0x4(%r14), %r12d
addq $0x4, %r14
cmpl $-0x1, %r12d
jne 0x120a4
movl %ebp, (%r14)
movl 0xa55c7(%rip), %ebx     # 0xb7690
movl 0x34(%r10,%r11,4), %ebp
incq %r11
cmpl $-0x1, %ebp
jne 0x12093
incq %r9
cmpq $0x4c, %r9
jne 0x12070
movl 0xa55aa(%rip), %r8d     # 0xb7690
cmpl $-0x1, %r8d
je 0x121b5
xorl %r9d, %r9d
cmpq $0x13, %r9
ja 0x12112
cmpl $0x6a, %r8d
je 0x12112
movl 0x4(%rdx,%r9,4), %r8d
incq %r9
cmpl $-0x1, %r8d
jne 0x120f3
jmp 0x121b5
movslq %esi, %r8
cmpl $-0x1, 0xc(%rax,%r8,4)
je 0x121b5
incl %esi
movq $-0x1, %r9
movq %rdi, %r10
movq %rdx, %r11
incq %r9
cmpl $0x6a, (%r11)
movq %r10, %r8
leaq 0x4(%r11), %r11
leaq 0x4(%r10), %r10
jne 0x12130
movl %r9d, %r9d
cmpl $-0x1, (%rdx,%r9,4)
je 0x12165
leaq (%rdx,%r9,4), %r9
movl (%r8), %r10d
movl %r10d, (%r9)
movq %r8, %r9
addq $0x4, %r8
cmpl $-0x1, %r10d
jne 0x12152
movslq %esi, %r8
movl 0x8(%rax,%r8,4), %r8d
cmpl $-0x1, %r8d
jne 0x12063
jmp 0x121b5
movl $0x6a, 0xa550d(%rip)    # 0xb7690
retq
movl 0xa5506(%rip), %edx     # 0xb7690
leaq 0xa54ff(%rip), %rax     # 0xb7690
cmpl $-0x1, %edx
je 0x121b2
xorl %ecx, %ecx
cmpq $0x13, %rcx
ja 0x121b5
cmpl %r8d, %edx
je 0x121b5
incq %rcx
movl 0x4(%rax), %edx
addq $0x4, %rax
cmpl $-0x1, %edx
jne 0x12198
movl %r8d, (%rax)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq