// File: /workspace/github_cpp_makefile_star2_O1/SeanLee97[P]LL1-Parser/grammar.cpp
// Function: Grammar::get_predict(std::vector<bool, std::allocator<bool>>, std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>, std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>)
vector<vector<int> > Grammar::get_predict(vector<bool> local_is_epsilon, vector<vector<int> > local_first_sets, vector<vector<int> > local_follow_sets) {
	vector<vector<int> > temp_predict_sets(num_rules, vector<int>(0));
	
	for(int i = 0; i < full_rules.size(); i++) {
		for(int j = 1; j < full_rules[i].size(); j++) {
			if(full_rules[i][j] == 0) {
				// end
				// 把当前nonterminal的follow集唯一的追加到predict集中
				temp_predict_sets[i] = _push_unique_elements(temp_predict_sets[i], local_follow_sets[full_rules[i][0]]); // Only push unique elements into the vector
				break;

			// terminal
			} else if(full_rules[i][j] < 0) { 
				// push
				temp_predict_sets[i].push_back(abs(full_rules[i][j]));
				break;

			// nonterminal
			} else { 
				temp_predict_sets[i] = _push_unique_elements(temp_predict_sets[i], local_first_sets[full_rules[i][j]]); // Only push unique elements
				// 若导空则追加follow(当前nonterminal的根nonterminal)
				if(local_is_epsilon[full_rules[i][j] - 1]) {
					if(full_rules[i][j + 1] == 0) {
						temp_predict_sets[i] = _push_unique_elements(temp_predict_sets[i], local_follow_sets[full_rules[i][0]]);
						break;
					}
					continue;
				} else break;
			}
		}
	}

	return temp_predict_sets;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %r8, -0x68(%rbp)
movq %rcx, -0x88(%rbp)
movq %rdx, -0x80(%rbp)
movq %rsi, -0x38(%rbp)
movslq 0x8(%rsi), %rsi
xorps %xmm0, %xmm0
leaq -0x60(%rbp), %rdx
movaps %xmm0, (%rdx)
movq $0x0, 0x10(%rdx)
leaq -0x39(%rbp), %rcx
movq %rdi, -0x30(%rbp)
callq 0x5f18
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x3f7d
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq -0x38(%rbp), %rcx
movq 0x2d0(%rcx), %rax
cmpq 0x2c8(%rcx), %rax
je 0x42f7
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
xorl %ecx, %ecx
addq $0x3f, %rax
movq %rax, -0x78(%rbp)
movl $0x1, %r12d
movq %rcx, -0x70(%rbp)
leaq (%rcx,%rcx,2), %r14
leaq (,%r14,8), %r15
movq -0x38(%rbp), %rax
movq 0x2c8(%rax), %rcx
movq (%rcx,%r14,8), %rax
movq 0x8(%rcx,%r14,8), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r12, %rcx
jbe 0x42c3
cmpl $0x0, (%rax,%r12,4)
je 0x41d1
js 0x428b
movq -0x30(%rbp), %rax
movq (%rax), %rsi
addq %r15, %rsi
leaq -0xa0(%rbp), %rdi
callq 0x5fba
movq -0x38(%rbp), %rax
movq 0x2c8(%rax), %rax
movq (%rax,%r14,8), %rax
movslq (%rax,%r12,4), %rax
leaq (%rax,%rax,2), %rsi
shlq $0x3, %rsi
movq -0x88(%rbp), %rax
addq (%rax), %rsi
leaq -0xe8(%rbp), %r13
movq %r13, %rdi
callq 0x5fba
leaq -0x60(%rbp), %rbx
movq %rbx, %rdi
leaq -0xa0(%rbp), %rdx
movq %r13, %rcx
callq 0x3e00
movq -0x30(%rbp), %rax
movq (%rax), %rdi
addq %r15, %rdi
movq %rbx, %rsi
callq 0x6858
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x407b
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq -0xe8(%rbp), %rdi
testq %rdi, %rdi
je 0x4096
movq -0xd8(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq -0xa0(%rbp), %rdi
testq %rdi, %rdi
je 0x40b1
movq -0x90(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq -0x38(%rbp), %rax
movq 0x2c8(%rax), %rax
movq (%rax,%r14,8), %rax
movslq (%rax,%r12,4), %rcx
leaq -0x1(%rcx), %rdx
addq $0x3e, %rcx
testq %rdx, %rdx
cmovnsq %rdx, %rcx
sarq $0x6, %rcx
shlq $0x3, %rcx
movq -0x80(%rbp), %rsi
addq (%rsi), %rcx
movq %rdx, %rsi
andq -0x78(%rbp), %rsi
xorl %edi, %edi
movabsq $-0x8000000000000000, %r8 # imm = 0x8000000000000000
cmpq %r8, %rsi
setbe %dil
movq -0x8(%rcx,%rdi,8), %rcx
btq %rdx, %rcx
jae 0x42c3
cmpl $0x0, 0x4(%rax,%r12,4)
leaq 0x1(%r12), %r12
jne 0x3fbf
movq -0x30(%rbp), %rax
movq (%rax), %rsi
addq %r15, %rsi
leaq -0xd0(%rbp), %r12
movq %r12, %rdi
callq 0x5fba
movq -0x38(%rbp), %rax
movq 0x2c8(%rax), %rax
movq (%rax,%r14,8), %rax
movslq (%rax), %rax
leaq (%rax,%rax,2), %rsi
shlq $0x3, %rsi
movq -0x68(%rbp), %rax
addq (%rax), %rsi
leaq -0xb8(%rbp), %r14
movq %r14, %rdi
callq 0x5fba
movq %rbx, %rdi
movq %r12, %rdx
movq %r14, %rcx
callq 0x3e00
movq -0x30(%rbp), %rax
addq (%rax), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x6858
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x419a
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq -0xb8(%rbp), %rdi
testq %rdi, %rdi
je 0x41b5
movq -0xa8(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq -0xd0(%rbp), %rdi
testq %rdi, %rdi
je 0x42c3
movq -0xc0(%rbp), %rsi
jmp 0x4281
movq -0x30(%rbp), %rax
movq (%rax), %rsi
addq %r15, %rsi
leaq -0x118(%rbp), %r12
movq %r12, %rdi
callq 0x5fba
movq -0x38(%rbp), %rax
movq 0x2c8(%rax), %rax
movq (%rax,%r14,8), %rax
movslq (%rax), %rax
leaq (%rax,%rax,2), %rsi
shlq $0x3, %rsi
movq -0x68(%rbp), %rax
addq (%rax), %rsi
leaq -0x100(%rbp), %r14
movq %r14, %rdi
callq 0x5fba
leaq -0x60(%rbp), %rbx
movq %rbx, %rdi
movq %r12, %rdx
movq %r14, %rcx
callq 0x3e00
movq -0x30(%rbp), %rax
addq (%rax), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x6858
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x4253
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq -0x100(%rbp), %rdi
testq %rdi, %rdi
je 0x426e
movq -0xf0(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq -0x118(%rbp), %rdi
testq %rdi, %rdi
je 0x42c3
movq -0x108(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
jmp 0x42c3
movq -0x30(%rbp), %rcx
movq (%rcx), %rcx
leaq (%rcx,%r14,8), %rdi
movl (%rax,%r12,4), %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
movl %eax, -0x60(%rbp)
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x42ba
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x42c3
leaq -0x60(%rbp), %rdx
callq 0x665a
movq -0x38(%rbp), %rcx
movq 0x2d0(%rcx), %rax
subq 0x2c8(%rcx), %rax
movq -0x70(%rbp), %rcx
incq %rcx
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rax
cmpq %rcx, %rax
ja 0x3fa9
movq -0x30(%rbp), %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x43f7
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
jmp 0x43f7
jmp 0x43eb
movq %rax, %r14
movq -0xb8(%rbp), %rdi
testq %rdi, %rdi
je 0x4356
movq -0xa8(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
jmp 0x4356
movq %rax, %r14
movq -0xd0(%rbp), %rdi
testq %rdi, %rdi
je 0x43ee
movq -0xc0(%rbp), %rsi
jmp 0x43e1
jmp 0x43eb
movq %rax, %r14
movq -0x100(%rbp), %rdi
testq %rdi, %rdi
je 0x4394
movq -0xf0(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
jmp 0x4394
movq %rax, %r14
movq -0x118(%rbp), %rdi
testq %rdi, %rdi
je 0x43ee
movq -0x108(%rbp), %rsi
jmp 0x43e1
jmp 0x43eb
movq %rax, %r14
movq -0xe8(%rbp), %rdi
testq %rdi, %rdi
je 0x43ce
movq -0xd8(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
jmp 0x43ce
movq %rax, %r14
movq -0xa0(%rbp), %rdi
testq %rdi, %rdi
je 0x43ee
movq -0x90(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
jmp 0x43ee
movq %rax, %r14
movq -0x30(%rbp), %rdi
callq 0x2650
movq %r14, %rdi
callq 0x22e0
nop