// File: /workspace/github_c_makefile_star2_O1/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 $0x78, %rsp
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
xorl %eax, %eax
movq %rax, 0x70(%rsp)
movq %rax, (%rsp)
movl $0x1, %eax
movl %eax, 0x8(%rsp)
leaq 0xd29c(%rip), %rbx      # 0x25760
movq 0xb8(%rbx), %rcx
subq 0x218(%rbx), %rcx
addq $-0x4, %rcx
shrq $0x2, %rcx
incl %ecx
movl %ecx, 0xc(%rsp)
movl $0x0, 0x10(%rsp)
movapd 0x3910(%rip), %xmm0     # 0x1be00
movapd %xmm0, 0x20(%rsp)
movl %eax, 0x30(%rsp)
callq 0x1926a
leal -0x6(%rax), %ecx
cmpl $-0x5, %ecx
jae 0x1852a
movq 0xb8(%rbx), %rsi
addq $-0x4, %rsi
movl $0x2d, %edi
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xd1a9
movl $0x208, %r13d           # imm = 0x208
addq 0x9aa9(%rip), %r13      # 0x21fe0
testl %eax, %eax
jle 0x18664
movl %eax, %eax
movq %rax, 0x48(%rsp)
leaq 0x3893(%rip), %rbp      # 0x1bde0
xorl %r12d, %r12d
movq %r12, %r14
incq %r12
movl %r12d, %edi
callq 0x192b4
movq %rax, 0x50(%rsp,%r14,8)
testq %rax, %rax
je 0x18655
movq %rax, %r15
cmpl $0x1, %r14d
je 0x185c8
cmpl $0x3, %r14d
jne 0x185e0
movq 0xb8(%rbx), %rax
movq %rax, 0x40(%rsp)
movq 0x10(%r13), %rax
movq %rax, 0xb8(%rbx)
xorl %edi, %edi
callq 0x1569b
movq 0xb8(%rbx), %rax
subq 0x10(%r13), %rax
shrq $0x2, %rax
movl %eax, 0x2c(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0xb8(%rbx)
cmpl $0x0, 0x18(%rbx)
jne 0x186e1
cmpq $0x1, %r14
jne 0x185e0
movq 0x10(%r15), %rax
movl 0xd0(%rax), %eax
movl %eax, 0x28(%rsp)
movl $0x1, 0xc(%rsp)
jmp 0x18621
cmpq $0x3, %r14
ja 0x18607
xorps %xmm0, %xmm0
cvtsi2sdl (%rbp), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl 0x20(%rsp,%r14,4), %xmm1
leal 0x1(%r14), %edi
callq 0x19324
cvttsd2si %xmm0, %eax
jmp 0x18613
leal 0x1(%r14), %edi
callq 0x195ff
movsbl %al, %eax
movl %eax, (%rsp,%r14,4)
cmpl $0x0, 0x18(%rbx)
jne 0x186e1
decl %r14d
cmpl $0x2, %r14d
setb %cl
movq 0x58(%rsp), %rax
testq %rax, %rax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x18655
movq 0x10(%rax), %rdi
movl $0xd0, %eax
addq %rax, %rdi
movl 0x8(%rsp), %esi
callq 0x911c
movq %rax, %r13
addq $0x4, %rbp
cmpq %r12, 0x48(%rsp)
jne 0x18550
movl 0x10(%rsp), %ebp
leaq 0x48(%rbx), %r14
leaq 0x28(%rbx), %rax
leaq 0x38(%rbx), %rcx
leaq 0x58(%rbx), %rdx
xorl %esi, %esi
testl %ebp, %ebp
setne %sil
cmoveq %rax, %r14
movl (%rsp), %eax
movl 0xc(%rsp), %edi
movl %eax, 0x18(%rbx,%rsi,8)
movl %edi, 0x1c(%rbx,%rsi,8)
cmoveq %rcx, %rdx
cmpq $0x0, (%rdx)
je 0x186a5
movq %r14, %rdi
callq 0xf24c
xorl %eax, %eax
testl %ebp, %ebp
setne %al
movups (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups %xmm1, 0x10(%r14)
movups %xmm0, (%r14)
shll $0x5, %eax
movq $0x0, 0x40(%rbx,%rax)
movq %r14, %rdi
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf268
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq