// File: /workspace/github_c_makefile_star2_O2/msteveb[P]autosetup/./jimsh0.c
// Function: JimCatchTryHelper
static int JimCatchTryHelper(Jim_Interp *interp, int istry, int argc, Jim_Obj *const *argv)
{
    static const char * const wrongargs_catchtry[2] = {
        "?-?no?code ... --? script ?resultVarName? ?optionVarName?",
        "?-?no?code ... --? script ?on|trap codes vars script? ... ?finally script?"
    };
    int exitCode = 0;
    int i;
    int sig = 0;
    int ok;
    Jim_Obj *finallyScriptObj = NULL;
    Jim_Obj *msgVarObj = NULL;
    Jim_Obj *optsVarObj = NULL;
    Jim_Obj *handlerScriptObj = NULL;
    Jim_Obj *errorCodeObj;
    int idx;


    jim_wide ignore_mask = (1 << JIM_EXIT) | (1 << JIM_EVAL) | (1 << JIM_SIGNAL);
    static const int max_ignore_code = sizeof(ignore_mask) * 8;

    JimPanic((istry != 0 && istry != 1, "wrong args to JimCatchTryHelper"));

    Jim_SetGlobalVariableStr(interp, "errorCode", Jim_NewStringObj(interp, "NONE", -1));

    for (i = 1; i < argc - 1; i++) {
        const char *arg = Jim_String(argv[i]);
        jim_wide option;
        int ignore;


        if (strcmp(arg, "--") == 0) {
            i++;
            break;
        }
        if (*arg != '-') {
            break;
        }

        if (strncmp(arg, "-no", 3) == 0) {
            arg += 3;
            ignore = 1;
        }
        else {
            arg++;
            ignore = 0;
        }

        if (Jim_StringToWide(arg, &option, 10) != JIM_OK) {
            option = -1;
        }
        if (option < 0) {
            option = Jim_FindByName(arg, jimReturnCodes, jimReturnCodesSize);
        }
        if (option < 0) {
            goto wrongargs;
        }

        if (ignore) {
            ignore_mask |= ((jim_wide)1 << option);
        }
        else {
            ignore_mask &= (~((jim_wide)1 << option));
        }
    }

    idx = i;

    if (argc - idx < 1) {
wrongargs:
        Jim_WrongNumArgs(interp, 1, argv, wrongargs_catchtry[istry]);
        return JIM_ERR;
    }

    if ((ignore_mask & (1 << JIM_SIGNAL)) == 0) {
        sig++;
    }

    interp->signal_level += sig;
    if (Jim_CheckSignal(interp)) {

        exitCode = JIM_SIGNAL;
    }
    else {
        exitCode = Jim_EvalObj(interp, argv[idx]);

        interp->errorFlag = 0;
    }
    interp->signal_level -= sig;

    errorCodeObj = Jim_GetGlobalVariableStr(interp, "errorCode", JIM_NONE);

    idx++;
    if (istry) {
        while (idx < argc) {
            int option;
            int ret;
            static const char * const try_options[] = { "on", "trap", "finally", NULL };
            enum { TRY_ON, TRY_TRAP, TRY_FINALLY, };

            if (Jim_GetEnum(interp, argv[idx], try_options, &option, "handler", JIM_ERRMSG) != JIM_OK) {
                return JIM_ERR;
            }
            switch (option) {
                case TRY_ON:
                case TRY_TRAP:
                    if (idx + 4 > argc) {
                        goto wrongargs;
                    }
                    if (option == TRY_ON) {
                        ret = JimMatchReturnCodes(interp, argv[idx + 1], exitCode);
                        if (ret > JIM_OK) {
                            goto wrongargs;
                        }
                    }
                    else if (errorCodeObj) {
                        int len = Jim_ListLength(interp, argv[idx + 1]);
                        int i;

                        ret = JIM_OK;

                        for (i = 0; i < len; i++) {
                            Jim_Obj *matchObj = Jim_ListGetIndex(interp, argv[idx + 1], i);
                            Jim_Obj *objPtr = Jim_ListGetIndex(interp, errorCodeObj, i);
                            if (Jim_StringCompareObj(interp, matchObj, objPtr, 0) != 0) {
                                ret = -1;
                                break;
                            }
                        }
                    }
                    else {

                        ret = -1;
                    }

                    if (ret == JIM_OK && handlerScriptObj == NULL) {
                        msgVarObj = Jim_ListGetIndex(interp, argv[idx + 2], 0);
                        optsVarObj = Jim_ListGetIndex(interp, argv[idx + 2], 1);
                        handlerScriptObj = argv[idx + 3];
                    }
                    idx += 4;
                    break;
                case TRY_FINALLY:
                    if (idx + 2 != argc) {
                        goto wrongargs;
                    }
                    finallyScriptObj = argv[idx + 1];
                    idx += 2;
                    break;
            }
        }
    }
    else {
        if (argc - idx >= 1) {
            msgVarObj = argv[idx];
            idx++;
            if (argc - idx >= 1) {
                optsVarObj = argv[idx];
                idx++;
            }
        }
    }


    if (exitCode >= 0 && exitCode < max_ignore_code && (((unsigned jim_wide)1 << exitCode) & ignore_mask)) {

        if (finallyScriptObj) {
            Jim_EvalObj(interp, finallyScriptObj);
        }
        return exitCode;
    }

    if (sig && exitCode == JIM_SIGNAL) {

        if (interp->signal_set_result) {
            interp->signal_set_result(interp, interp->sigmask);
        }
        else if (!istry) {
            Jim_SetResultInt(interp, interp->sigmask);
        }
        interp->sigmask = 0;
    }

    ok = 1;
    if (msgVarObj && Jim_Length(msgVarObj)) {
        if (Jim_SetVariable(interp, msgVarObj, Jim_GetResult(interp)) != JIM_OK) {
            ok = 0;
        }
    }
    if (ok && optsVarObj && Jim_Length(optsVarObj)) {
        Jim_Obj *optListObj = Jim_NewListObj(interp, NULL, 0);

        Jim_ListAppendElement(interp, optListObj, Jim_NewStringObj(interp, "-code", -1));
        Jim_ListAppendElement(interp, optListObj,
            Jim_NewIntObj(interp, exitCode == JIM_RETURN ? interp->returnCode : exitCode));
        Jim_ListAppendElement(interp, optListObj, Jim_NewStringObj(interp, "-level", -1));
        Jim_ListAppendElement(interp, optListObj, Jim_NewIntObj(interp, interp->returnLevel));
        if (exitCode == JIM_ERR) {
            Jim_ListAppendElement(interp, optListObj, Jim_NewStringObj(interp, "-errorinfo",
                -1));
            Jim_ListAppendElement(interp, optListObj, interp->stackTrace);

            if (errorCodeObj) {
                Jim_ListAppendElement(interp, optListObj, Jim_NewStringObj(interp, "-errorcode", -1));
                Jim_ListAppendElement(interp, optListObj, errorCodeObj);
            }
        }
        if (Jim_SetVariable(interp, optsVarObj, optListObj) != JIM_OK) {
            ok = 0;
        }
    }
    if (ok && handlerScriptObj) {

        exitCode = Jim_EvalObj(interp, handlerScriptObj);
    }

    if (finallyScriptObj) {

        Jim_Obj *prevResultObj = Jim_GetResult(interp);
        Jim_IncrRefCount(prevResultObj);
        int ret = Jim_EvalObj(interp, finallyScriptObj);
        if (ret == JIM_OK) {
            Jim_SetResult(interp, prevResultObj);
        }
        else {
            exitCode = ret;
        }
        Jim_DecrRefCount(interp, prevResultObj);
    }
    if (!istry) {
        Jim_SetResultInt(interp, exitCode);
        exitCode = JIM_OK;
    }
    return exitCode;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rcx, -0x30(%rbp)
movl %edx, %r14d
movl %esi, -0x54(%rbp)
movq %rdi, %rbx
leaq 0x75ab(%rip), %rsi      # 0x279e9
pushq $-0x1
popq %rdx
callq 0x7363
leaq 0x7592(%rip), %rsi      # 0x279df
movq %rbx, -0x50(%rbp)
movq %rbx, %rdi
movq %rax, %rdx
callq 0xb985
movq %r14, -0x60(%rbp)
leal -0x1(%r14), %eax
cltq
movq %rax, -0x78(%rbp)
movl $0xe0, %r14d
pushq $0x1
popq %r15
pushq $0x2
popq %r13
cmpq -0x78(%rbp), %r15
jge 0x20535
movq -0x30(%rbp), %rax
movq (%rax,%r15,8), %rdi
callq 0x7340
cmpb $0x2d, (%rax)
jne 0x20542
movq %rax, %r12
cmpb $0x2d, 0x1(%rax)
jne 0x204ad
cmpb $0x0, 0x2(%r12)
je 0x20545
cmpb $0x6e, 0x1(%r12)
jne 0x204ca
xorl %ebx, %ebx
cmpb $0x6f, 0x2(%r12)
sete %bl
leaq 0x1(,%rbx,2), %rax
jmp 0x204cf
xorl %ebx, %ebx
pushq $0x1
popq %rax
addq %rax, %r12
movq %r12, %rdi
leaq -0x88(%rbp), %rsi
pushq $0xa
popq %rdx
callq 0x9d27
testl %eax, %eax
setne %cl
movq -0x88(%rbp), %rax
testq %rax, %rax
sets %dl
orb %cl, %dl
cmpb $0x1, %dl
jne 0x20519
movq %r12, %rdi
leaq 0x10f79(%rip), %rsi     # 0x31480
pushq $0x8
popq %rdx
callq 0x10610
testl %eax, %eax
js 0x2083f
cltq
movq %r14, %rcx
btrq %rax, %rcx
btsq %rax, %r14
testb %bl, %bl
cmoveq %rcx, %r14
incq %r15
incl %r13d
jmp 0x20478
movl %r15d, %r13d
movq -0x50(%rbp), %r15
movq -0x60(%rbp), %rax
jmp 0x2054d
movl %r15d, %r13d
movq -0x60(%rbp), %rax
movq -0x50(%rbp), %r15
cmpl %eax, %r13d
jge 0x20843
xorl %ebx, %ebx
testb $0x20, %r14b
sete %bl
movl 0x40(%r15), %eax
addl %ebx, %eax
movl %eax, 0x40(%r15)
je 0x2057b
cmpq $0x0, 0x48(%r15)
je 0x2057b
pushq $0x5
popq %rcx
movq %rcx, -0x48(%rbp)
jmp 0x2059e
movslq %r13d, %rax
movq -0x30(%rbp), %rcx
movq (%rcx,%rax,8), %rsi
movq %r15, %rdi
callq 0x8b54
movq %rax, -0x48(%rbp)
andl $0x0, 0x1b4(%r15)
movl 0x40(%r15), %eax
subl %ebx, %eax
movl %eax, 0x40(%r15)
leaq 0x7434(%rip), %rsi      # 0x279df
movq %r15, %rdi
xorl %edx, %edx
callq 0xbca9
movq %rax, -0x80(%rbp)
leal 0x1(%r13), %ecx
cmpl $0x0, -0x54(%rbp)
movq %r14, -0xa0(%rbp)
je 0x20879
pushq $0x1
popq %r14
xorl %r13d, %r13d
xorl %ebx, %ebx
movq $0x0, -0x98(%rbp)
movq $0x0, -0x68(%rbp)
movq -0x30(%rbp), %rax
cmpl -0x60(%rbp), %ecx
jge 0x208ae
movl %ecx, %r12d
movslq %ecx, %rcx
movq %rcx, -0x78(%rbp)
movq (%rax,%rcx,8), %rsi
movq %r15, %rdi
leaq 0x120b1(%rip), %rdx     # 0x326c0
leaq -0x8c(%rbp), %rcx
leaq 0x885e(%rip), %r8       # 0x28e7b
movl %r14d, %r9d
callq 0x7b44
testl %eax, %eax
jne 0x20867
movl -0x8c(%rbp), %eax
cmpl $0x2, %eax
jae 0x206f4
movq %rbx, -0x40(%rbp)
movq %r13, -0x70(%rbp)
movl %r12d, %ecx
addl $0x4, %ecx
cmpl -0x60(%rbp), %ecx
jg 0x20843
testl %eax, %eax
je 0x20727
cmpq $0x0, -0x80(%rbp)
movq -0x30(%rbp), %rax
je 0x207b1
movl %ecx, -0x34(%rbp)
movq -0x78(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rsi
movq %r15, %rdi
callq 0x8b3c
movl %eax, %r15d
xorl %r14d, %r14d
testl %eax, %eax
cmovlel %r14d, %r15d
xorl %r12d, %r12d
cmpl %r12d, %r15d
je 0x207c2
movq -0x30(%rbp), %rax
movq -0x78(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rsi
movq -0x50(%rbp), %rbx
movq %rbx, %rdi
movl %r12d, %edx
callq 0xd95e
movq %rax, %r13
movq %rbx, %rdi
movq -0x80(%rbp), %rsi
movl %r12d, %edx
callq 0xd95e
movq %r13, %rsi
movq %rax, %rdx
xorl %ecx, %ecx
callq 0xaa82
incl %r12d
testl %eax, %eax
je 0x2068d
movq -0x50(%rbp), %r15
movq -0x70(%rbp), %r13
movq -0x40(%rbp), %rbx
movq -0x30(%rbp), %rax
pushq $0x1
popq %r14
movl -0x34(%rbp), %ecx
jmp 0x205ee
movl %r12d, %ecx
jne 0x205ea
addl $0x2, %ecx
cmpl -0x60(%rbp), %ecx
jne 0x20843
movq -0x30(%rbp), %rax
movq -0x78(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rcx
movq %rcx, -0x68(%rbp)
movq -0x60(%rbp), %rcx
pushq $0x1
popq %r14
jmp 0x205ee
movl %ecx, -0x34(%rbp)
movq -0x30(%rbp), %rax
movq -0x78(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x8b3c
movl %eax, %r15d
xorl %r13d, %r13d
testl %eax, %eax
cmovlel %r13d, %r15d
cmpl %r13d, %r15d
je 0x206d8
movq -0x50(%rbp), %r14
movq %r14, %rdi
movq %r12, %rsi
movl %r13d, %edx
callq 0xd95e
movq %r14, %rdi
movq %rax, %rsi
leaq -0x88(%rbp), %rdx
callq 0xe9c5
movl -0x88(%rbp), %ecx
movq -0x48(%rbp), %rdx
cmpl %edx, %ecx
movl %ebx, %r14d
movl $0x0, %esi
cmovel %esi, %r14d
pushq $0x1
popq %rbx
testl %eax, %eax
cmovel %r14d, %ebx
jne 0x207a1
incl %r13d
cmpl %edx, %ecx
jne 0x2074e
testl %ebx, %ebx
movq -0x50(%rbp), %r15
movl -0x34(%rbp), %ecx
jle 0x207c9
jmp 0x20843
movq -0x70(%rbp), %r13
movq -0x40(%rbp), %rbx
pushq $0x1
popq %r14
jmp 0x205ee
movq -0x50(%rbp), %r15
movl -0x34(%rbp), %ecx
testl %r14d, %r14d
jne 0x2082a
movq -0x70(%rbp), %r13
testq %r13, %r13
movq -0x40(%rbp), %rbx
movq -0x30(%rbp), %rax
pushq $0x1
popq %r14
jne 0x205ee
movq -0x78(%rbp), %r12
movq 0x10(%rax,%r12,8), %rsi
movq %r15, %rdi
xorl %edx, %edx
movl %ecx, %ebx
callq 0xd95e
movq %rax, -0x98(%rbp)
movq -0x30(%rbp), %rax
movq 0x10(%rax,%r12,8), %rsi
movq %r15, %rdi
movl %r14d, %edx
callq 0xd95e
movl %ebx, %ecx
movq %rax, %rbx
movq -0x30(%rbp), %rax
movq 0x18(%rax,%r12,8), %r13
jmp 0x205ee
movq -0x70(%rbp), %r13
movq -0x40(%rbp), %rbx
movq -0x30(%rbp), %rax
pushq $0x1
popq %r14
jmp 0x205ee
movq -0x50(%rbp), %r15
pushq $0x1
popq %r14
movl -0x54(%rbp), %eax
leaq 0x2efb(%rip), %rdx      # 0x2374c
movslq (%rdx,%rax,4), %rcx
addq %rdx, %rcx
movq %r15, %rdi
movl %r14d, %esi
movq -0x30(%rbp), %rdx
callq 0x72a5
movl %r14d, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x60(%rbp), %rax
cmpl %eax, %ecx
jge 0x208bb
movq %rax, %rdx
movslq %ecx, %rax
movq -0x30(%rbp), %rcx
movq (%rcx,%rax,8), %rdi
movq %rcx, %rax
addl $0x2, %r13d
cmpl %edx, %r13d
movq -0x48(%rbp), %rcx
jge 0x208d0
movq %rax, %rdx
movslq %r13d, %rax
movq (%rdx,%rax,8), %rbx
xorl %r13d, %r13d
jmp 0x208d5
movq -0x48(%rbp), %rcx
movq -0x98(%rbp), %rdi
jmp 0x208dd
xorl %r13d, %r13d
xorl %ebx, %ebx
xorl %edi, %edi
movq $0x0, -0x68(%rbp)
movq -0x48(%rbp), %rcx
jmp 0x208dd
xorl %r13d, %r13d
xorl %ebx, %ebx
movq $0x0, -0x68(%rbp)
cmpl $0x3f, %ecx
ja 0x2097b
movq -0xa0(%rbp), %rax
btq %rcx, %rax
jae 0x2090f
movq -0x68(%rbp), %rsi
testq %rsi, %rsi
je 0x2092f
movq %r15, %rdi
movq %rcx, %rbx
callq 0x8b54
movl %ebx, %r14d
jmp 0x20867
movq %rdi, %r14
testb $0x20, %al
jne 0x2097b
cmpl $0x5, %ecx
jne 0x2097b
movq 0x50(%r15), %rax
testq %rax, %rax
je 0x20937
movq 0x48(%r15), %rsi
movq %r15, %rdi
callq *%rax
jmp 0x20973
movl %ecx, %r14d
jmp 0x20867
cmpl $0x0, -0x54(%rbp)
jne 0x20973
movq %rbx, -0x40(%rbp)
movq 0x48(%r15), %rsi
movq %r15, %rdi
callq 0x8212
movq %rax, %rbx
incl 0x10(%rax)
movq (%r15), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x2096c
movq %r15, %rdi
callq 0x73bf
movq %rbx, (%r15)
movq -0x40(%rbp), %rbx
andq $0x0, 0x48(%r15)
movq %r14, %rdi
movq %r13, -0x70(%rbp)
movq %rbx, -0x40(%rbp)
pushq $0x1
popq %r14
movb $0x1, %bl
testq %rdi, %rdi
je 0x209b4
movq %rdi, %r13
callq 0xa61a
testl %eax, %eax
je 0x209b4
movq (%r15), %rdx
movq %r15, %rdi
movq %r13, %rsi
callq 0x8306
movl %eax, %r14d
testl %eax, %eax
sete %bl
xorl $0x1, %r14d
testb %bl, %bl
je 0x20af1
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x20af1
callq 0xa61a
testl %eax, %eax
je 0x20aed
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x745b
movq %rax, %r14
leaq 0x7445(%rip), %rsi      # 0x27e31
pushq $-0x1
popq %rdx
movq %r15, %rdi
callq 0x7363
movq %r15, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x74ad
movq -0x48(%rbp), %rcx
movl %ecx, %eax
cmpl $0x2, %ecx
jne 0x20a14
movl 0x28(%r15), %eax
movslq %eax, %rsi
movq %r15, %rdi
callq 0x8212
movq %r15, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x74ad
leaq 0x80ad(%rip), %rsi      # 0x28ae1
pushq $-0x1
popq %rdx
movq %r15, %rdi
callq 0x7363
movq %r15, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x74ad
movslq 0x2c(%r15), %rsi
movq %r15, %rdi
callq 0x8212
movq %r15, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x74ad
cmpl $0x1, -0x48(%rbp)
jne 0x20ad5
leaq 0x8057(%rip), %rsi      # 0x28acb
pushq $-0x1
popq %rdx
movq %r15, %rdi
callq 0x7363
movq %r15, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x74ad
movq 0x188(%r15), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x74ad
cmpq $0x0, -0x80(%rbp)
je 0x20ad5
leaq 0x8029(%rip), %rsi      # 0x28ad6
pushq $-0x1
popq %rdx
movq %r15, %rdi
callq 0x7363
movq %r15, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x74ad
movq %r15, %rdi
movq %r14, %rsi
movq -0x80(%rbp), %rdx
callq 0x74ad
movq %r15, %rdi
movq -0x40(%rbp), %rsi
movq %r14, %rdx
callq 0x8306
movl %eax, %r14d
xorl $0x1, %r14d
jmp 0x20af1
pushq $0x1
popq %r14
testl %r14d, %r14d
movq -0x68(%rbp), %rcx
je 0x20b15
movq -0x70(%rbp), %rsi
testq %rsi, %rsi
movq -0x48(%rbp), %rax
je 0x20b19
movq %r15, %rdi
callq 0x8b54
movq -0x68(%rbp), %rcx
jmp 0x20b19
movq -0x48(%rbp), %rax
testq %rcx, %rcx
je 0x20b7d
movq %rax, %rbx
movq (%r15), %r14
incl 0x10(%r14)
movq %r15, %rdi
movq %rcx, %rsi
callq 0x8b54
movl %eax, %r12d
testl %eax, %eax
jne 0x20b5d
incl 0x10(%r14)
movq (%r15), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x20b57
movq %r15, %rdi
callq 0x73bf
movq %r14, (%r15)
movl %ebx, %r12d
movl 0x10(%r14), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%r14)
cmpl $0x1, %eax
jg 0x20b78
movq %r15, %rdi
movq %r14, %rsi
callq 0x73bf
movl %r12d, %r14d
jmp 0x20b80
movl %eax, %r14d
cmpl $0x0, -0x54(%rbp)
jne 0x20867
movslq %r14d, %rsi
movq %r15, %rdi
callq 0x8212
movq %rax, %r14
incl 0x10(%rax)
movq (%r15), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x20bb4
movq %r15, %rdi
callq 0x73bf
movq %r14, (%r15)
xorl %r14d, %r14d
jmp 0x20867