// File: /workspace/github_c_makefile_star2_O1/heltilda[P]cicada/ccmain.c
// Function: initCicada
ccInt initCicada(ccInt *zeroCode, ccInt zeroCodeLength,
        char *fileName, ccInt fileNameLength, char *sourceCode, ccInt *opCharNum, ccInt sourceCodeLength)
{
    variable *varZero;
    ccInt zeroCodeIndex, *zeroCodeEntryPtr, rtrn;
    
    baseView.windowPtr = NULL;              // these can confuse addMemory if not initialized to NULL first
    searchView.windowPtr = NULL;            // to prevent an error on startup when addMemory checks baseView.windowPtr->variable_ptr
    topView.windowPtr = NULL;
    
    rtrn = newPLL(&VariableList, 0, sizeof(variable), LLFreeSpace);        // make space for variables & codes
    if (rtrn != passed)  return rtrn;
    rtrn = newPLL(&MasterCodeList, 0, sizeof(storedCodeType), LLFreeSpace);
    if (rtrn != passed)  return rtrn;
    rtrn = newStack(&PCStack, sizeof(view), 100, LLFreeSpace);
    if (rtrn != passed)  return rtrn;
    
    rtrn = addVariable(&varZero, composite_type, composite_type, 0, ccTrue);
    if (rtrn != passed)  return rtrn;
    rtrn = addWindow(varZero, 0, 1, &Zero, ccTrue);
    if (rtrn != passed)  return rtrn;
    rtrn = drawPath(&ZeroSuspensor, Zero, NULL, 1, 1);
    if (rtrn != passed)  return rtrn;
    
    rtrn = addCode(zeroCode, &zeroCodeEntryPtr, &zeroCodeIndex, zeroCodeLength,
                fileName, fileNameLength, sourceCode, opCharNum, sourceCodeLength);
    if (rtrn != passed)  return rtrn;
    rtrn = addCodeRef(&(varZero->codeList), ZeroSuspensor, zeroCodeEntryPtr, zeroCodeIndex);
    if (rtrn != passed)  return rtrn;
    PCCodeRef = *(code_ref *) element(&(varZero->codeList), 1);
    
    refWindow(Zero);
    refPath(ZeroSuspensor);
    
    pcCodePtr = zeroCodeEntryPtr;        // should immediately call checkBytecode()
    
    rtrn = newLinkedList(&(GL_Object.arrayDimList), 0, sizeof(ccInt), 2., ccFalse);
    if (rtrn != passed)  return rtrn;
    rtrn = newLinkedList(&codeRegister, 0, sizeof(code_ref), 0., ccFalse);      // used in bytecd.c to pass codes from code blocks
    if (rtrn != passed)  return rtrn;
    
    rtrn = newLinkedList(&stringRegister, 0, sizeof(char), 0., ccFalse);     // set up the string register
    if (rtrn != passed)  return rtrn;
    
    errCode = warningCode = passed;
    errIndex = 1;              // for now
    errScript.code_ptr = NULL;
    warningScript.code_ptr = NULL;
    
    recursionCounter = 0;
    pcSearchPath = NULL;
    BIF_argsView.windowPtr = NULL;
    argsView.windowPtr = NULL;
    returnView.windowPtr = NULL;
    thatView.windowPtr = NULL;
    
    extCallMode = ccFalse;
    doPrintError = ccFalse;
    
    return passed;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r9, 0x40(%rsp)
movq %r8, %r15
movl %ecx, %r12d
movq %rdx, %r13
movl %esi, %r14d
movq %rdi, %rbp
leaq 0xb222(%rip), %rax      # 0x25760
xorl %ecx, %ecx
movq %rcx, 0x140(%rax)
movq %rcx, 0x158(%rax)
movq %rcx, 0x1d8(%rax)
leaq 0x17c4(%rip), %rax      # 0x1bd20
movsd (%rax), %xmm0
leaq 0xb141(%rip), %rdi      # 0x256a8
addq $0x48, %rdi
xorl %esi, %esi
movl $0xf8, %edx
movsd %xmm0, 0x20(%rsp)
callq 0x9180
testl %eax, %eax
jne 0x1a765
movq %rbp, 0x30(%rsp)
movl %r14d, 0x14(%rsp)
movq %r13, 0x38(%rsp)
movl %r12d, 0x18(%rsp)
movq 0x40(%rsp), %rbp
leaq 0xb103(%rip), %rdi      # 0x256a8
xorl %esi, %esi
movl $0x20, %edx
movsd 0x20(%rsp), %xmm0
callq 0x9180
testl %eax, %eax
jne 0x1a765
movl $0x90, %edi
addq 0x7a0d(%rip), %rdi      # 0x21fd8
movl $0x18, %esi
movl $0x64, %edx
movsd 0x20(%rsp), %xmm0
callq 0x9430
testl %eax, %eax
jne 0x1a765
leaq 0x8(%rsp), %rdi
movl $0x5, %esi
movl $0x5, %edx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0xf277
testl %eax, %eax
jne 0x1a765
movq 0x8(%rsp), %rdi
leaq 0xb148(%rip), %r14      # 0x25760
xorl %esi, %esi
movl $0x1, %edx
movq %r14, %rcx
movl $0x1, %r8d
callq 0xd0f1
testl %eax, %eax
jne 0x1a765
movq (%r14), %rsi
leaq 0x10(%r14), %rdi
xorl %edx, %edx
movl $0x1, %ecx
movl $0x1, %r8d
callq 0xfaa3
testl %eax, %eax
jne 0x1a765
movl 0x80(%rsp), %eax
subq $0x8, %rsp
leaq 0x30(%rsp), %rsi
leaq 0x24(%rsp), %rdx
movq 0x38(%rsp), %rdi
movl 0x1c(%rsp), %ecx
movq 0x40(%rsp), %r8
movl 0x20(%rsp), %r9d
pushq %rax
pushq %rbp
pushq %r15
callq 0xfb33
addq $0x20, %rsp
testl %eax, %eax
jne 0x1a765
movl $0xd0, %r14d
movq 0x8(%rsp), %rdi
addq %r14, %rdi
leaq 0xb0b8(%rip), %r15      # 0x25760
movq 0x10(%r15), %rsi
movq 0x28(%rsp), %rdx
movl 0x1c(%rsp), %ecx
callq 0xfd5f
testl %eax, %eax
jne 0x1a765
addq 0x8(%rsp), %r14
movq %r14, %rdi
movl $0x1, %esi
callq 0x911c
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm0, 0x208(%r15)
movups %xmm1, 0x218(%r15)
movq (%r15), %rdi
callq 0xd1c8
movq 0x10(%r15), %rdi
callq 0xfa4d
movq 0x28(%rsp), %rax
movq %rax, 0xb8(%r15)
leaq 0xe0(%r15), %rdi
movsd 0x909(%rip), %xmm0      # 0x1b020
xorl %esi, %esi
movl $0x4, %edx
xorl %ecx, %ecx
callq 0x83e1
testl %eax, %eax
jne 0x1a765
movl $0x98, %edi
addq 0x78ab(%rip), %rdi      # 0x21fe0
xorps %xmm0, %xmm0
xorl %esi, %esi
movl $0x20, %edx
xorl %ecx, %ecx
callq 0x83e1
testl %eax, %eax
jne 0x1a765
leaq 0x78(%r15), %rdi
xorl %ebx, %ebx
xorps %xmm0, %xmm0
xorl %esi, %esi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x83e1
testl %eax, %eax
je 0x1a778
movl %eax, %ebx
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xafe1(%rip), %rcx      # 0x25760
movl %ebx, 0x20(%rcx)
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, 0x18(%rcx)
movq %rbx, 0x38(%rcx)
movq %rbx, 0x58(%rcx)
movl %ebx, 0x200(%rcx)
movq %rbx, 0x190(%rcx)
movq %rbx, 0x1a8(%rcx)
movq %rbx, 0x1c0(%rcx)
movw $0x0, 0x2a8(%rcx)
xorps %xmm0, %xmm0
movups %xmm0, 0x170(%rcx)
jmp 0x1a767