// File: /workspace/github_c_makefile_star2_O3/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 $0x108, %rsp            # imm = 0x108
leaq 0xe5f7(%rip), %r15      # 0x25760
movq 0x170(%r15), %r13
movq %r13, 0x38(%rsp)
xorl %eax, %eax
leaq 0x58(%rsp), %rcx
movl %eax, (%rcx)
leaq 0x54(%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, 0xc0(%rsp)
movq %r9, 0xc8(%rsp)
movq %rdi, 0xd0(%rsp)
movq %rcx, 0xa0(%rsp)
movq %rdx, 0xa8(%rsp)
movq %rsi, 0xb0(%rsp)
callq 0x19254
movl %eax, %r12d
leal -0x7(%r12), %eax
cmpl $-0x7, %eax
ja 0x17200
movq 0xb8(%r15), %rsi
addq $-0x4, %rsi
movl $0x2d, %edi
callq 0xcfa3
jmp 0x17211
movl $0x1, %edi
callq 0x1943c
cmpl $0x0, 0x18(%r15)
je 0x17223
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
cmpl $0x0, 0x1c(%rax)
je 0x17252
movq 0x10(%r14), %rbx
addq $0x10, %rbx
movq %rbx, %rdi
callq 0x8c00
testl %eax, %eax
je 0x1725c
movq 0xb8(%r15), %rsi
addq $-0x4, %rsi
movl $0x1, %edi
jmp 0x171f9
movl $0x0, 0x6c(%r15)
jmp 0x17211
testb $0x3, 0x1c(%r14)
je 0x17275
movq 0xb8(%r15), %rsi
addq $-0x4, %rsi
movl $0x2e, %edi
jmp 0x171f9
cmpl $0x2, %r12d
jb 0x172c0
movl $0x2, %edi
callq 0x1929e
movq %rax, %rbp
testq %rax, %rax
je 0x172a8
movq 0x10(%rbp), %rax
cmpl $0x5, 0xc0(%rax)
jne 0x17442
cmpl $0x1, 0x1c(%rbp)
jne 0x17602
cmpl $0x2, %r12d
jne 0x17457
movq $0x0, 0x20(%rsp)
xorl %r12d, %r12d
jmp 0x172ce
movq $0x0, 0x20(%rsp)
xorl %r12d, %r12d
xorl %ebp, %ebp
movq 0x70(%rsp), %rax
movq 0x68(%rsp), %rcx
testq %rax, %rax
je 0x17336
testq %rcx, %rcx
je 0x1733b
movslq 0x1c(%r14), %rcx
cmpl 0x7c(%rsp), %ecx
jne 0x1742d
cmpl $0x4, %ecx
jb 0x17350
shrq $0x2, %rcx
movl 0x54(%rsp), %edx
cmpq $0x1, %rcx
adcq $0x0, %rcx
xorl %esi, %esi
movl (%rax,%rsi,4), %edi
testl %edi, %edi
jle 0x17324
testl %edx, %edx
setg %r8b
cmpl %edx, %edi
setg %dil
testb %r8b, %dil
je 0x1732c
jmp 0x1742d
testl %edx, %edx
jg 0x1742d
incq %rsi
cmpq %rsi, %rcx
jne 0x17307
jmp 0x17350
testq %rcx, %rcx
je 0x17350
movq 0xb8(%r15), %rsi
addq $-0x4, %rsi
movl $0x1a, %edi
jmp 0x171f9
movq %rbp, 0x60(%rsp)
movups 0xb8(%r15), %xmm0
movaps %xmm0, 0x90(%rsp)
movq 0xc8(%r15), %rbp
movups 0x208(%r15), %xmm0
movaps %xmm0, 0xe0(%rsp)
movups 0x218(%r15), %xmm0
movaps %xmm0, 0xf0(%rsp)
movl 0x18(%r14), %esi
incl %esi
movq %rbx, 0x18(%rsp)
movq %rbx, %rdi
callq 0x91d8
movq %rax, %rbx
movq %rax, 0xc0(%r15)
xorps %xmm0, %xmm0
cvtsi2sdl 0x1c(%r14), %xmm0
mulsd 0x3c5e(%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 0x15af5
movl 0x18(%r15), %eax
testl %eax, %eax
je 0x174a4
cmpb $0x0, 0x2a9(%r15)
movq %rbp, %rbx
movq 0x60(%rsp), %rbp
je 0x1763e
movq 0x70(%rsp), %rax
testq %rax, %rax
je 0x17617
movslq 0x1c(%r15), %rcx
movl -0x4(%rax,%rcx,4), %ecx
decl %ecx
jmp 0x17619
movq 0xb8(%r15), %rsi
addq $-0x4, %rsi
movl $0x2, %edi
jmp 0x171f9
movq 0xb8(%r15), %rsi
addq $-0x4, %rsi
movl $0x23, %edi
jmp 0x171f9
movl $0x3, %edi
callq 0x1929e
testq %rax, %rax
je 0x1748d
movq 0x10(%rax), %rdx
movq %rdx, 0x20(%rsp)
cmpl $0x4, 0xc0(%rdx)
jg 0x174b1
movq 0xb8(%r15), %rsi
addq $-0x4, %rsi
movl $0x24, %edi
jmp 0x171f9
movq $0x0, 0x40(%rsp)
movq $0x0, 0x20(%rsp)
jmp 0x17557
movq %rbp, %rbx
movq 0x60(%rsp), %rbp
jmp 0x1763e
cmpl $0x1, 0x1c(%rax)
jne 0x17602
movq %rbx, 0x18(%rsp)
movq $0x0, 0x38(%rsp)
movl $0x0, (%rsp)
movq $0x0, 0x40(%rsp)
movl $0x1, %ebx
leaq 0x48(%rsp), %rcx
leaq 0x34(%rsp), %r8
leaq 0x30(%rsp), %r9
movq 0x20(%rsp), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0xee01
cmpl $0x1e, %eax
je 0x1754f
xorl %r13d, %r13d
movq 0x48(%rsp), %rax
cmpb $0x0, 0x40(%rax)
jne 0x1751b
cmpq $0x0, (%rax)
jne 0x178f8
incl %ebx
movl $0x0, (%rsp)
movq 0x20(%rsp), %rdi
xorl %esi, %esi
movl %ebx, %edx
leaq 0x48(%rsp), %rcx
leaq 0x34(%rsp), %r8
leaq 0x30(%rsp), %r9
callq 0xee01
cmpl $0x1e, %eax
jne 0x17506
movq $0x0, 0x40(%rsp)
xorl %r13d, %r13d
movq 0x18(%rsp), %rbx
cmpl $0x4, %r12d
jl 0x175f8
movq %rbx, 0x18(%rsp)
incl %r12d
movl $0x4, %ebx
movq %rbp, 0x60(%rsp)
movl %ebx, %edi
callq 0x1929e
testq %rax, %rax
je 0x175eb
movl %ebx, %edi
callq 0x1943c
cmpl $0x0, 0x18(%r15)
jne 0x17211
movq %rax, 0x90(%rsp)
movq 0x10(%rax), %rbp
addq $0x10, %rbp
movq %rbp, %rdi
callq 0x8c00
testl %eax, %eax
jne 0x17859
movq 0x90(%rsp), %rdx
movl 0x1c(%rdx), %eax
movq 0x80(%rsp,%rbx,8), %rcx
movl %eax, (%rcx)
testl %eax, %eax
je 0x175d1
movl 0x18(%rdx), %esi
incl %esi
jmp 0x175d3
xorl %esi, %esi
movq %rbp, %rdi
callq 0x91d8
movq 0xa0(%rsp,%rbx,8), %rcx
movq %rax, (%rcx)
movq 0x60(%rsp), %rbp
incq %rbx
cmpq %rbx, %r12
jne 0x17573
movq 0x18(%rsp), %rbx
movq 0x40(%rsp), %r12
jmp 0x172ce
movq 0xb8(%r15), %rsi
addq $-0x4, %rsi
movl $0x1f, %edi
jmp 0x171f9
xorl %ecx, %ecx
movq 0x80(%rsp), %rdi
movl 0x58(%rsp), %esi
movq 0x68(%rsp), %rdx
xorl %r8d, %r8d
callq 0x1a237
movb $0x0, 0x2a9(%r15)
movl 0x18(%r15), %eax
movaps 0xe0(%rsp), %xmm0
movaps 0xf0(%rsp), %xmm1
movups %xmm1, 0x218(%r15)
movups %xmm0, 0x208(%r15)
movapd 0x90(%rsp), %xmm0
movupd %xmm0, 0xb8(%r15)
movq %rbx, 0xc8(%r15)
testl %eax, %eax
jne 0x17211
testq %r13, %r13
je 0x1768c
movq %r13, %rdi
callq 0xf809
testl %r12d, %r12d
je 0x1774d
movl $0x0, (%rsp)
leaq 0x48(%rsp), %rcx
leaq 0x34(%rsp), %r8
leaq 0x30(%rsp), %r9
movq 0x20(%rsp), %rdi
xorl %esi, %esi
movl %r12d, %edx
callq 0xee01
cmpl $0x1e, %eax
je 0x1774d
incl %r12d
leaq 0x34(%rsp), %r13
leaq 0x30(%rsp), %rbx
movq 0x48(%rsp), %rax
cmpb $0x0, 0x40(%rax)
jne 0x17724
movq (%rax), %rsi
testq %rsi, %rsi
je 0x17724
movq 0x38(%rsp), %rdx
movl 0x208(%r15), %r8d
leaq 0x28(%rsp), %rdi
movl $0x1, %ecx
callq 0xf85f
testl %eax, %eax
jne 0x17859
movq 0x28(%rsp), %rdi
callq 0xf809
leaq 0x38(%rsp), %rdi
callq 0xf72e
movq 0x28(%rsp), %rax
movq %rax, 0x38(%rsp)
movl $0x0, (%rsp)
movq 0x20(%rsp), %rdi
xorl %esi, %esi
movl %r12d, %edx
leaq 0x48(%rsp), %rcx
movq %r13, %r8
movq %rbx, %r9
callq 0xee01
incl %r12d
cmpl $0x1e, %eax
jne 0x176d0
movq %rbp, %rsi
testq %rbp, %rbp
jne 0x17760
movq 0x220(%r15), %rax
movq 0x18(%rax), %rsi
movq 0x38(%rsp), %rdx
movl 0x208(%r15), %r8d
leaq 0x28(%rsp), %rdi
movl $0x1, %ecx
callq 0xf85f
testl %eax, %eax
movq 0x18(%rsp), %rbx
jne 0x17859
movq 0x28(%rsp), %rdi
callq 0xf809
leaq 0x38(%rsp), %rdi
callq 0xf72e
testq %rbp, %rbp
je 0x177ed
movq 0x10(%rbp), %rdi
movl 0xd0(%rdi), %edx
addq $0xd0, %rdi
testl %edx, %edx
jle 0x177de
xorl %ebx, %ebx
incl %ebx
movl %ebx, %esi
callq 0x91d8
movq %rax, %rdi
callq 0xf00c
movq 0x10(%rbp), %rdi
movl 0xd0(%rdi), %edx
addq $0xd0, %rdi
cmpl %edx, %ebx
jl 0x177b8
movl $0x1, %esi
callq 0x868b
movq 0x18(%rsp), %rbx
movl 0x18(%r14), %esi
incl %esi
movq %rbx, %rdi
callq 0x91d8
movq %rax, %rbx
xorps %xmm0, %xmm0
cvtsi2sdl 0x1c(%r14), %xmm0
mulsd 0x3809(%rip), %xmm0     # 0x1b018
callq 0x8070
cvttsd2si %xmm0, %ecx
movq 0x80(%rsp), %r8
movl 0x58(%rsp), %r9d
movq 0x68(%rsp), %rax
movq 0x70(%rsp), %rdx
movl 0x54(%rsp), %esi
movl %esi, 0x10(%rsp)
movq %rdx, 0x8(%rsp)
movq %rax, (%rsp)
leaq 0x88(%rsp), %rsi
leaq 0x5c(%rsp), %rdx
movq %rbx, %rdi
callq 0xf8f0
testl %eax, %eax
je 0x1786b
movq 0xb8(%r15), %rsi
addq $-0x4, %rsi
movl %eax, %edi
jmp 0x171f9
testq %rbp, %rbp
je 0x17893
movl $0xd0, %edi
addq 0x10(%rbp), %rdi
movq 0x28(%rsp), %rsi
movq 0x88(%rsp), %rdx
movl 0x5c(%rsp), %ecx
callq 0xfb18
testl %eax, %eax
jne 0x17859
movl $0x98, %ebx
addq 0xa741(%rip), %rbx      # 0x21fe0
movq %rbx, %rdi
callq 0x15071
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x8bc7
movq 0x28(%rsp), %rsi
movq 0x88(%rsp), %rdx
movl 0x5c(%rsp), %ecx
movq %rbx, %rdi
callq 0xfb18
testl %eax, %eax
jne 0x17859
leaq 0x28(%rsp), %rdi
callq 0xf72e
leaq 0x98(%r15), %rax
movq %rax, 0x100(%r15)
movl $0x1, 0x1f4(%r15)
jmp 0x17211
movl %ebx, %eax
movq %rax, 0x40(%rsp)
jmp 0x17552