// File: /workspace/github_c_makefile_star2_O1/msteveb[P]autosetup/./jimsh0.c
// Function: Jim_SwitchCoreCommand
static int Jim_SwitchCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
    enum { SWITCH_EXACT, SWITCH_GLOB, SWITCH_RE, SWITCH_CMD };
    int matchOpt = SWITCH_EXACT, opt = 1, patCount, i;
    int match_flags = 0;
    Jim_Obj *command = NULL, *scriptObj = NULL, *strObj;
    Jim_Obj **caseList;

    if (argc < 3) {
      wrongnumargs:
        Jim_WrongNumArgs(interp, 1, argv, "?options? string "
            "pattern body ... ?default body?   or   " "{pattern body ?pattern body ...?}");
        return JIM_ERR;
    }
    for (opt = 1; opt < argc; ++opt) {
        const char *option = Jim_String(argv[opt]);

        if (*option != '-')
            break;
        else if (strncmp(option, "--", 2) == 0) {
            ++opt;
            break;
        }
        else if (strncmp(option, "-exact", 2) == 0)
            matchOpt = SWITCH_EXACT;
        else if (strncmp(option, "-glob", 2) == 0)
            matchOpt = SWITCH_GLOB;
        else if (strncmp(option, "-regexp", 2) == 0) {
            matchOpt = SWITCH_RE;
            match_flags |= JIM_OPT_END;
        }
        else if (strncmp(option, "-command", 2) == 0) {
            matchOpt = SWITCH_CMD;
            if ((argc - opt) < 2)
                goto wrongnumargs;
            command = argv[++opt];
        }
        else {
            Jim_SetResultFormatted(interp,
                "bad option \"%#s\": must be -exact, -glob, -regexp, -command procname or --",
                argv[opt]);
            return JIM_ERR;
        }
        if ((argc - opt) < 2)
            goto wrongnumargs;
    }
    strObj = argv[opt++];
    patCount = argc - opt;
    if (patCount == 1) {
        JimListGetElements(interp, argv[opt], &patCount, &caseList);
    }
    else
        caseList = (Jim_Obj **)&argv[opt];
    if (patCount == 0 || patCount % 2 != 0)
        goto wrongnumargs;
    for (i = 0; scriptObj == NULL && i < patCount; i += 2) {
        Jim_Obj *patObj = caseList[i];

        if (!Jim_CompareStringImmediate(interp, patObj, "default")
            || i < (patCount - 2)) {
            switch (matchOpt) {
                case SWITCH_EXACT:
                    if (Jim_StringEqObj(strObj, patObj))
                        scriptObj = caseList[i + 1];
                    break;
                case SWITCH_GLOB:
                    if (Jim_StringMatchObj(interp, patObj, strObj, 0))
                        scriptObj = caseList[i + 1];
                    break;
                case SWITCH_RE:
                    command = Jim_NewStringObj(interp, "regexp", -1);

                case SWITCH_CMD:{
                        int rc = Jim_CommandMatchObj(interp, command, patObj, strObj, match_flags);

                        if (argc - opt == 1) {
                            JimListGetElements(interp, argv[opt], &patCount, &caseList);
                        }

                        if (rc < 0) {
                            return -rc;
                        }
                        if (rc)
                            scriptObj = caseList[i + 1];
                        break;
                    }
            }
        }
        else {
            scriptObj = caseList[i + 1];
        }
    }
    for (; i < patCount && Jim_CompareStringImmediate(interp, scriptObj, "-"); i += 2)
        scriptObj = caseList[i + 1];
    if (scriptObj && Jim_CompareStringImmediate(interp, scriptObj, "-")) {
        Jim_SetResultFormatted(interp, "no body specified for pattern \"%#s\"", caseList[i - 2]);
        return JIM_ERR;
    }
    Jim_SetEmptyResult(interp);
    if (scriptObj) {
        return Jim_EvalObj(interp, scriptObj);
    }
    return JIM_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, -0x48(%rbp)
movq %rdi, -0x40(%rbp)
cmpl $0x3, %esi
jl 0x1d026
movl $0x1, %r14d
movl $0x0, -0x38(%rbp)
movl $0x0, -0x4c(%rbp)
movq $0x0, -0x60(%rbp)
movl %esi, -0x2c(%rbp)
movslq %r14d, %r15
movq -0x48(%rbp), %rax
movq (%rax,%r15,8), %rbx
cmpq $0x0, (%rbx)
jne 0x1cd3b
movq 0x8(%rbx), %rax
movq %rbx, %rdi
callq *0x18(%rax)
movl -0x2c(%rbp), %esi
movq (%rbx), %r12
movl $0x3, %r13d
cmpb $0x2d, (%r12)
jne 0x1ce27
movl $0x2, %edx
movq %r12, %rdi
leaq 0x108bf(%rip), %rsi     # 0x2d61d
callq 0x60b0
testl %eax, %eax
je 0x1cded
movl $0x2, %edx
movq %r12, %rdi
leaq 0x10847(%rip), %rsi     # 0x2d5c1
callq 0x60b0
testl %eax, %eax
je 0x1cdf5
movl $0x2, %edx
movq %r12, %rdi
leaq 0x10836(%rip), %rsi     # 0x2d5c8
callq 0x60b0
testl %eax, %eax
je 0x1cdfe
movl $0x2, %edx
movq %r12, %rdi
leaq 0x10824(%rip), %rsi     # 0x2d5ce
callq 0x60b0
testl %eax, %eax
je 0x1ce07
movl $0x2, %edx
movq %r12, %rdi
leaq 0xed66(%rip), %rsi      # 0x2bb28
callq 0x60b0
testl %eax, %eax
je 0x1ce3a
movq -0x48(%rbp), %rax
movq (%rax,%r15,8), %rdx
movq -0x40(%rbp), %rdi
leaq 0x107f8(%rip), %rsi     # 0x2d5d6
xorl %eax, %eax
callq 0x692d
movl $0x1, %r13d
jmp 0x1cdf0
incl %r14d
movl -0x2c(%rbp), %esi
jmp 0x1ce27
movl $0x0, -0x38(%rbp)
jmp 0x1ce12
movl $0x1, -0x38(%rbp)
jmp 0x1ce12
orl $0x2, -0x4c(%rbp)
movl $0x2, -0x38(%rbp)
movl -0x2c(%rbp), %esi
movl %esi, %eax
subl %r14d, %eax
xorl %r13d, %r13d
cmpl $0x2, %eax
setl %r13b
addl %r13d, %r13d
testl %r13d, %r13d
jne 0x1ce6f
incl %r14d
cmpl %esi, %r14d
jl 0x1cd1d
jmp 0x1ce83
movl -0x2c(%rbp), %esi
movl %esi, %eax
subl %r14d, %eax
cmpl $0x2, %eax
jge 0x1ce56
movl $0x3, -0x38(%rbp)
movl $0x2, %r13d
jmp 0x1ce27
incl %r14d
movq -0x48(%rbp), %rax
movq 0x8(%rax,%r15,8), %rax
movq %rax, -0x60(%rbp)
movl $0x3, -0x38(%rbp)
jmp 0x1ce15
cmpl $0x1, %r13d
je 0x1d045
cmpl $0x2, %r13d
je 0x1d026
movslq %r14d, %rax
incl %r14d
movq -0x48(%rbp), %rcx
leaq (%rcx,%rax,8), %rbx
addq $0x8, %rbx
movq -0x8(%rbx), %rax
movq %rax, -0x58(%rbp)
subl %r14d, %esi
cmpl $0x1, %esi
movl %esi, -0x2c(%rbp)
jne 0x1cec1
movq (%rbx), %rbx
movq -0x40(%rbp), %rdi
movq %rbx, %rsi
callq 0xe338
movl 0x20(%rbx), %r15d
movq 0x18(%rbx), %rbx
jmp 0x1cec4
movl %esi, %r15d
testl %r15d, %r15d
sete %al
movl %r15d, %ecx
orb %al, %cl
testb $0x1, %cl
jne 0x1d026
testl %r15d, %r15d
jle 0x1d057
movslq %r14d, %rax
movq %rax, -0x68(%rbp)
movl $0x1, %r13d
xorl %r14d, %r14d
movl -0x38(%rbp), %eax
movq %rax, -0x70(%rbp)
movq (%rbx,%r14,8), %r12
movq -0x40(%rbp), %rdi
movq %r12, %rsi
leaq 0x10fd7(%rip), %rdx     # 0x2dee1
callq 0x73d6
testl %eax, %eax
je 0x1cf2a
leal -0x2(%r15), %eax
cltq
cmpq %rax, %r14
jl 0x1cf2a
movq 0x8(%rbx,%r14,8), %r12
movb $0x1, %cl
jmp 0x1d00e
movq -0x70(%rbp), %rax
leaq 0xb53f(%rip), %rcx      # 0x28474
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x58(%rbp), %rdi
movq %r12, %rsi
callq 0xb0b4
jmp 0x1cfe8
movq %r15, -0x38(%rbp)
movq %rbx, %r15
movq -0x40(%rbp), %rbx
movq %rbx, %rdi
leaq 0x1066b(%rip), %rsi     # 0x2d5cf
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7516
jmp 0x1cf7f
movq %r15, -0x38(%rbp)
movq %rbx, %r15
movq -0x40(%rbp), %rbx
movq -0x60(%rbp), %rax
movq %rbx, %rdi
movq %rax, -0x60(%rbp)
movq %rax, %rsi
movq %r12, %rdx
movq -0x58(%rbp), %rcx
movl -0x4c(%rbp), %r8d
callq 0x11589
movl %eax, %ebx
cmpl $0x1, -0x2c(%rbp)
jne 0x1cfc7
movq -0x48(%rbp), %rax
movq -0x68(%rbp), %rcx
movq (%rax,%rcx,8), %r12
movq -0x40(%rbp), %rdi
movq %r12, %rsi
callq 0xe338
movl 0x20(%r12), %eax
movq %rax, -0x38(%rbp)
movq 0x18(%r12), %r15
testl %ebx, %ebx
setns %cl
js 0x1cff5
je 0x1d004
movq %r15, %rbx
movq 0x8(%r15,%r14,8), %r12
jmp 0x1d00a
movq %r12, %rsi
movq -0x58(%rbp), %rdx
xorl %ecx, %ecx
callq 0xb120
movb $0x1, %cl
testl %eax, %eax
je 0x1cfff
movq 0x8(%rbx,%r14,8), %r12
jmp 0x1d00e
negl %ebx
xorl %r12d, %r12d
movl %ebx, %r13d
jmp 0x1d007
xorl %r12d, %r12d
jmp 0x1d00e
xorl %r12d, %r12d
movq %r15, %rbx
movq -0x38(%rbp), %r15
testb %cl, %cl
je 0x1d045
addq $0x2, %r14
testq %r12, %r12
jne 0x1d05d
cmpl %r14d, %r15d
jg 0x1cef8
jmp 0x1d05d
leaq 0x1053a(%rip), %rcx     # 0x2d567
movl $0x1, %r13d
movq -0x40(%rbp), %rdi
movl $0x1, %esi
movq -0x48(%rbp), %rdx
callq 0x7454
movl %r13d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r12d, %r12d
xorl %r14d, %r14d
movq %r15, %r13
cmpl %r15d, %r14d
movq -0x40(%rbp), %r15
jge 0x1d090
movl %r14d, %r14d
movq %r15, %rdi
movq %r12, %rsi
leaq 0xfe93(%rip), %rdx      # 0x2cf0c
callq 0x73d6
testl %eax, %eax
je 0x1d090
movq 0x8(%rbx,%r14,8), %r12
addq $0x2, %r14
cmpl %r14d, %r13d
jg 0x1d06c
testq %r12, %r12
je 0x1d0cf
leaq 0xfe70(%rip), %rdx      # 0x2cf0c
movq %r15, %rdi
movq %r12, %rsi
callq 0x73d6
testl %eax, %eax
je 0x1d0cf
movl %r14d, %eax
movq -0x10(%rbx,%rax,8), %rdx
leaq 0x10566(%rip), %rsi     # 0x2d620
movq %r15, %rdi
xorl %eax, %eax
callq 0x692d
movl $0x1, %r13d
jmp 0x1d045
movq 0x128(%r15), %rbx
incl 0x10(%rbx)
movq (%r15), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x1d0f2
movq %r15, %rdi
callq 0x759a
movq %rbx, (%r15)
testq %r12, %r12
je 0x1d113
movq %r15, %rdi
movq %r12, %rsi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9078
xorl %r13d, %r13d
jmp 0x1d045