// File: /workspace/github_cpp_makefile_star2_O3/kiven-li[P]xbytes/xbytes.cpp
// Function: xbytes::xbytes::closure(xbytes::lr_state&)
void xbytes::closure(lr_state& s)
{
	while(true)
	{
		int change_count = 0;
		for(int i = 0; i < s.terms.size(); ++i)
		{
			term* t = s.terms[i];
			if(t->is_completed) continue;
			if(t->dot >= t->r->rights.size()) continue;
			if(t->r->rights[t->dot]->type == ST_TERMINAL) continue;

			symbol* ss = t->r->rights[t->dot];
			for(int j = 0; j < ss->rules.size(); ++j)
			{				
				term tt;
				tt.r = ss->rules[j];
				tt.dot = 0;

				if(t->forwards.size() != 0)
				{
					for(int m = 0; m < t->forwards.size(); ++m)
					{
						for(int n = 0; n < t->forwards[m]->first_set.size(); ++n)
						{
							tt.forwards.push_back(t->forwards[m]->first_set[n]);
							change_count += add_term(s, tt);
							tt.forwards.clear();
						}
					}
				}
				if(t->dot < t->r->rights.size() - 1)
				{
					for(int m = 0; m < t->r->rights[t->dot+1]->first_set.size(); ++m)
					{
						tt.forwards.push_back(t->r->rights[t->dot+1]->first_set[m]);
						change_count += add_term(s, tt);
						tt.forwards.clear();
					}
				}
			}

			if(!change_count) t->is_completed = true;
		}

		if(!change_count) break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq 0x8(%rsi), %rax
movq %rsi, -0x30(%rbp)
movq 0x10(%rsi), %rcx
cmpq %rax, %rcx
je 0x734a
xorl %esi, %esi
xorl %r13d, %r13d
movq (%rax,%rsi,8), %r12
cmpb $0x0, 0x28(%r12)
jne 0x731f
movslq 0x8(%r12), %rax
movq (%r12), %rdx
movq 0x30(%rdx), %rcx
movq 0x38(%rdx), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %rax, %rdx
jbe 0x731f
movq (%rcx,%rax,8), %rdx
cmpl $0x1, 0x48(%rdx)
je 0x731f
movq %rsi, -0x68(%rbp)
movq 0x50(%rdx), %rax
cmpq %rax, 0x58(%rdx)
je 0x730d
xorl %esi, %esi
movq %rdx, -0x70(%rbp)
leaq -0x50(%rbp), %rcx
xorps %xmm0, %xmm0
movups %xmm0, (%rcx)
movq $0x0, 0x10(%rcx)
movq %rsi, -0x78(%rbp)
movq (%rax,%rsi,8), %rax
movq %rax, -0x60(%rbp)
movl $0x0, -0x58(%rbp)
movq 0x10(%r12), %rax
movq 0x18(%r12), %rcx
xorl %edi, %edi
xorl %esi, %esi
cmpq %rax, %rcx
je 0x7230
xorl %r14d, %r14d
movq (%rax,%r14,8), %r8
movq 0x70(%r8), %rdx
cmpq %rdx, 0x78(%r8)
je 0x721a
xorl %r15d, %r15d
xorl %ebx, %ebx
addq %r15, %rdx
cmpq -0x40(%rbp), %rsi
je 0x71c4
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0x8, -0x48(%rbp)
jmp 0x71cd
leaq -0x50(%rbp), %rdi
callq 0xb088
movq -0x30(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0x7534
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
cmpq %rdi, %rsi
je 0x71ee
movq %rdi, -0x48(%rbp)
movq %rdi, %rsi
addl %eax, %r13d
incq %rbx
movq 0x10(%r12), %rax
movq (%rax,%r14,8), %rcx
movq 0x70(%rcx), %rdx
movq 0x78(%rcx), %rcx
subq %rdx, %rcx
sarq $0x3, %rcx
addq $0x8, %r15
cmpq %rbx, %rcx
ja 0x71ae
movq 0x18(%r12), %rcx
incq %r14
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %r14, %rdx
ja 0x719b
movslq 0x8(%r12), %rax
movq (%r12), %rdx
movq 0x30(%rdx), %rcx
movq 0x38(%rdx), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
decq %rdx
cmpq %rax, %rdx
jbe 0x72d9
movq 0x8(%rcx,%rax,8), %rax
movq 0x70(%rax), %rdx
cmpq %rdx, 0x78(%rax)
je 0x72d9
xorl %r14d, %r14d
xorl %r15d, %r15d
addq %r14, %rdx
cmpq -0x40(%rbp), %rsi
je 0x727f
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0x8, -0x48(%rbp)
jmp 0x7288
leaq -0x50(%rbp), %rdi
callq 0xb088
movq -0x30(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0x7534
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
cmpq %rdi, %rsi
je 0x72a9
movq %rdi, -0x48(%rbp)
movq %rdi, %rsi
addl %eax, %r13d
incq %r15
movq (%r12), %rax
movslq 0x8(%r12), %rcx
movq 0x30(%rax), %rax
movq 0x8(%rax,%rcx,8), %rax
movq 0x70(%rax), %rdx
movq 0x78(%rax), %rax
subq %rdx, %rax
sarq $0x3, %rax
addq $0x8, %r14
cmpq %r15, %rax
ja 0x7269
testq %rdi, %rdi
je 0x72ea
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x3260
movq -0x78(%rbp), %rsi
incq %rsi
movq -0x70(%rbp), %rdx
movq 0x50(%rdx), %rax
movq 0x58(%rdx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rsi, %rcx
ja 0x715c
testl %r13d, %r13d
movq -0x68(%rbp), %rsi
jne 0x731f
movb $0x1, 0x28(%r12)
xorl %r13d, %r13d
incq %rsi
movq -0x30(%rbp), %rcx
movq 0x8(%rcx), %rax
movq 0x10(%rcx), %rcx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %rsi, %rdx
ja 0x7105
testl %r13d, %r13d
jne 0x70f7
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x735b
movq %rax, %rbx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x7373
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x3260
movq %rbx, %rdi
callq 0x33d0
nop