// File: /workspace/github_c_makefile_star2_O3/ranbenbasat[P]RHHH/ulossycount.c
// Function: LCU_Init
LCU_type * LCU_Init(float fPhi)
{
	int i;
	int k = 1 + (int) 1.0/fPhi;

	LCU_type* result = (LCU_type*) calloc(1,sizeof(LCU_type));

	result->a= (long long) 698124007;
	result->b= (long long) 5125833;
	if (k<1) k=1;
	result->k=k;
	result->n=0;  

	result->tblsz=LCU_HASHMULT*k;  
	result->hashtable=(LCUITEM**) calloc(result->tblsz,sizeof(LCUITEM *));
	result->groups=(LCUGROUP *)calloc(k,sizeof(LCUGROUP));
	result->items=(LCUITEM *) calloc(k,sizeof(LCUITEM));
	result->freegroups=(LCUGROUP **) calloc(k,sizeof(LCUGROUP*));

	for (i=0; i<result->tblsz;i++) 
		result->hashtable[i]=NULL;

	result->root=result->groups;
	result->groups->count=0;
	result->groups->nextg=NULL;
	result->groups->previousg=NULL;

	result->groups->items=result->items;
	for (i=0; i<k;i++)
		result->freegroups[i]=&result->groups[i];
	result->gpt=1; // initialize list of free groups

	for (i=0;i<k;i++) 
	{
		result->items[i].item=LCL_NULLITEM;
		result->items[i].delta=0;
		result->items[i].hash=-1;
		result->items[i].nexti=NULL;
		result->items[i].previousi=NULL;  // initialize values

		result->items[i].parentg=result->groups;
		result->items[i].nexting=&(result->items[i+1]);
		result->items[i].previousing=&(result->items[i-1]); 
		// create doubly linked list
	}
	result->items[0].previousing=&(result->items[k-1]);
	result->items[k-1].nexting=&(result->items[0]);
	// fix start and end of linked list

	return(result);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movss 0x14e4(%rip), %xmm1     # 0x3174
movaps %xmm1, %xmm2
divss %xmm0, %xmm2
addss %xmm1, %xmm2
cvttss2si %xmm2, %ebp
movl $0x1, %edi
movl $0x48, %esi
callq 0x1110
movq %rax, %rbx
movq $0x299c86e7, 0x10(%rax) # imm = 0x299C86E7
cmpl $0x2, %ebp
movl $0x1, %r14d
cmovgel %ebp, %r14d
movq $0x4e36c9, 0x18(%rax)   # imm = 0x4E36C9
movl %r14d, 0x8(%rax)
leal (%r14,%r14,2), %edi
movl %edi, 0xc(%rax)
movl $0x8, %esi
callq 0x1110
movq %rax, 0x40(%rbx)
movl $0x20, %esi
movq %r14, %rdi
callq 0x1110
movq %rax, %r12
movq %rax, 0x30(%rbx)
movl $0x38, %esi
movq %r14, %rdi
callq 0x1110
movq %rax, %r15
movq %rax, 0x28(%rbx)
movl $0x8, %esi
movq %r14, %rdi
callq 0x1110
movq %rax, 0x38(%rbx)
movq %r12, 0x20(%rbx)
movq %r15, 0x8(%r12)
movl %r14d, %ecx
incl %ecx
leaq -0x1(%r14), %rdx
movq %rdx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
andl $-0x2, %ecx
shlq $0x3, %rcx
movdqa 0x1435(%rip), %xmm1     # 0x3180
xorl %edx, %edx
movdqa 0x143b(%rip), %xmm2     # 0x3190
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movdqa 0x143b(%rip), %xmm4     # 0x31a0
movq %r12, %rsi
movdqa %xmm1, %xmm5
pxor %xmm2, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
movd %xmm5, %edi
notl %edi
testb $0x1, %dil
je 0x1d9e
movq %rsi, (%rax,%rdx)
pxor %xmm3, %xmm5
pextrw $0x4, %xmm5, %edi
testb $0x1, %dil
je 0x1db6
leaq 0x20(%rsi), %rdi
movq %rdi, 0x8(%rax,%rdx)
paddq %xmm4, %xmm1
addq $0x10, %rdx
addq $0x40, %rsi
cmpq %rdx, %rcx
jne 0x1d68
movl $0x1, 0x4(%rbx)
leaq 0x38(%r15), %rax
movabsq $-0x80000001, %rcx      # imm = 0xFFFFFFFF7FFFFFFF
movq %r14, %rdx
movq %rcx, -0x38(%rax)
movl $0x0, -0x30(%rax)
movq %r12, -0x28(%rax)
movq %rax, -0x10(%rax)
leaq -0x70(%rax), %rsi
movq %rsi, -0x8(%rax)
addq $0x38, %rax
decq %rdx
jne 0x1ddf
leal -0x1(%r14), %eax
imulq $0x38, %rax, %rax
movq %r15, %rcx
addq %rax, %rcx
movq %rcx, 0x30(%r15)
movq %r15, 0x28(%r15,%rax)
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq