// File: /workspace/github_c_makefile_star2_O2/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 $0x20, %rsp
movq %rsi, %r14
movslq %edi, %r15
movq (%rsi,%r15,8), %r12
orl $-0x1, 0x8(%rsp)
andq $0x0, (%rsp)
xorl %ebx, %ebx
leaq 0x10(%rsp), %rdx
leaq 0x1c(%rsp), %r8
movl %r15d, %edi
xorl %ecx, %ecx
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x17892
movl 0x4(%r12), %ecx
addl $-0x2, %r15d
pushq $0x2
popq %rdi
movl %r15d, %eax
cltd
idivl %edi
movslq %eax, %rsi
testl %esi, %esi
movl $0x0, %eax
cmovgl %esi, %eax
leaq (%r12,%rsi,8), %r9
addq $0x10, %r9
pushq $0x1
popq %r8
pushq $0x3
popq %r10
xorl %r15d, %r15d
movq %r15, %rdx
cmpq %r15, %rax
je 0x177dd
movl 0x10(%r12,%rdx,8), %r11d
cmpl (%r9,%rdx,8), %r11d
jne 0x177d6
cmpl %ecx, 0x14(%r12,%rdx,8)
jne 0x177db
andl $-0x2, %r11d
leaq 0x1(%rdx), %r15
cmpl $0x2, %r11d
je 0x177a9
movl %r10d, %ebx
jmp 0x177dd
movl %r8d, %ebx
jmp 0x177dd
movl %edi, %ebx
cmpq %rsi, %rdx
jge 0x177ff
movq 0x10(%rsp), %rax
xorl %edx, %edx
testl %ecx, %ecx
cmovlel %edx, %ecx
cmpq %rdx, %rcx
je 0x17883
incl (%rax,%rdx,4)
incq %rdx
jmp 0x177ee
xorl %edx, %edx
testl %ecx, %ecx
cmovlel %edx, %ecx
leaq (%r14,%rsi,8), %rsi
cmpq %rax, %rdx
je 0x17883
movl 0x1c(%rsp), %edi
movl 0x10(%r12,%rdx,8), %r8d
cmpl $0x3, %r8d
je 0x1784f
cmpl $0x2, %r8d
jne 0x1787e
movq 0x10(%r14,%rdx,8), %r8
movq 0x10(%rsi,%rdx,8), %r9
movq 0x10(%rsp), %r10
xorl %r11d, %r11d
cmpq %r11, %rcx
je 0x1787e
movslq %edi, %rdi
movl (%r8,%rdi,4), %ebp
movl %ebp, (%r9,%r11,4)
movl (%r10,%rdi,4), %edi
incq %r11
jmp 0x17836
movq 0x10(%r14,%rdx,8), %r8
movq 0x10(%rsi,%rdx,8), %r9
movq 0x10(%rsp), %r10
xorl %r11d, %r11d
cmpq %r11, %rcx
je 0x1787e
movslq %edi, %rdi
movsd (%r8,%rdi,8), %xmm0
movsd %xmm0, (%r9,%r11,8)
movl (%r10,%rdi,4), %edi
incq %r11
jmp 0x17861
incq %rdx
jmp 0x1780a
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq