// File: /workspace/github_c_makefile_star2_O2/heltilda[P]cicada/intrpt.c
// Function: addCode
ccInt addCode(ccInt *codeSource, ccInt **newCodePtr, ccInt *newCodeElement, ccInt codeLength,
        char *fileName, ccInt fileNameLength, char *sourceCode, ccInt *opCharNum, ccInt sourceCodeLength)
{
    ccInt rtrn;
    storedCodeType *newCodeEntry;
    
    rtrn = addPLLElement(&MasterCodeList, (void **) &newCodeEntry, newCodeElement);
    if (rtrn != passed)  return out_of_memory_err;
    
    
        // the code copy is stored in a buffer, not a linked list, since it can't be resized
    
    newCodeEntry->fileName = newCodeEntry->sourceCode = NULL;
    newCodeEntry->opCharNum = newCodeEntry->bytecode = NULL;
    
    *newCodePtr = (ccInt *) malloc((codeLength+1)*sizeof(ccInt));
    if (*newCodePtr == NULL)  return out_of_memory_err;
    newCodeEntry->bytecode = *newCodePtr;
    memcpy((void *) *newCodePtr, codeSource, codeLength*sizeof(ccInt));
    (*newCodePtr)[codeLength] = 0;
    
    if (fileName != NULL)  {
        newCodeEntry->fileName = (char *) malloc((size_t) fileNameLength+1);
        if (newCodeEntry->fileName == NULL)  return out_of_memory_err;
        memcpy((void *) newCodeEntry->fileName, (void *) fileName, fileNameLength);
        newCodeEntry->fileName[fileNameLength] = 0;     }
    
    if (sourceCode != NULL)  {
        newCodeEntry->sourceCode = (char *) malloc((size_t) sourceCodeLength+1);
        if (newCodeEntry->sourceCode == NULL)  return out_of_memory_err;
        memcpy((void *) newCodeEntry->sourceCode, (void *) sourceCode, sourceCodeLength);
        newCodeEntry->sourceCode[sourceCodeLength] = 0;
        
        newCodeEntry->opCharNum = (ccInt *) malloc((size_t) codeLength*sizeof(ccInt));
        if (newCodeEntry->opCharNum == NULL)  return out_of_memory_err;
        memcpy((void *) newCodeEntry->opCharNum, (void *) opCharNum, codeLength*sizeof(ccInt));       }
    
    return passed;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, %ebp
movq %r8, %r15
movl %ecx, %r14d
movq %rsi, %r12
movq %rdi, %r13
leaq 0x15945(%rip), %rdi     # 0x246a8
leaq 0x8(%rsp), %rsi
callq 0x9155
pushq $0x1
popq %rbx
testl %eax, %eax
je 0xed85
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, 0x10(%rsp)
movq 0x8(%rsp), %r15
xorps %xmm0, %xmm0
movups %xmm0, (%r15)
movslq %r14d, %r14
leaq 0x4(,%r14,4), %rdi
callq 0x81d0
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r15)
movq %rax, (%r12)
testq %rax, %rax
je 0xed74
addq $0x10, %r15
movq %rax, (%r15)
movq (%r12), %rdi
leaq (,%r14,4), %r15
movq %r13, %rsi
movq %r15, %rdx
callq 0x8110
movq (%r12), %rax
andl $0x0, (%rax,%r14,4)
cmpq $0x0, 0x10(%rsp)
je 0xee26
movslq %ebp, %r12
leaq 0x1(%r12), %rdi
callq 0x81d0
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
movq 0x8(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0xed74
movq 0x10(%rsp), %rsi
movq %r12, %rdx
callq 0x8110
movq 0x8(%rsp), %rax
movq (%rax), %rax
movb $0x0, (%rax,%r12)
movq %r15, %rbp
movq 0x50(%rsp), %r15
testq %r15, %r15
je 0xee93
movslq 0x60(%rsp), %r12
leaq 0x1(%r12), %rdi
callq 0x81d0
movq 0x8(%rsp), %r14
movq %rax, 0x8(%r14)
testq %rax, %rax
je 0xed74
movq %rax, %r13
movq %rax, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x8110
movb $0x0, (%r13,%r12)
movq %rbp, %r15
movq %rbp, %rdi
callq 0x81d0
movq %rax, 0x18(%r14)
testq %rax, %rax
je 0xed74
movq 0x58(%rsp), %rsi
movq %rax, %rdi
movq %r15, %rdx
callq 0x8110
xorl %ebx, %ebx
jmp 0xed74