// File: /workspace/github_cpp_makefile_star2_O3/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 $0xe8, %rsp
movq %r8, -0x58(%rbp)
movq %rcx, -0x78(%rbp)
movq %rdx, -0x70(%rbp)
movq %rsi, %r13
movslq 0x8(%rsi), %rsi
xorps %xmm0, %xmm0
leaq -0x50(%rbp), %rdx
movaps %xmm0, (%rdx)
movq $0x0, 0x10(%rdx)
leaq -0x31(%rbp), %rcx
movq %rdi, -0x30(%rbp)
callq 0x5e1a
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x3efb
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x2c8(%r13), %rax
cmpq %rax, 0x2d0(%r13)
je 0x4270
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorl %edx, %edx
addq $0x3f, %rcx
movq %rcx, -0x68(%rbp)
movq %rdx, -0x60(%rbp)
leaq (%rdx,%rdx,2), %r15
movq (%rax,%r15,8), %rcx
movl $0x1, %r14d
leaq (,%r15,8), %r12
movq 0x8(%rax,%r15,8), %rax
subq %rcx, %rax
sarq $0x2, %rax
cmpq %r14, %rax
jbe 0x423d
movl (%rcx,%r14,4), %eax
testl %eax, %eax
je 0x414b
js 0x420e
movq -0x30(%rbp), %rax
movq (%rax), %rsi
addq %r12, %rsi
leaq -0x90(%rbp), %rdi
callq 0x5ebc
movq 0x2c8(%r13), %rax
movq (%rax,%r15,8), %rax
movslq (%rax,%r14,4), %rax
leaq (%rax,%rax,2), %rsi
shlq $0x3, %rsi
movq -0x78(%rbp), %rax
addq (%rax), %rsi
leaq -0xd8(%rbp), %rbx
movq %rbx, %rdi
callq 0x5ebc
leaq -0x50(%rbp), %rdi
leaq -0x90(%rbp), %rdx
movq %rbx, %rcx
callq 0x3d9c
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq (%rax,%r15,8), %rdi
movq 0x10(%rax,%r15,8), %rsi
movq -0x50(%rbp), %rcx
movq %rcx, (%rax,%r15,8)
movq -0x48(%rbp), %rcx
movq %rcx, 0x8(%rax,%r15,8)
movq -0x40(%rbp), %rcx
movq %rcx, 0x10(%rax,%r15,8)
testq %rdi, %rdi
je 0x3ff1
subq %rdi, %rsi
callq 0x21d0
movq -0xd8(%rbp), %rdi
testq %rdi, %rdi
je 0x400c
movq -0xc8(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0x4024
movq -0x80(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x2c8(%r13), %rax
movq (%rax,%r15,8), %rcx
movslq (%rcx,%r14,4), %rdx
decq %rdx
leal 0x3f(%rdx), %esi
testl %edx, %edx
cmovnsl %edx, %esi
sarl $0x6, %esi
movslq %esi, %rsi
shlq $0x3, %rsi
movq -0x70(%rbp), %rdi
addq (%rdi), %rsi
movq %rdx, %rdi
andq -0x68(%rbp), %rdi
xorl %r8d, %r8d
movabsq $-0x8000000000000000, %r9 # imm = 0x8000000000000000
cmpq %r9, %rdi
setbe %r8b
movq -0x8(%rsi,%r8,8), %rsi
btq %rdx, %rsi
jae 0x423d
cmpl $0x0, 0x4(%rcx,%r14,4)
leaq 0x1(%r14), %r14
jne 0x3f3d
movq -0x30(%rbp), %rax
addq (%rax), %r12
leaq -0xc0(%rbp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x5ebc
movq 0x2c8(%r13), %rax
movq (%rax,%r15,8), %rax
movslq (%rax), %rax
leaq (%rax,%rax,2), %rsi
shlq $0x3, %rsi
movq -0x58(%rbp), %rax
addq (%rax), %rsi
leaq -0xa8(%rbp), %r14
movq %r14, %rdi
callq 0x5ebc
leaq -0x50(%rbp), %rdi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x3d9c
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq (%rax,%r15,8), %rdi
movq 0x10(%rax,%r15,8), %rsi
movq -0x50(%rbp), %rcx
movq %rcx, (%rax,%r15,8)
movq -0x48(%rbp), %rcx
movq %rcx, 0x8(%rax,%r15,8)
movq -0x40(%rbp), %rcx
movq %rcx, 0x10(%rax,%r15,8)
testq %rdi, %rdi
je 0x4114
subq %rdi, %rsi
callq 0x21d0
movq -0xa8(%rbp), %rdi
testq %rdi, %rdi
je 0x412f
movq -0x98(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq -0xc0(%rbp), %rdi
testq %rdi, %rdi
je 0x423d
movq -0xb0(%rbp), %rsi
jmp 0x4204
movq -0x30(%rbp), %rax
addq (%rax), %r12
leaq -0x108(%rbp), %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x5ebc
movq 0x2c8(%r13), %rax
movq (%rax,%r15,8), %rax
movslq (%rax), %rax
leaq (%rax,%rax,2), %rsi
shlq $0x3, %rsi
movq -0x58(%rbp), %rax
addq (%rax), %rsi
leaq -0xf0(%rbp), %r12
movq %r12, %rdi
callq 0x5ebc
leaq -0x50(%rbp), %rdi
movq %r14, %rdx
movq %r12, %rcx
callq 0x3d9c
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq (%rax,%r15,8), %rdi
movq 0x10(%rax,%r15,8), %rsi
movq -0x50(%rbp), %rcx
movq %rcx, (%rax,%r15,8)
movq -0x48(%rbp), %rcx
movq %rcx, 0x8(%rax,%r15,8)
movq -0x40(%rbp), %rcx
movq %rcx, 0x10(%rax,%r15,8)
testq %rdi, %rdi
je 0x41d6
subq %rdi, %rsi
callq 0x21d0
movq -0xf0(%rbp), %rdi
testq %rdi, %rdi
je 0x41f1
movq -0xe0(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq -0x108(%rbp), %rdi
testq %rdi, %rdi
je 0x423d
movq -0xf8(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
jmp 0x423d
movq -0x30(%rbp), %rcx
movq (%rcx), %rcx
leaq (%rcx,%r15,8), %rdi
negl %eax
movl %eax, -0x50(%rbp)
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x4234
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x423d
leaq -0x50(%rbp), %rdx
callq 0x6596
movq -0x60(%rbp), %rdx
incq %rdx
movq 0x2c8(%r13), %rax
movq 0x2d0(%r13), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rsi, %rcx
cmpq %rdx, %rcx
ja 0x3f23
movq -0x30(%rbp), %rax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x436d
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
jmp 0x436d
jmp 0x4361
movq %rax, %r14
movq -0xa8(%rbp), %rdi
testq %rdi, %rdi
je 0x42cf
movq -0x98(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
jmp 0x42cf
movq %rax, %r14
movq -0xc0(%rbp), %rdi
testq %rdi, %rdi
je 0x4364
movq -0xb0(%rbp), %rsi
jmp 0x4357
jmp 0x4361
movq %rax, %r14
movq -0xf0(%rbp), %rdi
testq %rdi, %rdi
je 0x430d
movq -0xe0(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
jmp 0x430d
movq %rax, %r14
movq -0x108(%rbp), %rdi
testq %rdi, %rdi
je 0x4364
movq -0xf8(%rbp), %rsi
jmp 0x4357
jmp 0x4361
movq %rax, %r14
movq -0xd8(%rbp), %rdi
testq %rdi, %rdi
je 0x4347
movq -0xc8(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
jmp 0x4347
movq %rax, %r14
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0x4364
movq -0x80(%rbp), %rsi
subq %rdi, %rsi
callq 0x21d0
jmp 0x4364
movq %rax, %r14
movq -0x30(%rbp), %rdi
callq 0x2690
movq %r14, %rdi
callq 0x22e0
nop