// File: /workspace/github_c_makefile_star2_O1/heltilda[P]cicada/ciclib.c
// Function: cclib_transform
void cclib_transform()
{
    linkedlist *inputStringLL, *tempString;
    member *loopMember;
    window *compiledCodeWindow = NULL, *pathWindow = NULL, *inputStringWindow, *drawPathTo;
    variable *pathVariable = NULL;
    searchPath *newCodePath, *newCodePathStem = pcSearchPath;
    ccInt pathVarMemberCounter, firstPathVarMember = 0, counter, loopArg, loopCodeWord, rtrn;
    ccInt codeIndex, numArgs, dummy, memberOffset, fileNameLength = 0, sourceCodeLength = 0, opCharNumLength = 0;
    ccInt *holdPCCodePtr, *codeEntryPtr, *holdStartCodePtr, *holdEndCodePtr, *opCharNum = NULL, theOpChar;
    char *fileName = NULL, *sourceCode = NULL;
    char **lastArgs[3] = { &fileName, &sourceCode, (char **) &opCharNum };
    ccInt *lastArgLengths[3] = { &fileNameLength, &sourceCodeLength, &opCharNumLength };
    code_ref holdPCCodeRef;
    
    numArgs = numBIF_args();
    if ((numArgs < 1) || (numArgs > 6))  {  setError(wrong_argument_count_err, pcCodePtr-1);  return;  }
    
    
        // check & defragment the bytecode string
    
    inputStringWindow = getBIFstringArg(1);
    if (errCode != passed)  return;
    if (inputStringWindow->width == 0)  {  intRegister = passed;  return;  }
    
    inputStringLL = &(inputStringWindow->variable_ptr->mem.data);
    rtrn = defragmentLinkedList(inputStringLL);
    if (rtrn != passed)  {  setError(out_of_memory_err, pcCodePtr-1);  return;  }
    if (inputStringWindow->width % sizeof(ccInt) != 0)  {  setError(library_argument_err, pcCodePtr-1);  return;  }
    
    
        // get the destination function (argument 2)
    
    if (numArgs >= 2)  {
        compiledCodeWindow = getBIFmember(2);
        if (compiledCodeWindow != NULL)  {
            if (compiledCodeWindow->variable_ptr->type != composite_type)  {  setError(not_a_function_err, pcCodePtr-1);  return;  }
            if (compiledCodeWindow->width != 1)  {  setError(multiple_indices_not_allowed_err, pcCodePtr-1);  return;  }
    }   }
    
    
        // if a code path was provided, read that too
    
    if (numArgs >= 3)  {
        pathWindow = getBIFmember(3);
        if (pathWindow != NULL)    {
            pathVariable = pathWindow->variable_ptr;
            
            if (pathWindow->variable_ptr->type < composite_type)  {  setError(not_composite_err, pcCodePtr-1);  return;  }
            if (pathWindow->width != 1)  {  setError(multiple_indices_not_allowed_err, pcCodePtr-1);  return;  }
            
            newCodePathStem = NULL;
            pathVarMemberCounter = 0;
            while (1 == 1)  {
                pathVarMemberCounter++;
                rtrn = findMemberIndex(pathVariable, 0, pathVarMemberCounter, &loopMember, &dummy, &memberOffset, ccFalse);
                if (rtrn == invalid_index_err)  break;
                if (!loopMember->ifHidden)  {
                    if (loopMember->memberWindow != NULL)  {
                        firstPathVarMember = pathVarMemberCounter;
                        break;
    }   }   }   }   }
    
    
        // the last three optional arguments help to flag transform/runtime errors in the code
    
    for (loopArg = 4; loopArg <= numArgs; loopArg++)  {
    if (getBIFmember(loopArg) != NULL)  {
        window *tempStringWindow = getBIFstringArg(loopArg);
        if (errCode != passed)  return;
        
        tempString = &(tempStringWindow->variable_ptr->mem.data);
        rtrn = defragmentLinkedList(tempString);
        if (rtrn != passed)  {  setError(rtrn, pcCodePtr-1);  return;  }
        
        *lastArgLengths[loopArg-4] = tempStringWindow->width;
        if (tempStringWindow->width == 0)  {
            *lastArgs[loopArg-4] = (char *) element(tempString, 0);     }
        else  {
            *lastArgs[loopArg-4] = (char *) element(tempString, tempStringWindow->offset+1);
    }}  }
    
    if (opCharNum != NULL)  {
        if (sourceCode == NULL)  {  setError(void_member_err, pcCodePtr-1);  return;  }
        if (inputStringWindow->width != opCharNumLength)  {  setError(out_of_range_err, pcCodePtr-1);  return;  }
        for (loopCodeWord = 0; loopCodeWord < opCharNumLength/sizeof(ccInt); loopCodeWord++)  {
        if ((opCharNum[loopCodeWord] < 1) || (opCharNum[loopCodeWord] > sourceCodeLength))  {
        if (sourceCodeLength > 0)  {            // even a blank script has an end-of-file token --> char #1 
            setError(out_of_range_err, pcCodePtr-1);
            return;
    }   }}}
    
    else if (sourceCode != NULL)  {  setError(void_member_err, pcCodePtr-1);  return;  }
    
    
        // store some important variables since we need to overwrite these temporarily while checking the bytecode
    
    holdPCCodePtr = pcCodePtr;
    holdStartCodePtr = startCodePtr;
    holdEndCodePtr = endCodePtr;
    holdPCCodeRef = PCCodeRef;
    
    
        // set the PC at the beginning of the bytecode, and run it in 'check' mode
    
    startCodePtr = LL_int(inputStringLL, inputStringWindow->offset+1);
    endCodePtr = startCodePtr + (ccInt) ceil(1.*inputStringWindow->width/sizeof(ccInt));
    pcCodePtr = startCodePtr;
    PCCodeRef.anchor = NULL;
    PCCodeRef.code_ptr = startCodePtr;
    
    checkBytecode();
    
    if ((errCode != passed) && (doPrintError))  {
        if (opCharNum == NULL)  theOpChar = 0;
        else  theOpChar = opCharNum[errIndex-1]-1;
        printError(fileName, fileNameLength, sourceCode, theOpChar, ccFalse);
        
        doPrintError = ccFalse;        }
    
    
        // restore the important variables
    
    PCCodeRef = holdPCCodeRef;
    pcCodePtr = holdPCCodePtr;
    startCodePtr = holdStartCodePtr;
    endCodePtr = holdEndCodePtr;
    
    if (errCode != passed)  return;
    
    
        // OK, it worked.  Make a new anchor for the code.
    
    if (newCodePathStem != NULL)  refPath(newCodePathStem);       // temporarily over-reference each new path as we create it
    if (firstPathVarMember != 0)    {
        
        pathVarMemberCounter = firstPathVarMember-1;
        while (1 == 1)  {
            pathVarMemberCounter++;
            rtrn = findMemberIndex(pathVariable, 0, pathVarMemberCounter, &loopMember, &dummy, &memberOffset, ccFalse);
            if (rtrn == invalid_index_err)  break;
            if ((!loopMember->ifHidden) && (loopMember->memberWindow != NULL))  {
                rtrn = drawPath(&newCodePath, loopMember->memberWindow, newCodePathStem, 1, PCCodeRef.PLL_index);
                if (rtrn != passed)  {  setError(rtrn, pcCodePtr-1);  return;  }
                refPath(newCodePath);                               // so it doesn't get deleted by a later path in the same window
                derefPath(&newCodePathStem);
                newCodePathStem = newCodePath;
    }   }   }
    
    if (compiledCodeWindow != NULL)  drawPathTo = compiledCodeWindow;
    else  drawPathTo = PCCodeRef.anchor->jamb;
    
    rtrn = drawPath(&newCodePath, drawPathTo, newCodePathStem, 1, PCCodeRef.PLL_index);
    if (rtrn != passed)  {  setError(rtrn, pcCodePtr-1);  return;  }
    refPath(newCodePath);
    derefPath(&newCodePathStem);
    
    
        // wipe up any existing codes in our function
    
    if (compiledCodeWindow != NULL)  {
        for (counter = 1; counter <= compiledCodeWindow->variable_ptr->codeList.elementNum; counter++)
            derefCodeRef((code_ref *) element(&(compiledCodeWindow->variable_ptr->codeList), counter));
        deleteElements(&(compiledCodeWindow->variable_ptr->codeList), 1, compiledCodeWindow->variable_ptr->codeList.elementNum);    }
    
    
        // add our new code to the Registry..
    
    rtrn = addCode(LL_int(inputStringLL, inputStringWindow->offset+1), &codeEntryPtr, &codeIndex,
            (ccInt) ceil(1.*inputStringWindow->width/sizeof(ccInt)), fileName, fileNameLength, sourceCode, opCharNum, sourceCodeLength);
    if (rtrn != passed)  {  setError(rtrn, pcCodePtr-1);  return;  }
    
    
        // and to the code list of the function
    
    if (compiledCodeWindow != NULL)  {
        rtrn = addCodeRef(&(compiledCodeWindow->variable_ptr->codeList), newCodePath, codeEntryPtr, codeIndex);
        if (rtrn != passed)  {  setError(rtrn, pcCodePtr-1);  return;  }        }
    
    derefCodeList(&codeRegister);
    
    resizeLinkedList(&codeRegister, 0, ccFalse);
    rtrn = addCodeRef(&codeRegister, newCodePath, codeEntryPtr, codeIndex);
    if (rtrn != passed)  {  setError(rtrn, pcCodePtr-1);  return;  }

    derefPath(&newCodePath);
    
    GL_Object.codeList = &codeRegister;
    codeNumber = 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
leaq 0xe57c(%rip), %r15      # 0x25760
movq 0x170(%r15), %rax
movq %rax, 0x20(%rsp)
xorl %eax, %eax
leaq 0x50(%rsp), %rcx
movl %eax, (%rcx)
leaq 0x4c(%rsp), %rdx
movl %eax, (%rdx)
leaq 0x7c(%rsp), %rsi
movl %eax, (%rsi)
leaq 0x70(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x80(%rsp), %r8
movq %rax, (%r8)
leaq 0x68(%rsp), %r9
movq %rax, (%r9)
movq %r8, 0xb0(%rsp)
movq %r9, 0xb8(%rsp)
movq %rdi, 0xc0(%rsp)
movq %rcx, 0x90(%rsp)
movq %rdx, 0x98(%rsp)
movq %rsi, 0xa0(%rsp)
callq 0x1926a
movl %eax, %ebp
leal -0x7(%rbp), %eax
cmpl $-0x7, %eax
ja 0x17278
movq 0xb8(%r15), %rsi
addq $-0x4, %rsi
movl $0x2d, %edi
callq 0xd1a9
jmp 0x17289
movl $0x1, %edi
callq 0x19452
cmpl $0x0, 0x18(%r15)
je 0x1729b
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
cmpl $0x0, 0x1c(%rax)
je 0x172ca
movq 0x10(%r14), %rbx
addq $0x10, %rbx
movq %rbx, %rdi
callq 0x8bb7
testl %eax, %eax
je 0x172d4
movq 0xb8(%r15), %rsi
addq $-0x4, %rsi
movl $0x1, %edi
jmp 0x17271
movl $0x0, 0x6c(%r15)
jmp 0x17289
testb $0x3, 0x1c(%r14)
je 0x172ed
movq 0xb8(%r15), %rsi
addq $-0x4, %rsi
movl $0x2e, %edi
jmp 0x17271
movq %rbx, 0x60(%rsp)
movq $0x0, 0x18(%rsp)
cmpl $0x2, %ebp
jl 0x1732a
movl $0x2, %edi
callq 0x192b4
testq %rax, %rax
je 0x1732a
movq %rax, %rbx
movq 0x10(%rax), %rax
cmpl $0x5, 0xc0(%rax)
jne 0x17372
cmpl $0x1, 0x1c(%rbx)
je 0x1732c
jmp 0x1761f
xorl %ebx, %ebx
cmpl $0x3, %ebp
jl 0x1736b
movl $0x3, %edi
callq 0x192b4
testq %rax, %rax
je 0x17387
movq 0x10(%rax), %rdx
movq %rdx, 0x38(%rsp)
cmpl $0x4, 0xc0(%rdx)
jg 0x17572
movq 0xb8(%r15), %rsi
addq $-0x4, %rsi
movl $0x24, %edi
jmp 0x17271
movq %rbx, 0x58(%rsp)
jmp 0x17395
movq 0xb8(%r15), %rsi
addq $-0x4, %rsi
movl $0x23, %edi
jmp 0x17271
movq %rbx, 0x58(%rsp)
movq $0x0, 0x18(%rsp)
movq $0x0, 0x38(%rsp)
cmpl $0x4, %ebp
jl 0x1741d
incl %ebp
movl $0x4, %ebx
movl %ebx, %edi
callq 0x192b4
testq %rax, %rax
je 0x17415
movl %ebx, %edi
callq 0x19452
cmpl $0x0, 0x18(%r15)
jne 0x17289
movq %rax, %r12
movq 0x10(%rax), %r13
addq $0x10, %r13
movq %r13, %rdi
callq 0x8bb7
testl %eax, %eax
jne 0x178ac
movl 0x1c(%r12), %eax
movq 0x70(%rsp,%rbx,8), %rcx
movl %eax, (%rcx)
cmpl $0x0, 0x1c(%r12)
je 0x17400
movl 0x18(%r12), %esi
incl %esi
jmp 0x17402
xorl %esi, %esi
movq %r13, %rdi
callq 0x911c
movq 0x90(%rsp,%rbx,8), %rcx
movq %rax, (%rcx)
incq %rbx
cmpq %rbx, %rbp
jne 0x173aa
movq 0x70(%rsp), %rax
movq 0x68(%rsp), %rcx
testq %rax, %rax
je 0x1748e
testq %rcx, %rcx
movq 0x60(%rsp), %rdi
je 0x17498
movslq 0x7c(%rsp), %rcx
cmpl %ecx, 0x1c(%r14)
jne 0x17634
cmpl $0x4, %ecx
jb 0x174ad
shrq $0x2, %rcx
movl 0x4c(%rsp), %edx
cmpq $0x1, %rcx
adcq $0x0, %rcx
xorl %esi, %esi
movl (%rax,%rsi,4), %r9d
testl %r9d, %r9d
jle 0x1747c
testl %edx, %edx
setg %r8b
cmpl %edx, %r9d
setg %r9b
testb %r8b, %r9b
je 0x17484
jmp 0x17634
testl %edx, %edx
jg 0x17634
incq %rsi
cmpq %rsi, %rcx
jne 0x1745c
jmp 0x174ad
testq %rcx, %rcx
movq 0x60(%rsp), %rdi
je 0x174ad
movq 0xb8(%r15), %rsi
addq $-0x4, %rsi
movl $0x1a, %edi
jmp 0x17271
movq 0xb8(%r15), %r12
movq 0xc0(%r15), %r13
movq 0xc8(%r15), %rbp
movups 0x208(%r15), %xmm0
movaps %xmm0, 0xd0(%rsp)
movups 0x218(%r15), %xmm0
movaps %xmm0, 0xe0(%rsp)
movl 0x18(%r14), %esi
incl %esi
callq 0x911c
movq %rax, %rbx
movq %rax, 0xc0(%r15)
xorps %xmm0, %xmm0
cvtsi2sdl 0x1c(%r14), %xmm0
mulsd 0x3b10(%rip), %xmm0     # 0x1b018
callq 0x8070
cvttsd2si %xmm0, %eax
cltq
leaq (%rbx,%rax,4), %rax
movq %rax, 0xc8(%r15)
movq %rbx, 0xb8(%r15)
movq $0x0, 0x220(%r15)
movq %rbx, 0x218(%r15)
callq 0x15b42
cmpl $0x0, 0x18(%r15)
je 0x1766c
cmpb $0x0, 0x2a9(%r15)
je 0x1766c
movq 0x70(%rsp), %rax
testq %rax, %rax
je 0x17649
movslq 0x1c(%r15), %rcx
movl -0x4(%rax,%rcx,4), %ecx
decl %ecx
jmp 0x1764b
cmpl $0x1, 0x1c(%rax)
jne 0x1761f
movq %rbx, 0x58(%rsp)
movq $0x0, 0x20(%rsp)
movl $0x0, (%rsp)
movl $0x1, %eax
movq %rax, 0x18(%rsp)
leaq 0x40(%rsp), %rcx
leaq 0x34(%rsp), %r8
leaq 0x30(%rsp), %r9
movq 0x38(%rsp), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0xf043
cmpl $0x1e, %eax
je 0x17611
leaq 0x40(%rsp), %r12
leaq 0x34(%rsp), %r13
leaq 0x30(%rsp), %rbx
movq 0x40(%rsp), %rax
cmpb $0x0, 0x40(%rax)
jne 0x175e4
cmpq $0x0, (%rax)
jne 0x1739e
movq 0x18(%rsp), %rdx
incl %edx
movl $0x0, (%rsp)
movq 0x38(%rsp), %rdi
xorl %esi, %esi
movq %rdx, 0x18(%rsp)
movq %r12, %rcx
movq %r13, %r8
movq %rbx, %r9
callq 0xf043
cmpl $0x1e, %eax
jne 0x175cf
movq $0x0, 0x18(%rsp)
jmp 0x1739e
movq 0xb8(%r15), %rsi
addq $-0x4, %rsi
movl $0x1f, %edi
jmp 0x17271
movq 0xb8(%r15), %rsi
addq $-0x4, %rsi
movl $0x2, %edi
jmp 0x17271
xorl %ecx, %ecx
movq 0x80(%rsp), %rdi
movl 0x50(%rsp), %esi
movq 0x68(%rsp), %rdx
xorl %r8d, %r8d
callq 0x1a232
movb $0x0, 0x2a9(%r15)
movapd 0xd0(%rsp), %xmm0
movaps 0xe0(%rsp), %xmm1
movups %xmm1, 0x218(%r15)
movupd %xmm0, 0x208(%r15)
movq %r12, 0xb8(%r15)
movq %r13, 0xc0(%r15)
movq %rbp, 0xc8(%r15)
cmpl $0x0, 0x18(%r15)
jne 0x17289
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x176bd
callq 0xfa4d
cmpl $0x0, 0x18(%rsp)
je 0x1779c
movl $0x0, (%rsp)
leaq 0x40(%rsp), %rcx
leaq 0x34(%rsp), %r8
leaq 0x30(%rsp), %r9
movq 0x38(%rsp), %rdi
xorl %esi, %esi
movq 0x18(%rsp), %rdx
callq 0xf043
cmpl $0x1e, %eax
je 0x1779c
movq 0x18(%rsp), %rax
incl %eax
movq %rax, 0x18(%rsp)
leaq 0x28(%rsp), %r13
leaq 0x34(%rsp), %rbx
leaq 0x30(%rsp), %rbp
movq 0x40(%rsp), %rax
cmpb $0x0, 0x40(%rax)
jne 0x17765
movq (%rax), %rsi
testq %rsi, %rsi
je 0x17765
movq 0x20(%rsp), %rdx
movl 0x208(%r15), %r8d
movq %r13, %rdi
movl $0x1, %ecx
callq 0xfaa3
testl %eax, %eax
jne 0x178ac
movq 0x28(%rsp), %rdi
callq 0xfa4d
leaq 0x20(%rsp), %rdi
callq 0xf972
movq 0x28(%rsp), %rax
movq %rax, 0x20(%rsp)
movl $0x0, (%rsp)
movq 0x38(%rsp), %rdi
xorl %esi, %esi
movq 0x18(%rsp), %r12
movl %r12d, %edx
leaq 0x40(%rsp), %rcx
movq %rbx, %r8
movq %rbp, %r9
callq 0xf043
incl %r12d
movq %r12, 0x18(%rsp)
cmpl $0x1e, %eax
jne 0x17713
movq 0x58(%rsp), %rbx
movq %rbx, %rsi
testq %rbx, %rbx
jne 0x177b4
movq 0x220(%r15), %rax
movq 0x18(%rax), %rsi
movq 0x20(%rsp), %rdx
movl 0x208(%r15), %r8d
leaq 0x28(%rsp), %rdi
movl $0x1, %ecx
callq 0xfaa3
testl %eax, %eax
jne 0x178ac
movq 0x28(%rsp), %rdi
callq 0xfa4d
leaq 0x20(%rsp), %rdi
callq 0xf972
movq %rbx, %r12
testq %rbx, %rbx
je 0x1783e
movq 0x10(%r12), %rdi
movl 0xd0(%rdi), %edx
addq $0xd0, %rdi
testl %edx, %edx
jle 0x17834
xorl %ebx, %ebx
movq %r12, %r13
incl %ebx
movl %ebx, %esi
callq 0x911c
movq %rax, %rdi
callq 0xf24c
movq 0x10(%r13), %rdi
movl 0xd0(%rdi), %edx
addq $0xd0, %rdi
cmpl %edx, %ebx
jl 0x1780e
movl $0x1, %esi
callq 0x868b
movl 0x18(%r14), %esi
incl %esi
movq 0x60(%rsp), %rdi
callq 0x911c
movq %rax, %rbx
xorps %xmm0, %xmm0
cvtsi2sdl 0x1c(%r14), %xmm0
mulsd 0x37b6(%rip), %xmm0     # 0x1b018
callq 0x8070
cvttsd2si %xmm0, %ecx
movq 0x80(%rsp), %r8
movl 0x50(%rsp), %r9d
movq 0x68(%rsp), %rax
movq 0x70(%rsp), %rdx
movl 0x4c(%rsp), %esi
movl %esi, 0x10(%rsp)
movq %rdx, 0x8(%rsp)
movq %rax, (%rsp)
leaq 0x88(%rsp), %rsi
leaq 0x54(%rsp), %rdx
movq %rbx, %rdi
callq 0xfb33
testl %eax, %eax
je 0x178be
movq 0xb8(%r15), %rsi
addq $-0x4, %rsi
movl %eax, %edi
jmp 0x17271
testq %r12, %r12
je 0x178e7
movl $0xd0, %edi
addq 0x10(%r12), %rdi
movq 0x28(%rsp), %rsi
movq 0x88(%rsp), %rdx
movl 0x54(%rsp), %ecx
callq 0xfd5f
testl %eax, %eax
jne 0x178ac
movl $0x98, %ebx
addq 0xa6ed(%rip), %rbx      # 0x21fe0
movq %rbx, %rdi
callq 0x1507c
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x8b7e
movq 0x28(%rsp), %rsi
movq 0x88(%rsp), %rdx
movl 0x54(%rsp), %ecx
movq %rbx, %rdi
callq 0xfd5f
testl %eax, %eax
jne 0x178ac
leaq 0x28(%rsp), %rdi
callq 0xf972
leaq 0x98(%r15), %rax
movq %rax, 0x100(%r15)
movl $0x1, 0x1f4(%r15)
jmp 0x17289