// File: /workspace/github_cpp_makefile_star2_O2/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 $0x248, %rsp            # imm = 0x248
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movslq (%rsi), %rsi
incq %rsi
leaq -0x68(%rbp), %rdi
leaq -0x270(%rbp), %rdx
callq 0x4c94
movslq 0x4(%r14), %rsi
incq %rsi
leaq -0x50(%rbp), %rdi
leaq -0x270(%rbp), %rdx
callq 0x4c94
pushq $0x2
popq %rsi
leaq -0x270(%rbp), %rdx
movq %r15, %rdi
callq 0x4ce6
movq %r15, -0x30(%rbp)
movq (%r15), %rdi
leaq -0x68(%rbp), %rsi
callq 0x4d38
movq -0x30(%rbp), %rax
movq (%rax), %rdi
addq $0x18, %rdi
leaq -0x50(%rbp), %rsi
callq 0x4d38
leaq 0x10(%r14), %rdi
pushq $0x8
popq %rdx
movq %rdi, -0x38(%rbp)
movq %rbx, %rsi
callq 0x2120
leaq -0xd8(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
leaq -0x78(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
addq $0x218, %r14            # imm = 0x218
leaq -0x270(%rbp), %r12
leaq -0xe8(%rbp), %r13
pushq $0x20
popq %rbx
movq -0x38(%rbp), %rdi
movq %r14, %rsi
callq 0x2050
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x3c35
movq %r14, %rdi
leaq 0x3700(%rip), %rsi      # 0x72ce
callq 0x2090
testl %eax, %eax
je 0x3c35
movq %r12, %rdi
movq %r14, %rsi
pushq $0x18
popq %rdx
callq 0x2270
movq %r12, %rdi
movq %r13, %rsi
movl %ebx, %edx
callq 0x22e0
movq %r12, %rdi
leaq -0x88(%rbp), %rsi
movl %ebx, %edx
callq 0x22e0
movq -0x30(%rbp), %rax
movq (%rax), %r15
movq -0x88(%rbp), %rdi
callq 0x2260
movslq %eax, %rdi
shlq $0x5, %rdi
addq (%r15), %rdi
movq %r13, %rsi
callq 0x2100
movq %r12, %rdi
callq 0x2150
jmp 0x3baa
leaq -0xb8(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x367f(%rip), %rsi      # 0x72ce
leaq -0xa8(%rbp), %rdi
leaq -0x270(%rbp), %rdx
callq 0x2aa0
xorl %r15d, %r15d
leaq -0x270(%rbp), %r12
leaq -0xc8(%rbp), %rbx
leaq -0xa8(%rbp), %r13
movq -0x38(%rbp), %rdi
movq %r14, %rsi
callq 0x2050
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x3cf9
movq %r12, %rdi
movq %r14, %rsi
pushq $0x18
popq %rdx
callq 0x2270
movq %r12, %rdi
movq %rbx, %rsi
pushq $0x20
popq %rdx
callq 0x22e0
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2030
testl %eax, %eax
je 0x3cef
movq -0x30(%rbp), %rax
movq (%rax), %rax
movslq %r15d, %rcx
shlq $0x5, %rcx
movq 0x18(%rax), %rax
leaq (%rcx,%rax), %rdi
addq $0x20, %rdi
movq %rbx, %rsi
callq 0x2100
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2100
incl %r15d
movq %r12, %rdi
callq 0x2150
jmp 0x3c7a
movq -0x38(%rbp), %rdi
callq 0x2060
leaq -0xa8(%rbp), %rdi
callq 0x20d0
leaq -0xc8(%rbp), %rdi
callq 0x20d0
leaq -0x88(%rbp), %rdi
callq 0x20d0
leaq -0xe8(%rbp), %rdi
callq 0x20d0
leaq -0x50(%rbp), %rdi
callq 0x25aa
leaq -0x68(%rbp), %rdi
callq 0x25aa
movq -0x30(%rbp), %rax
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3d79
movq %rax, %r14
jmp 0x3daa
movq %rax, %r14
jmp 0x3dd7
movq %rax, %r14
jmp 0x3de0
movq %rax, %r14
jmp 0x3dce
jmp 0x3d72
movq %rax, %r14
jmp 0x3db6
jmp 0x3d79
movq %rax, %r14
jmp 0x3d9e
movq %rax, %r14
leaq -0x270(%rbp), %rdi
callq 0x2150
jmp 0x3db6
movq %rax, %r14
leaq -0x270(%rbp), %rdi
callq 0x2150
leaq -0xa8(%rbp), %rdi
callq 0x20d0
leaq -0xc8(%rbp), %rdi
callq 0x20d0
leaq -0x88(%rbp), %rdi
callq 0x20d0
leaq -0xe8(%rbp), %rdi
callq 0x20d0
movq -0x30(%rbp), %rdi
callq 0x4e0c
leaq -0x50(%rbp), %rdi
callq 0x25aa
leaq -0x68(%rbp), %rdi
callq 0x25aa
movq %r14, %rdi
callq 0x22c0
nop