// File: /workspace/github_c_makefile_star2_O3/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
movq %rdi, -0x78(%rbp)
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x7135
movq %rsi, %r13
callq 0x243c
movq %rax, %r15
callq 0x2aec
movq %rax, %r14
movq %r13, %rdi
callq 0x28dc
cmpl $-0x1, %eax
movq %r13, -0x68(%rbp)
movq %r14, -0x38(%rbp)
je 0x6cc3
movq %r15, -0x30(%rbp)
movq 0x163d4(%rip), %rcx     # 0x1cea0
movq (%rcx), %rcx
cltq
movq (%rcx,%rax,8), %rax
movq 0x8(%rax), %rax
cmpb $0x0, 0x10(%rax)
jne 0x6cb2
movq 0x8(%rax), %rax
movq 0x8(%rax), %rbx
cmpl $0x27, 0x8(%rbx)
jne 0x6cb2
movq (%rbx), %rcx
movl 0x4(%r15), %eax
cmpq %rax, %rcx
jae 0x6b2b
movq 0x8(%r15), %rax
movq %rcx, %rdx
shrq $0x6, %rdx
movq (%rax,%rdx,8), %rsi
movl $0x1, %edi
shlq %cl, %rdi
btq %rcx, %rsi
jb 0x6cb2
orq %rdi, %rsi
movq %rsi, (%rax,%rdx,8)
jmp 0x6b36
movq %r15, %rdi
movq %rcx, %rsi
callq 0x2570
movl 0x50(%r13), %r12d
xorl %eax, %eax
cmpb $0x1, 0x54(%r13)
jne 0x6b49
movl 0x4(%r13), %eax
decl %eax
movl %eax, 0x50(%r13)
callq 0x243c
movq %rax, %r14
movq %r13, %rdi
callq 0x28dc
cmpl $-0x1, %eax
je 0x6bb3
movq 0x16337(%rip), %rcx     # 0x1cea0
movq (%rcx), %rdx
movslq %eax, %rcx
movq (%rdx,%rcx,8), %rax
movq 0x8(%rax), %rax
cmpb $0x0, 0x10(%rax)
jne 0x6b55
movq 0x8(%rax), %rax
cmpq %rbx, 0x8(%rax)
jne 0x6b55
movl 0x4(%r14), %eax
cmpq %rax, %rcx
jae 0x6ba6
movl $0x1, %eax
shlq %cl, %rax
movq 0x8(%r14), %rdx
shrq $0x6, %rcx
orq %rax, (%rdx,%rcx,8)
jmp 0x6b55
movq %r14, %rdi
movq %rcx, %rsi
callq 0x2570
jmp 0x6b55
movl %r12d, 0x50(%r13)
movq %r14, %rdi
callq 0x75de
testq %r14, %r14
je 0x6c2e
movq %rax, %r13
leaq 0x16472(%rip), %r15     # 0x1d040
movq (%r15,%rax,8), %rdi
testq %rdi, %rdi
je 0x6c33
movq %r14, %rsi
leaq 0x137e(%rip), %rdx      # 0x7f5f
callq 0x2d05
cmpl $-0x1, %eax
je 0x6c3c
movq (%r15,%r13,8), %rdi
movq (%rdi), %rcx
cltq
movq (%rcx,%rax,8), %r15
movq %r14, %rsi
leaq 0x136a(%rip), %rdx      # 0x7f6c
callq 0x2d05
cmpl $-0x1, %eax
je 0x6c3f
movl %eax, %r12d
movq %r14, %rdi
callq 0x2486
leaq 0x16422(%rip), %rax     # 0x1d040
movq (%rax,%r13,8), %rax
movq (%rax), %rax
movslq %r12d, %rcx
movq (%rax,%rcx,8), %r12
jmp 0x6c97
xorl %r12d, %r12d
jmp 0x6c9b
callq 0x2aec
movq %rax, (%r15,%r13,8)
xorl %r15d, %r15d
movl $0x28, %edi
callq 0x3a0e
testq %rax, %rax
je 0x6c94
movq %rax, %r12
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movq $0x0, 0x20(%rax)
movq %r14, (%rax)
movq %rbx, 0x8(%rax)
testq %r15, %r15
je 0x6c7b
movq 0x18(%r15), %rax
movq %rax, 0x18(%r12)
movb $0x1, 0x10(%r12)
leaq 0x163be(%rip), %rax     # 0x1d040
movq (%rax,%r13,8), %rdi
movq 0x10(%rdi), %rsi
movq %r12, %rdx
callq 0x2be1
jmp 0x6c97
xorl %r12d, %r12d
movq -0x30(%rbp), %r15
movq -0x38(%rbp), %r14
movq 0x10(%r14), %rsi
movq %r14, %rdi
movq %r12, %rdx
callq 0x2be1
movq -0x68(%rbp), %r13
movq %r13, %rdi
callq 0x28dc
cmpl $-0x1, %eax
jne 0x6ac5
xorl %eax, %eax
cmpb $0x1, 0x54(%r13)
jne 0x6cd2
movl 0x4(%r13), %eax
decl %eax
movl %eax, 0x50(%r13)
movq %r15, %rdi
callq 0x2486
movq 0x10(%r14), %rax
testq %rax, %rax
je 0x7151
movq %rax, -0x48(%rbp)
decq %rax
movq %rax, -0x60(%rbp)
xorl %ebx, %ebx
movq %rbx, %r15
cmpq %rbx, -0x60(%rbp)
je 0x6d2a
movq (%r14), %rax
leaq 0x1(%r15), %rbx
movq (%rax,%r15,8), %rcx
movq 0x8(%rax,%r15,8), %rax
movq 0x8(%rcx), %rcx
movq 0x20(%rcx), %rdi
movq 0x8(%rax), %rax
movq 0x20(%rax), %rsi
callq 0x29f0
testb %al, %al
jne 0x6cf8
xorl %r12d, %r12d
movq -0x48(%rbp), %rbx
movq %r15, -0x58(%rbp)
movq (%r14), %rax
movq (%rax,%r12,8), %rax
movq 0x20(%rax), %rdx
testq %rdx, %rdx
jne 0x7033
movq %r12, -0x70(%rbp)
cmpq $0x0, 0x18(%rax)
movq -0x78(%rbp), %r13
movq %rax, %r15
movq %rax, -0x50(%rbp)
jne 0x6e4f
callq 0x243c
movq %rax, %r14
movq 0x8(%r15), %rax
movq 0x30(%rax), %rdx
xorl %edi, %edi
movq %r14, %rsi
callq 0x27b4
movq %r14, %rdi
callq 0x28dc
xorl %ebx, %ebx
cmpl $-0x1, %eax
je 0x6dde
movq (%r13), %rcx
movq (%rcx), %rcx
cltq
movq (%rcx,%rax,8), %r15
movq 0x10(%r15), %rax
testq %rax, %rax
je 0x6dd4
movq 0x8(%rax), %rax
cmpl $0x27, 0x8(%rax)
jne 0x6dd4
movq 0x30(%rax), %rsi
movq %r14, %rdi
callq 0x2979
testb %al, %al
jne 0x6dd4
movq 0x10(%r15), %rax
movq 0x8(%rax), %rax
movq 0x30(%rax), %rdx
xorl %edi, %edi
movq %r14, %rsi
callq 0x27b4
movb $0x1, %bl
movq %r14, %rdi
callq 0x28dc
jmp 0x6d87
testq %r14, %r14
movq -0x50(%rbp), %r15
je 0x6dfa
xorl %eax, %eax
cmpb $0x1, 0x54(%r14)
jne 0x6df6
movl 0x4(%r14), %eax
decl %eax
movl %eax, 0x50(%r14)
testb $0x1, %bl
jne 0x6d7d
callq 0x2aec
movq %rax, 0x18(%r15)
movq %r14, %rdi
callq 0x28dc
cmpl $-0x1, %eax
je 0x6e47
movq (%r13), %rcx
movq (%rcx), %rcx
cltq
movq (%rcx,%rax,8), %rdi
movq 0x18(%r15), %rbx
movq 0x10(%rbx), %r12
movq 0x10(%rdi), %rsi
callq 0x7e15
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x2be1
jmp 0x6e0c
movq %r14, %rdi
callq 0x2486
callq 0x2aec
movq %rax, %rdi
movq 0x18(%r15), %rax
movq 0x10(%rax), %rsi
movq %rdi, -0x40(%rbp)
leaq -0x4a2e(%rip), %rdx     # 0x243c
callq 0x2db3
callq 0x243c
movq %rax, %r14
movq (%r15), %rdi
callq 0x28dc
cmpl $-0x1, %eax
je 0x6ebb
movq 0x16015(%rip), %rcx     # 0x1cea0
movq (%rcx), %rcx
cltq
movq (%rcx,%rax,8), %rax
movq 0x8(%rax), %rdi
movq 0x10(%rax), %rsi
callq 0x7f7f
movq %rax, %rbx
xorl %edi, %edi
movq %r14, %rsi
movq %rax, %rdx
callq 0x27b4
movq %rbx, %rdi
callq 0x2486
jmp 0x6e77
movq (%r15), %rax
testq %rax, %rax
je 0x6ed3
xorl %ecx, %ecx
cmpb $0x1, 0x54(%rax)
jne 0x6ed0
movl 0x4(%rax), %ecx
decl %ecx
movl %ecx, 0x50(%rax)
movq 0x8(%r15), %rdx
movq %r15, %rdi
movq -0x40(%rbp), %rsi
movq %r14, -0x80(%rbp)
movq %r14, %rcx
callq 0x7fe0
movq 0x18(%r15), %rax
movq 0x10(%rax), %rcx
testq %rcx, %rcx
je 0x6f6a
xorl %r15d, %r15d
xorl %r13d, %r13d
movq (%rax), %rcx
movq (%rcx,%r13,8), %rdi
cmpb $0x0, 0x10(%rdi)
jne 0x6f58
movq 0x8(%rdi), %rcx
movq 0x8(%rcx), %rbx
cmpl $0x27, 0x8(%rbx)
jne 0x6f58
movq %r15, -0x30(%rbp)
movq -0x40(%rbp), %r15
movq (%r15), %rax
movq (%rax,%r13,8), %rsi
callq 0x7f7f
movq %rax, %r14
movq -0x50(%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
movq -0x30(%rbp), %r15
movq %rbx, %rdx
movq %rax, %rcx
callq 0x7fe0
orb %al, %r15b
movq %r14, %rdi
callq 0x2486
movq 0x18(%r12), %rax
incq %r13
movq 0x10(%rax), %rcx
cmpq %rcx, %r13
jb 0x6efd
testb $0x1, %r15b
jne 0x6ef2
movq -0x80(%rbp), %rdi
callq 0x2486
callq 0x243c
movq -0x50(%rbp), %r14
movq %rax, 0x20(%r14)
movq (%r14), %rdx
xorl %edi, %edi
movq %rax, %rsi
callq 0x27b4
movq 0x18(%r14), %rax
cmpq $0x0, 0x10(%rax)
movq -0x68(%rbp), %r13
je 0x7000
xorl %ebx, %ebx
movq -0x40(%rbp), %rcx
movq (%rcx), %rcx
movq (%rcx,%rbx,8), %rsi
movq (%rax), %rax
movq (%rax,%rbx,8), %rdi
callq 0x7ef1
testq %rax, %rax
je 0x7021
movq %rax, %rdi
callq 0x681b
cmpl $-0x1, %eax
je 0x6ff3
movslq %eax, %rsi
movq 0x20(%r14), %rdi
movl 0x4(%rdi), %ecx
cmpq %rcx, %rsi
jae 0x6fee
movl $0x1, %edx
movl %eax, %ecx
shlq %cl, %rdx
movq 0x8(%rdi), %rax
shrq $0x6, %rsi
orq %rdx, (%rax,%rsi,8)
jmp 0x6ff3
callq 0x2570
incq %rbx
movq 0x18(%r14), %rax
cmpq 0x10(%rax), %rbx
jb 0x6f9e
movq -0x40(%rbp), %rbx
movq %rbx, %rdi
leaq -0x4b88(%rip), %rsi     # 0x2486
callq 0x2d75
movq %rbx, %rdi
callq 0x2b8e
movq 0x20(%r14), %rdx
jmp 0x7023
xorl %edx, %edx
movq -0x38(%rbp), %r14
movq -0x48(%rbp), %rbx
movq -0x58(%rbp), %r15
movq -0x70(%rbp), %r12
xorl %edi, %edi
movq %r13, %rsi
callq 0x27b4
incq %r12
cmpq %rbx, %r12
jne 0x6d35
cmpq -0x60(%rbp), %r15
jae 0x7151
movq %r13, %rdi
callq 0x28dc
cmpl $-0x1, %eax
je 0x713a
movq 0x15e35(%rip), %rcx     # 0x1cea0
movq (%rcx), %rcx
movslq %eax, %r14
movq (%rcx,%r14,8), %r12
movl 0x50(%r13), %ebx
movq %r13, %rdi
callq 0x28dc
cmpl $-0x1, %eax
je 0x712c
movq 0x15e0f(%rip), %rcx     # 0x1cea0
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 0x7079
movq 0x8(%rax), %rax
cmpq 0x8(%rcx), %rax
jne 0x7079
movq %r12, %rdi
callq 0x69ce
movl 0x4(%r13), %edx
cmpq %rdx, %r14
jae 0x70e0
movq $-0x2, %rsi
movl %r14d, %ecx
rolq %cl, %rsi
movq 0x8(%r13), %rcx
shrq $0x6, %r14
andq %rsi, (%rcx,%r14,8)
cmpq %rdx, %r15
jae 0x70fe
movq $-0x2, %rsi
movl %r15d, %ecx
rolq %cl, %rsi
movq 0x8(%r13), %rcx
shrq $0x6, %r15
andq %rsi, (%rcx,%r15,8)
cmpl $-0x1, %eax
je 0x712c
movslq %eax, %rcx
cmpq %rdx, %rcx
jae 0x7121
movl $0x1, %eax
shlq %cl, %rax
movq 0x8(%r13), %rdx
shrq $0x6, %rcx
orq %rax, (%rdx,%rcx,8)
jmp 0x712c
movq %r13, %rdi
movq %rcx, %rsi
callq 0x2570
movl %ebx, 0x50(%r13)
jmp 0x7053
xorl %r13d, %r13d
jmp 0x7159
xorl %eax, %eax
cmpb $0x1, 0x54(%r13)
jne 0x7149
movl 0x4(%r13), %eax
decl %eax
movl %eax, 0x50(%r13)
movq -0x38(%rbp), %r14
movq %r14, %rdi
callq 0x2b8e
movq %r13, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq