// File: /workspace/github_c_makefile_star2_O2/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 0xe47f(%rip), %r13      # 0x24760
movb 0x2a9(%r13), %al
movb %al, 0xb(%rsp)
pushq $0x1
popq %r14
movb $0x1, %al
movl %eax, 0xc(%rsp)
xorl %ebp, %ebp
leaq 0x20(%rsp), %rbx
leaq 0x38(%r13), %rax
movq %rax, 0x18(%rsp)
leaq 0x58(%r13), %rax
movq %rax, 0x10(%rsp)
movl %r14d, %r12d
movq 0x178(%r13), %rax
movq 0x10(%rax), %rdi
cmpl 0xd0(%rdi), %r12d
jg 0x16485
addq $0xd0, %rdi
movl %r12d, %esi
callq 0x9088
movups (%rax), %xmm0
movaps %xmm0, 0x20(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x170(%r13), %rax
movq %rax, 0x38(%rsp)
movq %rbx, %rdi
callq 0xe54f
movq 0x30(%rsp), %rax
xorl %r8d, %r8d
cmpl $0x4, (%rax)
sete 0x2a9(%r13)
jne 0x16387
xorl %ecx, %ecx
cmpl $0x4, 0x4(%rax)
setne %cl
pushq $0x2
popq %r8
movl %ecx, 0xc(%rsp)
subl %ecx, %r8d
andl $0x0, 0x20(%r13)
movl 0x180(%r13), %edx
movl 0x184(%r13), %ecx
movq %rbx, %rdi
movl %r14d, %esi
callq 0xf66d
movq %rbx, %r15
movq %rbx, %rdi
callq 0xe533
movl 0x18(%r13), %ebx
cmpl $0x32, %ebx
jne 0x163c0
andl $0x0, 0x18(%r13)
xorl %ebx, %ebx
movl 0x20(%r13), %eax
orl %ebx, %eax
je 0x1647a
cmpb $0x0, 0x2a9(%r13)
je 0x16447
xorl %eax, %eax
testl %ebx, %ebx
sete %al
movl 0x1c(%r13), %r14d
movl 0x24(%r13), %ebp
shll $0x5, %eax
movl 0x28(%rax,%r13), %esi
leaq 0xe2b4(%rip), %rdi      # 0x246a8
callq 0x9088
movq 0x18(%rax), %rcx
testq %rcx, %rcx
je 0x1642b
testl %ebx, %ebx
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 0x1642d
xorl %ecx, %ecx
movq (%rax), %rdi
movq 0x8(%rax), %rdx
pushq $-0x1
popq %rsi
xorl %r8d, %r8d
callq 0x17f79
movl 0x18(%r13), %ebx
pushq $0x1
popq %r14
testl %ebx, %ebx
je 0x1645d
movl %ebx, 0x6c(%r13)
cmpb $0x0, 0xc(%rsp)
je 0x16473
andl $0x0, 0x18(%r13)
jmp 0x1646e
xorl %ebx, %ebx
subl 0x20(%r13), %ebx
movl %ebx, 0x6c(%r13)
cmpb $0x0, 0xc(%rsp)
je 0x16473
andl $0x0, 0x20(%r13)
movb $0x1, %bpl
testl %ebx, %ebx
jg 0x1648f
incl %r12d
movq %r15, %rbx
jmp 0x16312
testb %bpl, %bpl
jne 0x1648f
andl $0x0, 0x6c(%r13)
movb 0xb(%rsp), %al
movb %al, 0x2a9(%r13)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq