// File: /workspace/github_c_makefile_star2_O0/heltilda[P]cicada/userfn.c
// Function: makeLinkList
ccInt makeLinkList(const ccInt left, const ccInt right, const ccInt direction, const ccFloat *sortingList, ccInt *linklist)
{
    ccInt middle, first, toWrite, side, nextSide, idx[2];
    
    if (right > left)  {
        
        middle = floor((right + left)/2);
        idx[0] = makeLinkList(left, middle, direction, sortingList, linklist);
        idx[1] = makeLinkList(middle + 1, right, direction, sortingList, linklist);
        
        if ((sortingList[idx[0]] - sortingList[idx[1]])*direction <= 0)  side = 0;
        else  side = 1;
        
        first = toWrite = idx[side];
        idx[side] = linklist[idx[side]];
        
        while ((idx[0] != -1) && (idx[1] != -1))  {
            
            if ((sortingList[idx[0]] - sortingList[idx[1]])*direction <= 0)  nextSide = 0;
            else  nextSide = 1;
            
            if (side != nextSide)  {
                linklist[toWrite] = idx[nextSide];
                side = nextSide;       }
            
            toWrite = idx[side];
            idx[side] = linklist[idx[side]];    }
        
        linklist[toWrite] = idx[1-side];
        
        return first;    }
        
    else  return left;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movl -0xc(%rbp), %eax
cmpl -0x8(%rbp), %eax
jle 0x20c1f
movl -0xc(%rbp), %eax
addl -0x8(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %edi
callq 0x20c30
cvttsd2si %xmm0, %eax
movl %eax, -0x24(%rbp)
movl -0x8(%rbp), %edi
movl -0x24(%rbp), %esi
movl -0x10(%rbp), %edx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
callq 0x20a80
movl %eax, -0x3c(%rbp)
movl -0x24(%rbp), %edi
addl $0x1, %edi
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
callq 0x20a80
movl %eax, -0x38(%rbp)
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq -0x18(%rbp), %rax
movslq -0x38(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm1
cvtsi2sdl -0x10(%rbp), %xmm0
mulsd %xmm0, %xmm1
xorps %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jb 0x20b2b
movl $0x0, -0x30(%rbp)
jmp 0x20b32
movl $0x1, -0x30(%rbp)
movslq -0x30(%rbp), %rax
movl -0x3c(%rbp,%rax,4), %eax
movl %eax, -0x2c(%rbp)
movl %eax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movslq -0x30(%rbp), %rcx
movslq -0x3c(%rbp,%rcx,4), %rcx
movl (%rax,%rcx,4), %ecx
movslq -0x30(%rbp), %rax
movl %ecx, -0x3c(%rbp,%rax,4)
xorl %eax, %eax
cmpl $-0x1, -0x3c(%rbp)
movb %al, -0x3d(%rbp)
je 0x20b6d
cmpl $-0x1, -0x38(%rbp)
setne %al
movb %al, -0x3d(%rbp)
movb -0x3d(%rbp), %al
testb $0x1, %al
jne 0x20b79
jmp 0x20bfe
movq -0x18(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq -0x18(%rbp), %rax
movslq -0x38(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm1
cvtsi2sdl -0x10(%rbp), %xmm0
mulsd %xmm0, %xmm1
xorps %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jb 0x20bae
movl $0x0, -0x34(%rbp)
jmp 0x20bb5
movl $0x1, -0x34(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x34(%rbp), %eax
je 0x20bd6
movslq -0x34(%rbp), %rax
movl -0x3c(%rbp,%rax,4), %edx
movq -0x20(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x34(%rbp), %eax
movl %eax, -0x30(%rbp)
movslq -0x30(%rbp), %rax
movl -0x3c(%rbp,%rax,4), %eax
movl %eax, -0x2c(%rbp)
movq -0x20(%rbp), %rax
movslq -0x30(%rbp), %rcx
movslq -0x3c(%rbp,%rcx,4), %rcx
movl (%rax,%rcx,4), %ecx
movslq -0x30(%rbp), %rax
movl %ecx, -0x3c(%rbp,%rax,4)
jmp 0x20b58
movl $0x1, %eax
subl -0x30(%rbp), %eax
cltq
movl -0x3c(%rbp,%rax,4), %edx
movq -0x20(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x28(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x20c25
movl -0x8(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop