// File: /workspace/github_c_makefile_star2_O2/MaoKo[P]FGFX/fgfp/src/lr.c
// Function: closure
bitset_t*
closure(cfg_t const* cfg, bitset_t* item_set) {
	if (!cfg || !item_set)
		{ return (NULL_BITSET); }

	vector_t* list_kernel = split_same_derivation(item_set);
	bool is_kernel_disjoint = true;

	size_t size_kernel;
	if ((size_kernel = SIZE_VECTOR(list_kernel))) {
		for (size_t i = 0; i < size_kernel - 1; ++i) {
			kernel_t* crt_kernel = (kernel_t*)AT_VECTOR(list_kernel, i);
			kernel_t* next_kernel = (kernel_t*)AT_VECTOR(list_kernel, i + 1);

			if (!is_disjoint_bitset(crt_kernel->rprefix->first,
								next_kernel->rprefix->first)) {
				is_kernel_disjoint = false;
				break;	
			}
		}

		for (size_t i = 0; i < size_kernel; ++i) {
			kernel_t* crt_kernel = (kernel_t*)AT_VECTOR(list_kernel, i);
			UNION_BITSET(item_set, include_new_item(cfg, crt_kernel));
		}
	}
	
	if (!is_kernel_disjoint)
		{ merge_same_lr0_item(item_set);  }

	del_vector(list_kernel);
	return (item_set);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x685d
movq %rsi, %r13
movq %rdi, %r15
callq 0x22cc
movq %rax, %r14
callq 0x28e4
movq %rax, -0x48(%rbp)
movq %r13, -0x38(%rbp)
movq %r14, -0x30(%rbp)
movq %r13, %rdi
callq 0x26fa
cmpl $-0x1, %eax
je 0x6865
movq 0x16832(%rip), %rcx     # 0x1ceb0
movq (%rcx), %rcx
cltq
movq (%rcx,%rax,8), %rax
movq 0x8(%rax), %rax
cmpb $0x0, 0x10(%rax)
jne 0x6666
movq 0x8(%rax), %rax
movq 0x8(%rax), %rbx
cmpl $0x27, 0x8(%rbx)
jne 0x6666
movq (%rbx), %rcx
movl 0x4(%r14), %eax
cmpq %rax, %rcx
jae 0x66cf
movq 0x8(%r14), %rax
movq %rcx, %rdx
shrq $0x6, %rdx
movq (%rax,%rdx,8), %rsi
pushq $0x1
popq %rdi
shlq %cl, %rdi
btq %rcx, %rsi
jb 0x6666
orq %rdi, %rsi
movq %rsi, (%rax,%rdx,8)
jmp 0x66da
movq %r14, %rdi
movq %rcx, %rsi
callq 0x23b9
movl 0x50(%r13), %r12d
xorl %eax, %eax
cmpb $0x1, 0x54(%r13)
jne 0x66ed
movl 0x4(%r13), %eax
decl %eax
movl %eax, 0x50(%r13)
callq 0x22cc
movq %rax, %r14
movq %r13, %rdi
callq 0x26fa
cmpl $-0x1, %eax
je 0x6755
movq 0x167a3(%rip), %rcx     # 0x1ceb0
movq (%rcx), %rdx
movslq %eax, %rcx
movq (%rdx,%rcx,8), %rax
movq 0x8(%rax), %rax
cmpb $0x0, 0x10(%rax)
jne 0x66f9
movq 0x8(%rax), %rax
cmpq %rbx, 0x8(%rax)
jne 0x66f9
movl 0x4(%r14), %eax
cmpq %rax, %rcx
jae 0x6748
pushq $0x1
popq %rax
shlq %cl, %rax
movq 0x8(%r14), %rdx
shrq $0x6, %rcx
orq %rax, (%rdx,%rcx,8)
jmp 0x66f9
movq %r14, %rdi
movq %rcx, %rsi
callq 0x23b9
jmp 0x66f9
movl %r12d, 0x50(%r13)
movq %r14, %rdi
callq 0x7169
testq %r14, %r14
je 0x683d
movq %rax, %r13
leaq 0x168dc(%rip), %r12     # 0x1d050
movq (%r12,%rax,8), %rdi
testq %rdi, %rdi
je 0x67d8
movq %r14, %rsi
leaq 0x12cd(%rip), %rdx      # 0x7a54
callq 0x2af6
cmpl $-0x1, %eax
je 0x67e1
movq (%r12,%r13,8), %rdi
movq (%rdi), %rcx
cltq
movq (%rcx,%rax,8), %rax
movq %rax, -0x40(%rbp)
movq %r14, %rsi
leaq 0x12b5(%rip), %rdx      # 0x7a61
callq 0x2af6
cmpl $-0x1, %eax
je 0x67e9
movl %eax, %r12d
movq %r14, %rdi
callq 0x2311
leaq 0x16888(%rip), %rax     # 0x1d050
movq (%rax,%r13,8), %rax
movq (%rax), %rax
movslq %r12d, %rcx
movq (%rax,%rcx,8), %r12
jmp 0x6840
callq 0x28e4
movq %rax, (%r12,%r13,8)
movq $0x0, -0x40(%rbp)
pushq $0x28
popq %rdi
callq 0x36ef
testq %rax, %rax
je 0x683d
movq %rax, %r12
andq $0x0, 0x20(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movq %r14, (%rax)
movq %rbx, 0x8(%rax)
movq -0x40(%rbp), %rax
testq %rax, %rax
je 0x6824
movq 0x18(%rax), %rax
movq %rax, 0x18(%r12)
movb $0x1, 0x10(%r12)
leaq 0x16825(%rip), %rax     # 0x1d050
movq (%rax,%r13,8), %rdi
movq 0x10(%rdi), %rsi
movq %r12, %rdx
callq 0x29d6
jmp 0x6840
xorl %r12d, %r12d
movq -0x30(%rbp), %r14
movq -0x48(%rbp), %rdi
movq 0x10(%rdi), %rsi
movq %r12, %rdx
callq 0x29d6
movq -0x38(%rbp), %r13
jmp 0x6666
xorl %r13d, %r13d
jmp 0x6d10
xorl %eax, %eax
cmpb $0x1, 0x54(%r13)
jne 0x6874
movl 0x4(%r13), %eax
decl %eax
movl %eax, 0x50(%r13)
movq %r14, %rdi
callq 0x2311
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rax
testq %rax, %rax
je 0x6d07
movq %rax, -0x50(%rbp)
decq %rax
movq %rax, -0x58(%rbp)
xorl %ebx, %ebx
movq %rbx, %r14
cmpq %rbx, -0x58(%rbp)
je 0x68d4
movq -0x48(%rbp), %rax
movq (%rax), %rax
leaq 0x1(%r14), %rbx
movq (%rax,%r14,8), %rcx
movq 0x8(%rax,%r14,8), %rax
movq 0x8(%rcx), %rcx
movq 0x20(%rcx), %rdi
movq 0x8(%rax), %rax
movq 0x20(%rax), %rsi
callq 0x2800
testb %al, %al
jne 0x689e
xorl %ecx, %ecx
movq -0x50(%rbp), %rbx
movq %r14, -0x68(%rbp)
movq %r15, -0x78(%rbp)
cmpq %rbx, %rcx
je 0x6bf7
movq -0x48(%rbp), %rax
movq (%rax), %rax
movq (%rax,%rcx,8), %rax
movq 0x20(%rax), %rdx
testq %rdx, %rdx
movq %rcx, %r12
jne 0x6be2
movq %r12, -0x60(%rbp)
cmpq $0x0, 0x18(%rax)
movq %rax, %r12
movq %rax, -0x30(%rbp)
jne 0x6a0b
callq 0x22cc
movq %rax, %r14
movq 0x8(%r12), %rax
movq 0x30(%rax), %rdx
xorl %ebx, %ebx
xorl %edi, %edi
movq %r14, %rsi
callq 0x25dd
movq %r14, %rdi
callq 0x26fa
cmpl $-0x1, %eax
setne %r12b
je 0x6994
movq (%r15), %rcx
movq (%rcx), %rcx
cltq
movq (%rcx,%rax,8), %r13
movq 0x10(%r13), %rax
testq %rax, %rax
je 0x6939
movq 0x8(%rax), %rax
cmpl $0x27, 0x8(%rax)
jne 0x6939
movq 0x30(%rax), %rsi
movq %r14, %rdi
callq 0x278f
testb %al, %al
jne 0x6939
movq 0x10(%r13), %rax
movq 0x8(%rax), %rax
movq 0x30(%rax), %rdx
xorl %edi, %edi
movq %r14, %rsi
callq 0x25dd
movl %r12d, %ebx
jmp 0x6939
testq %r14, %r14
je 0x69ac
xorl %eax, %eax
cmpb $0x1, 0x54(%r14)
jne 0x69a8
movl 0x4(%r14), %eax
decl %eax
movl %eax, 0x50(%r14)
testb $0x1, %bl
movl %r12d, %ebx
jne 0x6939
callq 0x28e4
movq -0x30(%rbp), %rcx
movq %rax, 0x18(%rcx)
movq %r14, %rdi
callq 0x26fa
cmpl $-0x1, %eax
je 0x69ff
movq (%r15), %rcx
movq (%rcx), %rcx
cltq
movq (%rcx,%rax,8), %rdi
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rbx
movq 0x10(%rbx), %r12
movq 0x10(%rdi), %rsi
callq 0x7924
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x29d6
jmp 0x69c1
movq %r14, %rdi
callq 0x2311
movq -0x30(%rbp), %r12
callq 0x28e4
movq %rax, %rdi
movq 0x18(%r12), %rax
movq 0x10(%rax), %rsi
movq %rdi, -0x40(%rbp)
leaq -0x475b(%rip), %rdx     # 0x22cc
callq 0x2b91
callq 0x22cc
movq %rax, %r14
movq (%r12), %rdi
callq 0x26fa
cmpl $-0x1, %eax
je 0x6a79
movq 0x16467(%rip), %rcx     # 0x1ceb0
movq (%rcx), %rcx
cltq
movq (%rcx,%rax,8), %rax
movq 0x8(%rax), %rdi
movq 0x10(%rax), %rsi
callq 0x7a6e
movq %rax, %rbx
xorl %edi, %edi
movq %r14, %rsi
movq %rax, %rdx
callq 0x25dd
movq %rbx, %rdi
callq 0x2311
jmp 0x6a34
movq (%r12), %rax
testq %rax, %rax
je 0x6a92
xorl %ecx, %ecx
cmpb $0x1, 0x54(%rax)
jne 0x6a8f
movl 0x4(%rax), %ecx
decl %ecx
movl %ecx, 0x50(%rax)
movq 0x8(%r12), %rdx
movq %r12, %rdi
movq -0x40(%rbp), %rsi
movq %r14, -0x70(%rbp)
movq %r14, %rcx
callq 0x7acf
xorl %r14d, %r14d
xorl %r13d, %r13d
movq 0x18(%r12), %rax
cmpq 0x10(%rax), %r14
jae 0x6b18
movq (%rax), %rax
movq (%rax,%r14,8), %rdi
cmpb $0x0, 0x10(%rdi)
jne 0x6b13
movq 0x8(%rdi), %rax
movq 0x8(%rax), %rbx
cmpl $0x27, 0x8(%rbx)
jne 0x6b13
movq -0x40(%rbp), %r15
movq (%r15), %rax
movq (%rax,%r14,8), %rsi
callq 0x7a6e
movq %rax, %r12
movq -0x30(%rbp), %rdi
movq %r15, %rsi
movq -0x78(%rbp), %r15
movq %rbx, %rdx
movq %rax, %rcx
callq 0x7acf
movl %eax, %ebx
orb %r13b, %bl
movq %r12, %rdi
movq -0x30(%rbp), %r12
callq 0x2311
movl %ebx, %r13d
incq %r14
jmp 0x6ab0
xorl %r14d, %r14d
testb $0x1, %r13b
movl $0x0, %r13d
jne 0x6ab0
movq -0x70(%rbp), %rdi
callq 0x2311
callq 0x22cc
movq %rax, 0x20(%r12)
movq (%r12), %rdx
xorl %edi, %edi
movq %rax, %rsi
callq 0x25dd
xorl %ebx, %ebx
movq -0x38(%rbp), %r13
movq -0x68(%rbp), %r14
movq 0x18(%r12), %rax
cmpq 0x10(%rax), %rbx
jae 0x6bb6
movq -0x40(%rbp), %rcx
movq (%rcx), %rcx
movq (%rcx,%rbx,8), %rsi
movq (%rax), %rax
movq (%rax,%rbx,8), %rdi
callq 0x79eb
testq %rax, %rax
je 0x6bd8
movq %rax, %rdi
callq 0x63d5
cmpl $-0x1, %eax
je 0x6bb1
movslq %eax, %rsi
movq 0x20(%r12), %rdi
movl 0x4(%rdi), %ecx
cmpq %rcx, %rsi
jae 0x6bac
pushq $0x1
popq %rdx
movl %eax, %ecx
shlq %cl, %rdx
movq 0x8(%rdi), %rax
shrq $0x6, %rsi
orq %rdx, (%rax,%rsi,8)
jmp 0x6bb1
callq 0x23b9
incq %rbx
jmp 0x6b52
movq -0x40(%rbp), %rbx
movq %rbx, %rdi
leaq -0x48b3(%rip), %rsi     # 0x2311
callq 0x2b58
movq %rbx, %rdi
callq 0x2986
movq 0x20(%r12), %rdx
jmp 0x6bda
xorl %edx, %edx
movq -0x50(%rbp), %rbx
movq -0x60(%rbp), %r12
xorl %edi, %edi
movq %r13, %rsi
callq 0x25dd
incq %r12
movq %r12, %rcx
jmp 0x68e2
cmpq -0x58(%rbp), %r14
jae 0x6d07
pushq $-0x2
popq %rbx
movq %r13, %rdi
callq 0x26fa
cmpl $-0x1, %eax
je 0x6cf4
movq 0x16294(%rip), %rcx     # 0x1ceb0
movq (%rcx), %rcx
movslq %eax, %r14
movq (%rcx,%r14,8), %r12
movl 0x50(%r13), %r13d
movq -0x38(%rbp), %rdi
callq 0x26fa
cmpl $-0x1, %eax
je 0x6ce4
movq 0x1626d(%rip), %rcx     # 0x1ceb0
movq (%rcx), %rcx
movslq %eax, %r15
movq (%rcx,%r15,8), %rsi
movq 0x8(%r12), %rax
movq 0x8(%rsi), %rcx
movq (%rax), %rdx
cmpq (%rcx), %rdx
jne 0x6c2a
movq 0x8(%rax), %rax
cmpq 0x8(%rcx), %rax
jne 0x6c2a
movq %r12, %rdi
callq 0x6586
movq -0x38(%rbp), %rcx
movl 0x4(%rcx), %edx
cmpq %rdx, %r14
jae 0x6c95
movq %rbx, %rsi
movl %r14d, %ecx
rolq %cl, %rsi
movq -0x38(%rbp), %rcx
movq 0x8(%rcx), %rcx
shrq $0x6, %r14
andq %rsi, (%rcx,%r14,8)
cmpq %rdx, %r15
jae 0x6cb3
movq %rbx, %rsi
movl %r15d, %ecx
rolq %cl, %rsi
movq -0x38(%rbp), %rcx
movq 0x8(%rcx), %rcx
shrq $0x6, %r15
andq %rsi, (%rcx,%r15,8)
cmpl $-0x1, %eax
je 0x6ce4
movslq %eax, %rcx
cmpq %rdx, %rcx
jae 0x6cd8
pushq $0x1
popq %rax
shlq %cl, %rax
movq -0x38(%rbp), %rdx
movq 0x8(%rdx), %rdx
shrq $0x6, %rcx
orq %rax, (%rdx,%rcx,8)
jmp 0x6ce4
movq -0x38(%rbp), %rdi
movq %rcx, %rsi
callq 0x23b9
movq -0x38(%rbp), %rax
movl %r13d, 0x50(%rax)
movq %rax, %r13
jmp 0x6c04
xorl %eax, %eax
cmpb $0x1, 0x54(%r13)
jne 0x6d03
movl 0x4(%r13), %eax
decl %eax
movl %eax, 0x50(%r13)
movq -0x48(%rbp), %rdi
callq 0x2986
movq %r13, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq