// File: /workspace/github_c_makefile_star2_O3/heltilda[P]cicada/ciclib.c
// Function: cclib_throw
void cclib_throw()
{
    window *paramWindows[] = { NULL, NULL, NULL, NULL, NULL };
    code_ref *targetCodeRef = &PCCodeRef;
    ccInt numArgs, cA, *holdPC;
    ccInt theArgs[] = { 0, 0, 1, (ccInt) (pcCodePtr-1 - PCCodeRef.code_ptr + 1), ccFalse };
    ccInt argsMin[] = { ccIntMin, 0, 1, 1, 0 };
    ccInt argsMax[] = { ccIntMax, 0, 1, 1, 1 };
    code_ref *errorScript = &errScript;
    
    numArgs = numBIF_args();
    if ((numArgs < 1) || (numArgs > 5))  {  setError(wrong_argument_count_err, pcCodePtr-1);  return;  }
    
    
        // read in the error code, throwing real errors if something's wrong with the argument
    
    for (cA = 0; cA < numArgs; cA++)    {
        paramWindows[cA] = getBIFmember(cA+1);
        if (paramWindows[cA] != NULL)  {
            
            if (cA == 3)  {
                holdPC = pcCodePtr;
                pcCodePtr = targetCodeRef->code_ptr;
                runSkipMode(0);
                argsMax[3] = (ccInt) (pcCodePtr - targetCodeRef->code_ptr);
                pcCodePtr = holdPC;
                if (errCode != passed)  return;     }
            
            if (cA != 1)    {
                if (cA < 4)  theArgs[cA] = (ccInt) getBIFnumArg(cA+1, argsMin[cA], argsMax[cA]);
                else  theArgs[cA] = (ccInt) getBIFboolArg(cA+1);
                if (errCode != passed)  return;     }
            else    {
                argsMax[2] = paramWindows[cA]->variable_ptr->codeList.elementNum;
                theArgs[3] = 1;       }
            
            if (((cA == 1) || (cA == 2)) && (paramWindows[1] != NULL))  {
                targetCodeRef = (code_ref *) element(&(paramWindows[1]->variable_ptr->codeList), theArgs[2]);
    }   }   }
    
    
        // throw the error/warning
    
    if (theArgs[4] == 0)  {
        errCode = theArgs[0];
        errIndex = theArgs[3];
        errorScript = &errScript;       }
    
    else  {
        warningCode = theArgs[0];
        warningIndex = theArgs[3];
        errorScript = &warningScript;       }
    
    if (errorScript->code_ptr != NULL)  derefCodeRef(errorScript);
    *errorScript = *targetCodeRef;
    errorScript->anchor = NULL;
    refCodeRef(errorScript);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movq $0x0, 0x60(%rsp)
xorl %eax, %eax
movl %eax, (%rsp)
movl $0x1, %ecx
movl %ecx, 0x8(%rsp)
leaq 0xd2a7(%rip), %r15      # 0x25760
movq 0xb8(%r15), %rdx
subq 0x218(%r15), %rdx
addq $-0x4, %rdx
shrq $0x2, %rdx
incl %edx
movl %edx, 0xc(%rsp)
movl %eax, 0x10(%rsp)
movapd 0x38ff(%rip), %xmm0     # 0x1bde0
movapd %xmm0, 0x20(%rsp)
movl %ecx, 0x30(%rsp)
callq 0x19254
leal -0x6(%rax), %ecx
cmpl $-0x5, %ecx
jae 0x1851b
movq 0xb8(%r15), %rsi
addq $-0x4, %rsi
movl $0x2d, %edi
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xcfa3
movl $0x208, %ecx            # imm = 0x208
addq 0x9ab9(%rip), %rcx      # 0x21fe0
movq %rcx, 0x18(%rsp)
movl %eax, %ebx
leaq 0x388b(%rip), %r13      # 0x1bdc0
xorl %r14d, %r14d
movq %rbx, 0x38(%rsp)
leaq 0x1(%r14), %rbp
movl %ebp, %edi
callq 0x1929e
movq %rax, 0x40(%rsp,%r14,8)
testq %rax, %rax
je 0x1863a
cmpl $0x1, %r14d
je 0x185ad
cmpl $0x3, %r14d
jne 0x185c5
movq 0xb8(%r15), %rbx
movq 0x18(%rsp), %r12
movq 0x10(%r12), %rax
movq %rax, 0xb8(%r15)
xorl %edi, %edi
callq 0x15681
movq 0xb8(%r15), %rax
subq 0x10(%r12), %rax
shrq $0x2, %rax
movl %eax, 0x2c(%rsp)
movq %rbx, 0xb8(%r15)
movq 0x38(%rsp), %rbx
cmpl $0x0, 0x18(%r15)
je 0x185cb
jmp 0x186ca
movq 0x10(%rax), %rax
movl 0xd0(%rax), %eax
movl %eax, 0x28(%rsp)
movl $0x1, 0xc(%rsp)
jmp 0x18604
cmpq $0x3, %r14
ja 0x185eb
xorps %xmm0, %xmm0
cvtsi2sdl (%r13), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl 0x20(%rsp,%r14,4), %xmm1
movl %ebp, %edi
callq 0x1930e
cvttsd2si %xmm0, %eax
jmp 0x185f5
movl %ebp, %edi
callq 0x195d3
movsbl %al, %eax
movl %eax, (%rsp,%r14,4)
cmpl $0x0, 0x18(%r15)
jne 0x186ca
decl %r14d
cmpl $0x2, %r14d
setb %cl
movq 0x48(%rsp), %rax
testq %rax, %rax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x1863a
movq 0x10(%rax), %rdi
movl $0xd0, %eax
addq %rax, %rdi
movl 0x8(%rsp), %esi
callq 0x91d8
movq %rax, 0x18(%rsp)
addq $0x4, %r13
movq %rbp, %r14
cmpq %rbp, %rbx
jne 0x1853d
movl 0x10(%rsp), %ebp
leaq 0x48(%r15), %r14
leaq 0x28(%r15), %rax
leaq 0x38(%r15), %rcx
leaq 0x58(%r15), %rdx
xorl %esi, %esi
testl %ebp, %ebp
setne %sil
cmoveq %rax, %r14
movl (%rsp), %eax
movl 0xc(%rsp), %edi
movl %eax, 0x18(%r15,%rsi,8)
movl %edi, 0x1c(%r15,%rsi,8)
cmoveq %rcx, %rdx
cmpq $0x0, (%rdx)
je 0x1868d
movq %r14, %rdi
callq 0xf00c
xorl %eax, %eax
testl %ebp, %ebp
setne %al
movq 0x18(%rsp), %rdx
movq 0x10(%rdx), %rcx
movq %rcx, 0x10(%r14)
movups (%rdx), %xmm0
movups %xmm0, (%r14)
shll $0x5, %eax
movq $0x0, 0x40(%r15,%rax)
movq %r14, %rdi
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf028
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq