// File: /workspace/github_c_makefile_star2_O1/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, %rbx
movl %edi, %ebp
movslq %edi, %r15
movq (%rsi,%r15,8), %r12
xorl %r14d, %r14d
leaq 0x8(%rsp), %rdx
leaq 0x4(%rsp), %r8
movl %r15d, %edi
xorl %ecx, %ecx
xorl %r9d, %r9d
xorl %eax, %eax
pushq $-0x1
pushq $0x0
callq 0x19adb
addq $0x10, %rsp
movl 0x4(%r12), %eax
leal -0x2(%r15), %ecx
shrl $0x1f, %ecx
addl %r15d, %ecx
addl $-0x2, %ecx
sarl %ecx
cmpl $0x4, %r15d
jl 0x19a11
movslq %ecx, %rsi
cmpl $0x2, %esi
movl $0x1, %edx
cmovgel %ecx, %edx
leaq (%r12,%rsi,8), %rsi
addq $0x10, %rsi
xorl %edi, %edi
movl 0x10(%r12,%rdi,8), %r8d
cmpl (%rsi,%rdi,8), %r8d
jne 0x199ed
cmpl %eax, 0x14(%r12,%rdi,8)
jne 0x199f8
andl $-0x2, %r8d
xorl %r9d, %r9d
cmpl $0x2, %r8d
sete %r8b
setne %r9b
leal (%r9,%r9,2), %r14d
jmp 0x19a01
xorl %r8d, %r8d
movl $0x1, %r14d
jmp 0x19a01
movl $0x2, %r14d
xorl %r8d, %r8d
testb %r8b, %r8b
je 0x19a11
incq %rdi
cmpq %rdi, %rdx
jne 0x199c2
xorl %r14d, %r14d
testl %r14d, %r14d
je 0x19a35
testl %eax, %eax
jle 0x19acb
movq 0x8(%rsp), %rcx
xorl %edx, %edx
incl (%rcx,%rdx,4)
incq %rdx
cmpq %rdx, %rax
jne 0x19a25
jmp 0x19acb
cmpl $0x4, %ebp
jl 0x19acb
movq 0x8(%rsp), %rdx
movslq %ecx, %rdi
cmpl $0x2, %ecx
movl $0x1, %esi
cmovgel %ecx, %esi
leaq (%rbx,%rdi,8), %rcx
xorl %edi, %edi
movl 0x4(%rsp), %r8d
movl 0x10(%r12,%rdi,8), %r9d
cmpl $0x3, %r9d
je 0x19a97
cmpl $0x2, %r9d
jne 0x19ac3
testl %eax, %eax
jle 0x19ac3
movq 0x10(%rbx,%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 0x19a7e
jmp 0x19ac3
testl %eax, %eax
jle 0x19ac3
movq 0x10(%rbx,%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 0x19aa8
incq %rdi
cmpq %rsi, %rdi
jne 0x19a57
movl %r14d, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq