// File: /workspace/github_cpp_makefile_star2_O1/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, 0xa61e4(%rip)    # 0xb86d0
movdqa %xmm0, 0xa61cc(%rip)    # 0xb86c0
movdqa %xmm0, 0xa61b4(%rip)    # 0xb86b0
movdqa %xmm0, 0xa619c(%rip)    # 0xb86a0
movdqa %xmm0, 0xa6184(%rip)    # 0xb8690
movslq %edi, %rax
movslq %esi, %rdx
imulq $0xd0, %rax, %rax
leaq 0xa23b0(%rip), %rcx     # 0xb48d0
addq %rcx, %rax
cmpl $-0x1, 0xc(%rax,%rdx,4)
je 0x126df
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
incl %esi
leaq 0xa614f(%rip), %rdx     # 0xb8690
leaq 0xa614c(%rip), %rdi     # 0xb8694
movslq %esi, %r9
movl 0x8(%rax,%r9,4), %r8d
cmpl $-0x1, %r8d
je 0x126d4
cmpl $0x63, %r8d
jle 0x125b5
movl 0xa6129(%rip), %r11d    # 0xb8690
movq %rdx, %r9
cmpl $-0x1, %r11d
sete %r10b
je 0x125ad
movq %rdx, %r9
cmpl %r8d, %r11d
je 0x125a4
movq %rdi, %r9
xorl %r11d, %r11d
movl (%r9), %ebx
cmpl $-0x1, %ebx
sete %r10b
je 0x125ad
addq $0x4, %r9
cmpq $0x12, %r11
ja 0x125a0
incq %r11
cmpl %r8d, %ebx
jne 0x12582
addq $-0x4, %r9
testb %r10b, %r10b
je 0x126c8
movl %r8d, (%r9)
jmp 0x126c8
xorl %r10d, %r10d
imulq $0xd0, %r10, %r11
cmpl %r8d, 0x4(%r11,%rcx)
jne 0x1262f
addq %rcx, %r11
movl 0x30(%r11), %ebx
cmpl $-0x1, %ebx
je 0x1262f
xorl %r14d, %r14d
movl 0xa60b4(%rip), %r12d    # 0xb8690
movq %rdx, %r15
cmpl $-0x1, %r12d
sete %bpl
je 0x1261f
movq %rdx, %r15
cmpl %ebx, %r12d
je 0x1261a
movq %rdi, %r15
xorl %r12d, %r12d
movl (%r15), %r13d
cmpl $-0x1, %r13d
sete %bpl
je 0x1261f
addq $0x4, %r15
cmpq $0x12, %r12
ja 0x12616
incq %r12
cmpl %ebx, %r13d
jne 0x125f7
addq $-0x4, %r15
testb %bpl, %bpl
je 0x12622
movl %ebx, (%r15)
movl 0x34(%r11,%r14,4), %ebx
incq %r14
cmpl $-0x1, %ebx
jne 0x125d5
incq %r10
cmpq $0x4c, %r10
jne 0x125b8
movl 0xa6051(%rip), %r10d    # 0xb8690
cmpl $-0x1, %r10d
sete %r8b
je 0x126c8
cmpl $0x6a, %r10d
jne 0x126a5
testb %r8b, %r8b
jne 0x126c8
cmpl $-0x1, 0xc(%rax,%r9,4)
je 0x126c8
incl %esi
movq $-0x1, %r8
movq %rdi, %r10
movq %rdx, %r11
incq %r8
cmpl $0x6a, (%r11)
movq %r10, %r9
leaq 0x4(%r11), %r11
leaq 0x4(%r10), %r10
jne 0x1266b
movl %r8d, %r10d
movb $0x1, %r8b
cmpl $-0x1, (%rdx,%r10,4)
je 0x126cb
leaq (%rdx,%r10,4), %r10
movl (%r9), %r11d
movl %r11d, (%r10)
cmpl $-0x1, (%r9)
movq %r9, %r10
leaq 0x4(%r9), %r9
jne 0x12690
jmp 0x126cb
xorl %r10d, %r10d
movl 0x4(%rdx,%r10,4), %r11d
cmpl $-0x1, %r11d
sete %r8b
je 0x126c8
cmpq $0x12, %r10
ja 0x1264f
incq %r10
cmpl $0x6a, %r11d
jne 0x126a8
jmp 0x1264f
xorl %r8d, %r8d
testb %r8b, %r8b
jne 0x12548
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x6a, 0xa5fa7(%rip)    # 0xb8690
retq