// File: /workspace/github_c_makefile_star2_O1/heltilda[P]cicada/ciclib.c
// Function: cclib_trap
void cclib_trap()
{
    code_ref argCodeRef;
    ccInt counter, codeNo;
    ccBool ifErrorWasTrapped = ccFalse, holdDoPrintError = doPrintError, doClearError = ccTrue;
    
    
        // run each code in our args constructor
    
    for (counter = 1; counter <= BIF_argsView.windowPtr->variable_ptr->codeList.elementNum; counter++)  {
        
        
            // get a handle on the code
        
        argCodeRef = *(code_ref *) element(&(BIF_argsView.windowPtr->variable_ptr->codeList), counter);
        argCodeRef.anchor = pcSearchPath;
        refCodeRef(&argCodeRef);   // in case bE() changes something
        
        doPrintError = (argCodeRef.code_ptr[0] == code_marker);
        if (doPrintError)  {
            doClearError = (argCodeRef.code_ptr[1] != code_marker);
            if (doClearError)  codeNo = 1;
            else  codeNo = 2;       }
        else  codeNo = 0;
        
        
            // run the code
        
        warningCode = passed;
        beginExecution(&argCodeRef, ccTrue, BIF_argsView.offset, BIF_argsView.width, codeNo);
        derefCodeRef(&argCodeRef);
        if (errCode == return_flag)  errCode = passed;
        
        
            // print errors/warnings if we are instructed to do so
        
        if ((errCode != passed) || (warningCode != passed))  {
            
            if (doPrintError)  {
                
                storedCodeType *errorBaseScript;
                ccInt errIndexToPrint, errCharNum = 0;
                code_ref *errScriptToPrint;
                
                if (errCode != passed)  {  errIndexToPrint = errIndex;  errScriptToPrint = &errScript;  }
                else  {  errIndexToPrint = warningIndex;  errScriptToPrint = &warningScript;  }
                
                errorBaseScript = storedCode(errScriptToPrint->PLL_index);
                if (errorBaseScript->opCharNum != NULL)  errCharNum = errorBaseScript->opCharNum[
                                   errIndexToPrint + (ccInt) (errScriptToPrint->code_ptr - errorBaseScript->bytecode) - 1] - 1;
                
                printError(errorBaseScript->fileName, -1, errorBaseScript->sourceCode, errCharNum, ccFalse);       }
            
            if (errCode != passed)  {  intRegister = errCode;  if (doClearError)  errCode = passed;  }
            else  intRegister = -warningCode;
            if (doClearError)  warningCode = passed;
            
            ifErrorWasTrapped = ccTrue;
            if (intRegister > passed)  break;       // break if it was an error that stops execution
    }   }
    
    
        // clear intRegister if no error and no warning
    
    if (!ifErrorWasTrapped)  intRegister = passed;
    
    doPrintError = holdDoPrintError;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
leaq 0xd4d6(%rip), %r12      # 0x25760
movb 0x2a9(%r12), %cl
movq 0x178(%r12), %rax
movq 0x10(%rax), %rdi
cmpl $0x0, 0xd0(%rdi)
jle 0x1846e
movb %cl, 0xf(%rsp)
addq $0xd0, %rdi
movb $0x1, %r13b
xorl %ebx, %ebx
leaq 0x20(%rsp), %r14
leaq 0x38(%r12), %rax
movq %rax, 0x18(%rsp)
leaq 0x58(%r12), %rax
movq %rax, 0x10(%rsp)
xorl %ebp, %ebp
incl %ebx
movl %ebx, %esi
callq 0x911c
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movaps %xmm1, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movq 0x170(%r12), %rax
movq %rax, 0x38(%rsp)
movq %r14, %rdi
callq 0xf268
movq 0x30(%rsp), %rax
cmpl $0x4, (%rax)
sete 0x2a9(%r12)
movl $0x0, %r8d
jne 0x18332
xorl %r13d, %r13d
cmpl $0x4, 0x4(%rax)
setne %r13b
movl $0x2, %r8d
subl %r13d, %r8d
movl $0x0, 0x20(%r12)
movl 0x180(%r12), %edx
movl 0x184(%r12), %ecx
movq %r14, %rdi
movl $0x1, %esi
callq 0x10502
movq %r14, %rdi
callq 0xf24c
cmpl $0x32, 0x18(%r12)
jne 0x18371
movl $0x0, 0x18(%r12)
movl 0x18(%r12), %r15d
movl 0x20(%r12), %eax
orl %r15d, %eax
je 0x18446
cmpb $0x0, 0x2a9(%r12)
je 0x18403
xorl %eax, %eax
testl %r15d, %r15d
sete %al
movl 0x1c(%r12), %r14d
movl 0x24(%r12), %ebp
shll $0x5, %eax
movl 0x28(%rax,%r12), %esi
leaq 0xd2f8(%rip), %rdi      # 0x256a8
callq 0x911c
movq 0x18(%rax), %rcx
testq %rcx, %rcx
je 0x183e8
testl %r15d, %r15d
cmovnel %r14d, %ebp
movq 0x10(%rsp), %rdx
cmovneq 0x18(%rsp), %rdx
movq (%rdx), %rdx
subq 0x10(%rax), %rdx
shrq $0x2, %rdx
addl %ebp, %edx
movslq %edx, %rdx
movl -0x4(%rcx,%rdx,4), %ecx
decl %ecx
jmp 0x183ea
xorl %ecx, %ecx
movq (%rax), %rdi
movq 0x8(%rax), %rdx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %r8d, %r8d
callq 0x1a232
leaq 0x20(%rsp), %r14
movl 0x18(%r12), %eax
testl %eax, %eax
je 0x18421
movl %eax, 0x6c(%r12)
testb %r13b, %r13b
je 0x1843b
movl $0x0, 0x18(%r12)
jmp 0x1842d
xorl %eax, %eax
subl 0x20(%r12), %eax
movl %eax, 0x6c(%r12)
testb %r13b, %r13b
je 0x1843b
movl $0x0, 0x20(%r12)
movb $0x1, %bpl
cmpl $0x0, 0x6c(%r12)
jg 0x18465
movq 0x178(%r12), %rax
movq 0x10(%rax), %rax
leaq 0xd0(%rax), %rdi
cmpl 0xd0(%rax), %ebx
jl 0x182d6
testb %bpl, %bpl
movb 0xf(%rsp), %cl
jne 0x18477
movl $0x0, 0x6c(%r12)
movb %cl, 0x2a9(%r12)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq