// File: /workspace/github_c_makefile_star2_O0/MaoKo[P]FGFX/fgfp/src/lr.c
// Function: new_kernel
static kernel_t*
new_kernel(bitset_t* kernel_item, symbol_t* symbol, size_t hash_item) {
	if (!kernel_item)
		{ return (NULL); }

	kernel_t* prev = NULL;
	if (!record_kernel[hash_item])
		{ record_kernel[hash_item] = new_vector(); }
	else {
		int index_ker_lr0 = get_index_vector(record_kernel[hash_item],
								kernel_item, &cmp_kernel_lr0);

		if (index_ker_lr0 != -1) {
			prev = (kernel_t*)AT_VECTOR(record_kernel[hash_item],
												index_ker_lr0);

			int index_ker_lr1 = get_index_vector(record_kernel[hash_item],
									kernel_item, &cmp_kernel_lr1);
	
			if (index_ker_lr1 != -1) {
				del_bitset(kernel_item);
				return ((kernel_t*)AT_VECTOR(record_kernel[hash_item],
										index_ker_lr1));
			}
		}
	}

	kernel_t* new_kernel = NEW(kernel_t, 1);

	if (!new_kernel)
		{ return (NULL); }
	memset(new_kernel, 0, sizeof(kernel_t));

	new_kernel->kernel_item = kernel_item;
	new_kernel->rprefix = symbol;
	
	if (prev) {
		new_kernel->non_lr0_kernel_item = prev->non_lr0_kernel_item;
		new_kernel->ref_lr0 = true;
	}

	PUSH_BACK_VECTOR(record_kernel[hash_item], new_kernel);
	return (new_kernel);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xa8a8
movq $0x0, -0x8(%rbp)
jmp 0xaa14
movq $0x0, -0x28(%rbp)
movq -0x20(%rbp), %rcx
leaq 0x15695(%rip), %rax     # 0x1ff50
cmpq $0x0, (%rax,%rcx,8)
jne 0xa8de
callq 0x1ee0
movq %rax, %rdx
movq -0x20(%rbp), %rcx
leaq 0x1567b(%rip), %rax     # 0x1ff50
movq %rdx, (%rax,%rcx,8)
jmp 0xa97c
movq -0x20(%rbp), %rcx
leaq 0x15667(%rip), %rax     # 0x1ff50
movq (%rax,%rcx,8), %rdi
movq -0x10(%rbp), %rsi
leaq 0x128(%rip), %rdx       # 0xaa20
callq 0x22e0
movl %eax, -0x2c(%rbp)
cmpl $-0x1, -0x2c(%rbp)
je 0xa97a
movq -0x20(%rbp), %rcx
leaq 0x1563f(%rip), %rax     # 0x1ff50
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rcx
leaq 0x15621(%rip), %rax     # 0x1ff50
movq (%rax,%rcx,8), %rdi
movq -0x10(%rbp), %rsi
leaq 0x112(%rip), %rdx       # 0xaa50
callq 0x22e0
movl %eax, -0x30(%rbp)
cmpl $-0x1, -0x30(%rbp)
je 0xa978
movq -0x10(%rbp), %rdi
callq 0x1300
movq -0x20(%rbp), %rcx
leaq 0x155f0(%rip), %rax     # 0x1ff50
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movslq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x8(%rbp)
jmp 0xaa14
jmp 0xa97a
jmp 0xa97c
movl $0x28, %edi
callq 0x38b0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0xa99b
movq $0x0, -0x8(%rbp)
jmp 0xaa14
movq -0x38(%rbp), %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x10b0
movq -0x10(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
cmpq $0x0, -0x28(%rbp)
je 0xa9e1
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x38(%rbp), %rax
movb $0x1, 0x10(%rax)
movq -0x20(%rbp), %rcx
leaq 0x15564(%rip), %rax     # 0x1ff50
movq (%rax,%rcx,8), %rdi
movq -0x20(%rbp), %rcx
leaq 0x15555(%rip), %rax     # 0x1ff50
movq (%rax,%rcx,8), %rax
movq 0x10(%rax), %rsi
movq -0x38(%rbp), %rdx
callq 0x2070
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nop