// File: /workspace/github_cpp_makefile_star2_O2/Caproner[P]Naive_Compiler/main.cpp
// Function: main
int main(int argc,char *argv[])
{
	Lexical L;
	L.init();
	
	Grammar G;
	G.init();
	
	Semantic S;
	S.init();
	
	FILE *Input;
	if(argc!=1)Input=fopen(argv[1],"r");
	else cout<<"[Naive by Caproner]\nWelcome to use Naive_C!\n > ";
	
	string s;
	while(true)
	{
		if(argc==1)
		{
			if(!getline(cin,s))break;
		}
		else
		{
			if(fgets(Read,100000,Input)==NULL)break;
			s=Read;
		}
		L.Input(s);
		if(!L.Analysis())
		{
			cout<<"Error：词法分析出错"<<endl<<" > ";
			continue;
		}
		
		Word_List WL=L.Output();
		#ifdef TEST
		for(int i=0;i<WL.List.size();i++)
		{
			cout<<"["<<WL.List[i].Number<<","<<WL.List[i].Value<<"]"<<endl;
		}
		cout<<"词法分析结束"<<endl;
		#endif
		
		G.Input(WL);
		if(!G.Analysis())
		{
			cout<<"Error：语法分析出错"<<endl<<" > ";
			continue;
		}
		
		Forest F=G.Output();
		#ifdef TEST
		for(int i=0;i<F.forest.size();i++)
		{
			cout<<"输出第"<<i+1<<"棵语法树"<<endl;
			print(F.forest[i]);
		}
		cout<<"语法分析结束"<<endl;
		#endif
		
		if(!S.Analysis(F))
		{
			cout<<"Error：语义分析出错"<<endl<<" > ";
			continue; 
		}
		
		#ifdef TEST
		for(int i=0;i<F.forest.size();i++)
		{
			cout<<"输出第"<<i+1<<"棵语法树"<<endl;
			print(F.forest[i]);
		}
		cout<<"语义分析结束"<<endl;
		#endif
		cout<<" > ";
	}
	
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2a8, %rsp            # imm = 0x2A8
leaq 0xd8(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rsi, %r14
movl %edi, %ebx
movb $0x0, (%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
andq $0x0, 0x20(%rax)
leaq 0x108(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq 0xc8(%rsp), %rdi
callq 0x369c
leaq 0x130(%rsp), %rdi
callq 0x28a2
leaq 0x130(%rsp), %rdi
callq 0x4158
leaq 0x68(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq 0x60(%rsp), %rdi
callq 0x5ddc
cmpl $0x1, %ebx
jne 0x25f5
movq 0x89e9(%rip), %rdi      # 0xafd0
leaq 0x4a52(%rip), %rsi      # 0x7040
callq 0x2190
jmp 0x260a
movq 0x8(%r14), %rdi
leaq 0x4afa(%rip), %rsi      # 0x70fa
callq 0x21d0
movq %rax, 0x8(%rsp)
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x40(%rsp), %r12
leaq 0xa8(%rsp), %r13
leaq 0xc8(%rsp), %rbp
leaq 0x90(%rsp), %r14
cmpl $0x1, %ebx
jne 0x265f
movq 0x899c(%rip), %rdi      # 0xafe0
movq %r12, %rsi
callq 0x2060
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
je 0x268d
jmp 0x27ce
leaq 0x8b3a(%rip), %rdi      # 0xb1a0
movl $0x186a0, %esi          # imm = 0x186A0
movq 0x8(%rsp), %rdx
callq 0x2220
testq %rax, %rax
je 0x27ce
movq %r12, %rdi
leaq 0x8b18(%rip), %rsi      # 0xb1a0
callq 0x22b0
movq %r13, %rdi
movq %r12, %rsi
callq 0x21f0
movq %rbp, %rdi
movq %r13, %rsi
callq 0x36a6
movq %r13, %rdi
callq 0x20c0
movq %rbp, %rdi
callq 0x36c0
testb %al, %al
je 0x2766
leaq 0x28(%rsp), %r15
movq %r15, %rdi
movq %rbp, %rsi
callq 0x375a
movq %r14, %rdi
movq %r15, %rsi
callq 0x2ffa
leaq 0x130(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x4428
movq %r14, %rdi
callq 0x304a
movq %r15, %rdi
callq 0x44ca
testb %al, %al
je 0x2795
leaq 0x10(%rsp), %r15
movq %r15, %rdi
leaq 0x130(%rsp), %rsi
callq 0x4526
leaq 0x60(%rsp), %rdi
movq %r15, %rsi
callq 0x5de2
movl %eax, %ecx
movq 0x88a4(%rip), %rax      # 0xafd0
testb %cl, %cl
jne 0x274b
movq 0x8899(%rip), %rdi      # 0xafd0
leaq 0x4968(%rip), %rsi      # 0x70a6
callq 0x2190
movq %rax, %rdi
callq 0x20d0
movq %rax, %rdi
leaq 0x4917(%rip), %rsi      # 0x706c
callq 0x2190
leaq 0x10(%rsp), %rdi
callq 0x30e4
jmp 0x27bf
movq 0x8863(%rip), %rdi      # 0xafd0
leaq 0x48fc(%rip), %rsi      # 0x7070
callq 0x2190
movq %rax, %rdi
callq 0x20d0
movq %rax, %rdi
leaq 0x48e1(%rip), %rsi      # 0x706c
callq 0x2190
jmp 0x2638
movq 0x8834(%rip), %rdi      # 0xafd0
leaq 0x48e8(%rip), %rsi      # 0x708b
callq 0x2190
movq %rax, %rdi
callq 0x20d0
movq %rax, %rdi
leaq 0x48b2(%rip), %rsi      # 0x706c
callq 0x2190
leaq 0x28(%rsp), %rdi
callq 0x304a
jmp 0x2638
leaq 0x40(%rsp), %rdi
callq 0x20c0
leaq 0x60(%rsp), %rdi
callq 0x3118
leaq 0x130(%rsp), %rdi
callq 0x29aa
leaq 0xc8(%rsp), %rdi
callq 0x2a00
xorl %eax, %eax
addq $0x2a8, %rsp            # imm = 0x2A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2812
movq %rax, %rbx
jmp 0x2876
movq %rax, %rbx
jmp 0x2880
jmp 0x281e
movq %rax, %rbx
jmp 0x288d
jmp 0x285a
jmp 0x2869
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x304a
jmp 0x285d
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x30e4
jmp 0x285d
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x20c0
jmp 0x286c
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x304a
jmp 0x286c
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x20c0
leaq 0x60(%rsp), %rdi
callq 0x3118
leaq 0x130(%rsp), %rdi
callq 0x29aa
leaq 0xc8(%rsp), %rdi
callq 0x2a00
movq %rbx, %rdi
callq 0x2280