// File: /workspace/github_c_makefile_star2_O3/heltilda[P]cicada/userfn.c
// Function: callSort
ccInt callSort(ccInt argc, char **argv)
{
    ccInt numIndices, cl, ci, idx, *linkList, numLists, firstIndex, rtrn = passed;
    arg_info *argInfo = (arg_info *) argv[argc];
    
    getArgs(argc, argv, &linkList, byValue(&firstIndex), endArgs);
    numIndices = argInfo[0].argIndices;
    numLists = (argc-2)/2;
    
    for (cl = 0; cl < numLists; cl++)  {
        if (argInfo[cl+2].argType != argInfo[cl+2+numLists].argType)  rtrn = 1;
        else if (argInfo[cl+2].argIndices != numIndices)  rtrn = 2;
        else if ((argInfo[cl+2].argType != int_type) && (argInfo[cl+2].argType != double_type))  rtrn = 3;
        if (rtrn != passed)  break;         }
    
    if (rtrn != passed)  {
    for (ci = 0; ci < numIndices; ci++)  {
        linkList[ci]++;        // convert to Cicada indexing
    }}
    
    else  {
    for (cl = 0; cl < numLists; cl++)  {
        idx = firstIndex;
        if (argInfo[cl+2].argType == int_type)  {
            ccInt *list = (ccInt *) (argv[cl+2]), *sortedList = (ccInt *) (argv[cl+2+numLists]);
            for (ci = 0; ci < numIndices; ci++)  {
                sortedList[ci] = list[idx];
                idx = linkList[idx];
        }   }
        else if (argInfo[cl+2].argType == double_type)  {
            ccFloat *list = (ccFloat *) (argv[cl+2]), *sortedList = (ccFloat *) (argv[cl+2+numLists]);
            for (ci = 0; ci < numIndices; ci++)  {
                sortedList[ci] = list[idx];
                idx = linkList[idx];
    }}  }   }
    
    return rtrn;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movl %edi, %r15d
movslq %edi, %rdi
movq (%rsi,%rdi,8), %r12
xorl %ebx, %ebx
leaq 0x8(%rsp), %rdx
leaq 0x4(%rsp), %r8
xorl %ecx, %ecx
xorl %r9d, %r9d
xorl %eax, %eax
pushq $-0x1
pushq $0x0
callq 0x19abb
addq $0x10, %rsp
cmpl $0x4, %r15d
jl 0x19aac
movl 0x4(%r12), %eax
leal -0x2(%r15), %ecx
shrl $0x1f, %ecx
addl %r15d, %ecx
addl $-0x2, %ecx
sarl %ecx
movslq %ecx, %rcx
cmpl $0x2, %ecx
movl $0x1, %ebx
movl $0x1, %esi
cmovgel %ecx, %esi
movl 0x10(%r12), %r8d
movb $0x1, %dl
cmpl 0x10(%r12,%rcx,8), %r8d
jne 0x199f4
leaq (%r12,%rcx,8), %rdi
addq $0x18, %rdi
movl $0x1, %r9d
cmpl %eax, 0xc(%r12,%r9,8)
jne 0x199e4
andl $-0x2, %r8d
cmpl $0x2, %r8d
jne 0x199eb
cmpq %rcx, %r9
setl %dl
cmpq %r9, %rsi
je 0x199f2
movl 0x10(%r12,%r9,8), %r8d
leaq 0x1(%r9), %r10
cmpl -0x8(%rdi,%r9,8), %r8d
movq %r10, %r9
je 0x199b3
jmp 0x199f4
movl $0x2, %ebx
jmp 0x199f4
movl $0x3, %ebx
jmp 0x199f4
xorl %ebx, %ebx
testb $0x1, %dl
je 0x19a18
testl %eax, %eax
jle 0x19aac
movq 0x8(%rsp), %rcx
xorl %edx, %edx
incl (%rcx,%rdx,4)
incq %rdx
cmpq %rdx, %rax
jne 0x19a08
jmp 0x19aac
cmpl $0x4, %r15d
jl 0x19aac
movq 0x8(%rsp), %rdx
cmpl $0x2, %ecx
movl $0x1, %esi
cmovgel %ecx, %esi
leaq (%r14,%rcx,8), %rcx
xorl %edi, %edi
movl 0x4(%rsp), %r8d
movl 0x10(%r12,%rdi,8), %r9d
cmpl $0x3, %r9d
je 0x19a78
cmpl $0x2, %r9d
jne 0x19aa4
testl %eax, %eax
jle 0x19aa4
movq 0x10(%r14,%rdi,8), %r9
movq 0x10(%rcx,%rdi,8), %r10
xorl %r11d, %r11d
movslq %r8d, %r8
movl (%r9,%r8,4), %ebp
movl %ebp, (%r10,%r11,4)
movl (%rdx,%r8,4), %r8d
incq %r11
cmpq %r11, %rax
jne 0x19a5f
jmp 0x19aa4
testl %eax, %eax
jle 0x19aa4
movq 0x10(%r14,%rdi,8), %r9
movq 0x10(%rcx,%rdi,8), %r10
xorl %r11d, %r11d
movslq %r8d, %r8
movsd (%r9,%r8,8), %xmm0
movsd %xmm0, (%r10,%r11,8)
movl (%rdx,%r8,4), %r8d
incq %r11
cmpq %r11, %rax
jne 0x19a89
incq %rdi
cmpq %rsi, %rdi
jne 0x19a38
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq