// File: /workspace/github_cpp_makefile_star2_O1/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 %rsi, -0x30(%rbp)
movq -0x30(%rbp), %rcx
movq 0x8(%rcx), %rax
cmpq %rax, 0x10(%rcx)
je 0x737a
xorl %edx, %edx
xorl %r13d, %r13d
movq %rdx, -0x68(%rbp)
movq (%rax,%rdx,8), %r12
cmpb $0x0, 0x28(%r12)
jne 0x734e
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 0x734e
movq (%rcx,%rax,8), %rcx
cmpl $0x1, 0x48(%rcx)
je 0x734e
movq 0x50(%rcx), %rax
cmpq %rax, 0x58(%rcx)
je 0x7343
xorl %edx, %edx
movq %rcx, -0x70(%rbp)
leaq -0x50(%rbp), %rcx
xorps %xmm0, %xmm0
movups %xmm0, (%rcx)
movq $0x0, 0x10(%rcx)
movq (%rax,%rdx,8), %rax
movq %rax, -0x60(%rbp)
movl $0x0, -0x58(%rbp)
movq 0x18(%r12), %rax
cmpq 0x10(%r12), %rax
movq %rdx, -0x78(%rbp)
je 0x725a
movq 0x18(%r12), %rax
cmpq 0x10(%r12), %rax
je 0x725a
xorl %r14d, %r14d
movq 0x10(%r12), %rax
movq (%rax,%r14,8), %rax
movq 0x70(%rax), %rdx
cmpq %rdx, 0x78(%rax)
je 0x7240
xorl %r15d, %r15d
xorl %ebx, %ebx
addq %r15, %rdx
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
je 0x71f5
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0x8, -0x48(%rbp)
jmp 0x71fe
leaq -0x50(%rbp), %rdi
callq 0xb024
movq -0x30(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0x759a
movq -0x50(%rbp), %rcx
cmpq %rcx, -0x48(%rbp)
je 0x7219
movq %rcx, -0x48(%rbp)
addl %eax, %r13d
incq %rbx
movq 0x10(%r12), %rax
movq (%rax,%r14,8), %rax
movq 0x70(%rax), %rdx
movq 0x78(%rax), %rax
subq %rdx, %rax
sarq $0x3, %rax
addq $0x8, %r15
cmpq %rbx, %rax
ja 0x71db
incq %r14
movq 0x18(%r12), %rax
subq 0x10(%r12), %rax
sarq $0x3, %rax
cmpq %r14, %rax
ja 0x71c3
movq (%r12), %rax
movq 0x38(%rax), %rcx
subq 0x30(%rax), %rcx
movslq 0x8(%r12), %rax
sarq $0x3, %rcx
decq %rcx
cmpq %rax, %rcx
jbe 0x730b
movq (%r12), %rax
movslq 0x8(%r12), %rcx
movq 0x30(%rax), %rax
movq 0x8(%rax,%rcx,8), %rax
movq 0x70(%rax), %rdx
cmpq %rdx, 0x78(%rax)
je 0x730b
xorl %r14d, %r14d
xorl %r15d, %r15d
addq %r14, %rdx
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
je 0x72b7
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0x8, -0x48(%rbp)
jmp 0x72c0
leaq -0x50(%rbp), %rdi
callq 0xb024
movq -0x30(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0x759a
movq -0x50(%rbp), %rcx
cmpq %rcx, -0x48(%rbp)
je 0x72db
movq %rcx, -0x48(%rbp)
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 0x729d
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x7320
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x3260
movq -0x78(%rbp), %rdx
incq %rdx
movq -0x70(%rbp), %rcx
movq 0x50(%rcx), %rax
movq 0x58(%rcx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rdx, %rcx
ja 0x717b
testl %r13d, %r13d
jne 0x734e
movb $0x1, 0x28(%r12)
movq -0x68(%rbp), %rdx
incq %rdx
movq -0x30(%rbp), %rcx
movq 0x8(%rcx), %rax
movq 0x10(%rcx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rdx, %rcx
ja 0x7124
testl %r13d, %r13d
jne 0x710d
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x738b
movq %rax, %rbx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x73a3
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x3260
movq %rbx, %rdi
callq 0x33d0
nop