// File: /workspace/github_cpp_makefile_star2_O1/SeanLee97[P]LL1-Parser/grammar.cpp
// Function: Grammar::_process_grammar[abi:cxx11](char*)
vector<vector<string> > Grammar::_process_grammar(char* inputFile) {

	vector<string> temp_terminals(maxidx_terminal + 1); // Terminal names
	vector<string> temp_nonterminals(num_nonterminals + 1); // Nonterminal names

	vector< vector<string> > temp_names(2);
	temp_names[0] = temp_terminals;
	temp_names[1] = temp_nonterminals;

	input.open(inputFile); // 文件指针

	string cur_terminal_name;
	string cur_terminal_idx;

	// 终结符获取
	while(getline(input, line)) {
		if(line.compare("") == 0) break;

		stringstream ss(line); 
		getline(ss, cur_terminal_name, ' '); 
		getline(ss, cur_terminal_idx, ' ');

		// cout<<cur_terminal_idx<<"-"<<cur_terminal_name<<endl;
		temp_names[0][atoi(cur_terminal_idx.c_str())] = cur_terminal_name;
	}

	int cur_nonterminal_idx = 0; 
	string cur_nonterminal_name; 
	string last_unique_nonterminal("");

	while(getline(input, line)) {
		stringstream ss(line); 
		getline(ss, cur_nonterminal_name, ' ');

		if(cur_nonterminal_name.compare(last_unique_nonterminal) != 0) {
			temp_names[1][cur_nonterminal_idx + 1] = cur_nonterminal_name; 
			++cur_nonterminal_idx; 
			last_unique_nonterminal = cur_nonterminal_name;
		}
	}
	input.close();
	return temp_names;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x258, %rsp            # imm = 0x258
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r12
movslq (%rsi), %rsi
incq %rsi
leaq -0xf0(%rbp), %rdi
leaq -0x278(%rbp), %rdx
callq 0x603a
movslq 0x4(%r14), %rsi
incq %rsi
leaq -0xd8(%rbp), %rdi
leaq -0x278(%rbp), %rdx
callq 0x603a
xorps %xmm0, %xmm0
movups %xmm0, (%r12)
movq $0x0, 0x10(%r12)
movl $0x30, %edi
callq 0x21c0
movq %rax, (%r12)
movq %rax, 0x8(%r12)
movq %rax, %rcx
addq $0x30, %rcx
movq %rcx, 0x10(%r12)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movq %rcx, 0x8(%r12)
leaq -0xf0(%rbp), %rsi
movq %rax, %rdi
callq 0x60c4
movq (%r12), %rdi
addq $0x18, %rdi
leaq -0xd8(%rbp), %rsi
callq 0x60c4
leaq 0x10(%r14), %r15
movq %r15, %rdi
movq %rbx, %rsi
movl $0x8, %edx
callq 0x2120
leaq -0xb0(%rbp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0x90(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
addq $0x218, %r14            # imm = 0x218
movq %r14, -0x40(%rbp)
leaq -0x278(%rbp), %r13
leaq -0xc0(%rbp), %rbx
movq %r12, -0x38(%rbp)
movq -0x40(%rbp), %r14
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %edx
movq %r15, %rdi
movq -0x40(%rbp), %rsi
callq 0x2300
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x45d5
movq %r14, %rdi
leaq 0x3d80(%rip), %rsi      # 0x82ce
callq 0x2090
testl %eax, %eax
je 0x45d5
movq %r13, %rdi
movq %r14, %rsi
movl $0x18, %edx
callq 0x2290
movq %r13, %rdi
movq %rbx, %rsi
movl $0x20, %edx
callq 0x2300
movq %r13, %rdi
leaq -0xa0(%rbp), %rsi
movl $0x20, %edx
callq 0x2300
movq -0x38(%rbp), %rax
movq (%rax), %r12
movq -0xa0(%rbp), %rdi
callq 0x2280
movslq %eax, %rdi
shlq $0x5, %rdi
addq (%r12), %rdi
movq -0x38(%rbp), %r12
movq %rbx, %rsi
callq 0x2100
movq %r13, %rdi
movq 0x69f9(%rip), %rsi      # 0xafb8
callq 0x2160
leaq -0x1f8(%rbp), %rdi
callq 0x20a0
jmp 0x450f
leaq -0x70(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x50(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x3cd7(%rip), %rdx      # 0x82ce
leaq -0x60(%rbp), %rdi
movq %rdx, %rsi
callq 0x2d10
movl $0x0, -0x2c(%rbp)
leaq -0x278(%rbp), %r13
leaq -0x80(%rbp), %rbx
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %edx
movq %r15, %rdi
movq -0x40(%rbp), %rsi
callq 0x2300
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x470a
movq %r13, %rdi
movq -0x40(%rbp), %rsi
movl $0x18, %edx
callq 0x2290
movq %r13, %r14
movq %r13, %rdi
movq %rbx, %rsi
movl $0x20, %edx
callq 0x2300
movq %rbx, %r13
movq -0x78(%rbp), %rbx
movq -0x58(%rbp), %r12
cmpq %rbx, %r12
movq %rbx, %rdx
cmovbq %r12, %rdx
testq %rdx, %rdx
je 0x469c
movq -0x60(%rbp), %rsi
movq -0x80(%rbp), %rdi
callq 0x21e0
testl %eax, %eax
sete %al
jmp 0x469e
movb $0x1, %al
cmpq %r12, %rbx
sete %cl
testb %cl, %al
je 0x46b1
movq -0x38(%rbp), %r12
movq %r13, %rbx
jmp 0x46e7
movq -0x38(%rbp), %r12
movq (%r12), %rax
movslq -0x2c(%rbp), %rcx
shlq $0x5, %rcx
movq 0x18(%rax), %rax
leaq (%rcx,%rax), %rdi
addq $0x20, %rdi
movq %r13, %rbx
movq %r13, %rsi
callq 0x2100
leaq -0x60(%rbp), %rdi
movq %rbx, %rsi
callq 0x2100
incl -0x2c(%rbp)
movq %r14, %r13
movq %r14, %rdi
movq 0x68c4(%rip), %rsi      # 0xafb8
callq 0x2160
leaq -0x1f8(%rbp), %rdi
callq 0x20a0
jmp 0x4615
movq %r15, %rdi
callq 0x2060
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x472b
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x21d0
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x4744
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x21d0
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x4766
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x21d0
movq -0xc0(%rbp), %rdi
leaq -0xb0(%rbp), %rax
cmpq %rax, %rdi
je 0x4788
movq -0xb0(%rbp), %rsi
incq %rsi
callq 0x21d0
leaq -0xd8(%rbp), %rdi
callq 0x26ac
leaq -0xf0(%rbp), %rdi
callq 0x26ac
movq %r12, %rax
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4828
movq %rax, %r14
jmp 0x4844
movq %rax, %r14
jmp 0x48a9
movq %rax, %r14
jmp 0x48b5
movq %rax, %r14
jmp 0x48a1
jmp 0x47db
jmp 0x4828
movq %rax, %r14
jmp 0x485d
movq %rax, %r14
movq 0x67ce(%rip), %rsi      # 0xafb8
leaq -0x278(%rbp), %rdi
callq 0x2160
leaq -0x1f8(%rbp), %rdi
callq 0x20a0
jmp 0x485d
movq %rax, %r14
movq 0x67aa(%rip), %rsi      # 0xafb8
leaq -0x278(%rbp), %rdi
callq 0x2160
leaq -0x1f8(%rbp), %rdi
callq 0x20a0
jmp 0x482b
movq %rax, %r14
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x4844
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x21d0
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x485d
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x21d0
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x487f
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x21d0
movq -0xc0(%rbp), %rdi
leaq -0xb0(%rbp), %rax
cmpq %rax, %rdi
je 0x48a1
movq -0xb0(%rbp), %rsi
incq %rsi
callq 0x21d0
movq %r12, %rdi
callq 0x6252
leaq -0xd8(%rbp), %rdi
callq 0x26ac
leaq -0xf0(%rbp), %rdi
callq 0x26ac
movq %r14, %rdi
callq 0x22e0
nop