// File: /workspace/github_cpp_makefile_star2_O2/zhengwangsun[P]pas2c/grammar.cpp
// Function: GetFirstGroup(int)
void GetFirstGroup(int num)            //求编号为num的生成式右部第start位置起之后字符串的FIRST集
{
	int i,j,k,m,n,flag=1;
	i=0;
	while(flag==1&&g[num].right[i]!=-1)
	{
		if(g[num].right[i]>=100)       //是终结符 
		{
			flag=0;
			for(j=0;g[num].FIRST[j]!=-1&&j<FIRSTnum&&g[num].FIRST[j]!=g[num].right[i];j++)
				;
			if(g[num].FIRST[j]==-1)    //无重复的将此终结符加入到FIRST集中 
				g[num].FIRST[j]=g[num].right[i];
		}
		else                           //是非终结符 
		{
			int a[20];                 //暂时存放非终结符g[num].right[i]的FIRST集
			for(m=0;m<20;m++)
				a[m]=-1;
			//求 g[num].right[i]的FIRST集
			for(k=0;k<GenerationNum;k++)
			{
				if(g[k].left==g[num].right[i])
				{
					GetFirstGroup(k);
					for(m=0;g[k].FIRST[m]!=-1;m++)
					{
						for(n=0;a[n]!=-1&&n<20&&a[n]!=g[k].FIRST[m];n++)
							;
						if(a[n]==-1)
							a[n]=g[k].FIRST[m];
					}
				}
			}
			for(k=0;a[k]!=-1&&k<20&&a[k]!=106;k++)
				;
			if(a[k]==-1)               //非终结符g[num].right[i]的FIRST集不含ε
			{
				flag=0; 
				//将非终结符g[num].right[i]的FIRST集全部加入ll.
				for(m=0;a[m]!=-1;m++)
				{
					for(n=0;g[num].FIRST[n]!=-1&&g[num].FIRST[n]!=a[m]&&n<FIRSTnum;n++)
						;
					if(g[num].FIRST[n]==-1)
						g[num].FIRST[n]=a[m];
				}
			}
			else                      //非终结符g[num].right[i]的FIRST集含有ε
			{   //将非终结符g[num].right[i]的FIRST集中的非 ε元素加入
				for(m=0;a[m]!=-1;m++)
				{
					if(a[m]!=106)
					{
						for(n=0;g[num].FIRST[n]!=-1&&g[num].FIRST[n]!=a[m]&&n<FIRSTnum;n++)
							;
						if(g[num].FIRST[n]==-1)
							g[num].FIRST[n]=a[m];
					}
				}
				if(g[num].right[i+1]==-1)//非终结符g[num].right[i]是最后一个元素 
				{
					flag=0;              //将 ε加入 
					for(m=0;g[num].FIRST[m]!=-1&&g[num].FIRST[m]!=106&&m<FIRSTnum;m++)
						;
					if(g[num].FIRST[m]==-1) 
						g[num].FIRST[m]=106;
				}
				else
					i++;
			}
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movslq %edi, %rax
imulq $0xd0, %rax, %r14
leaq 0xa237f(%rip), %r15     # 0xae8a0
addq %r15, %r14
pushq $0x1
popq %rax
xorl %r12d, %r12d
cmpl $0x1, %eax
jne 0xc6bb
movslq %r12d, %r13
movl 0x8(%r14,%r13,4), %ecx
cmpl $-0x1, %ecx
je 0xc6bb
cmpl $0x64, %ecx
jl 0xc56e
xorl %edx, %edx
movl 0x30(%r14,%rdx,4), %esi
cmpq $0x13, %rdx
ja 0xc5f4
cmpl $-0x1, %esi
je 0xc5f4
incq %rdx
cmpl %ecx, %esi
jne 0xc54b
xorl %eax, %eax
jmp 0xc52a
xorl %eax, %eax
cmpq $0x14, %rax
je 0xc57f
orl $-0x1, (%rsp,%rax,4)
incq %rax
jmp 0xc570
xorl %ebx, %ebx
cmpq $0x4c, %rbx
je 0xc5da
imulq $0xd0, %rbx, %rbp
movl 0x4(%rbp,%r15), %eax
cmpl 0x8(%r14,%r13,4), %eax
jne 0xc5d5
addq %r15, %rbp
movl %ebx, %edi
callq 0xc502
xorl %eax, %eax
movl 0x30(%rbp,%rax,4), %ecx
cmpl $-0x1, %ecx
je 0xc5d5
xorl %edx, %edx
movl (%rsp,%rdx,4), %esi
cmpq $0x13, %rdx
ja 0xc5c8
cmpl $-0x1, %esi
je 0xc5c8
incq %rdx
cmpl %ecx, %esi
jne 0xc5b1
jmp 0xc5d0
cmpl $-0x1, %esi
jne 0xc5d0
movl %ecx, (%rsp,%rdx,4)
incq %rax
jmp 0xc5a6
incq %rbx
jmp 0xc581
xorl %eax, %eax
movl (%rsp,%rax,4), %ecx
cmpq $0x14, %rax
je 0xc609
cmpl $-0x1, %ecx
je 0xc655
cmpl $0x6a, %ecx
je 0xc60e
incq %rax
jmp 0xc5dc
xorl %eax, %eax
cmpl $-0x1, %esi
jne 0xc52a
movl %ecx, 0x30(%r14,%rdx,4)
jmp 0xc52a
cmpl $-0x1, %ecx
je 0xc655
xorl %eax, %eax
movl (%rsp,%rax,4), %ecx
cmpl $0x6a, %ecx
je 0xc63d
cmpl $-0x1, %ecx
je 0xc642
xorl %edx, %edx
movl 0x30(%r14,%rdx,4), %esi
cmpl $-0x1, %esi
je 0xc638
cmpq $0x13, %rdx
ja 0xc63d
incq %rdx
cmpl %ecx, %esi
jne 0xc61f
jmp 0xc63d
movl %ecx, 0x30(%r14,%rdx,4)
incq %rax
jmp 0xc610
cmpl $-0x1, 0xc(%r14,%r13,4)
je 0xc688
incl %r12d
pushq $0x1
popq %rax
jmp 0xc52a
xorl %eax, %eax
movl (%rsp,%rax,4), %ecx
cmpl $-0x1, %ecx
je 0xc56a
xorl %edx, %edx
movl 0x30(%r14,%rdx,4), %esi
cmpl $-0x1, %esi
je 0xc67e
cmpq $0x13, %rdx
ja 0xc683
incq %rdx
cmpl %ecx, %esi
jne 0xc665
jmp 0xc683
movl %ecx, 0x30(%r14,%rdx,4)
incq %rax
jmp 0xc657
xorl %ecx, %ecx
movl 0x30(%r14,%rcx,4), %edx
cmpl $-0x1, %edx
je 0xc6ad
xorl %eax, %eax
cmpq $0x13, %rcx
ja 0xc52a
incq %rcx
cmpl $0x6a, %edx
jne 0xc68a
jmp 0xc52a
movl $0x6a, 0x30(%r14,%rcx,4)
jmp 0xc56a
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq