// File: /workspace/github_c_makefile_star2_O2/msteveb[P]autosetup/./jimsh0.c
// Function: Jim_ParseSubCmd
const jim_subcmd_type *Jim_ParseSubCmd(Jim_Interp *interp, const jim_subcmd_type * command_table,
    int argc, Jim_Obj *const *argv)
{
    const jim_subcmd_type *ct;
    const jim_subcmd_type *partial = 0;
    int cmdlen;
    Jim_Obj *cmd;
    const char *cmdstr;
    int help = 0;
    int argsok = 1;

    if (argc < 2) {
        Jim_SetResultFormatted(interp, "wrong # args: should be \"%#s command ...\"\n"
            "Use \"%#s -help ?command?\" for help", argv[0], argv[0]);
        return 0;
    }

    cmd = argv[1];


    if (cmd->typePtr == &subcmdLookupObjType) {
        if (cmd->internalRep.ptrIntValue.ptr == command_table) {
            ct = command_table + cmd->internalRep.ptrIntValue.int1;
            goto found;
        }
    }


    if (Jim_CompareStringImmediate(interp, cmd, "-help")) {
        if (argc == 2) {

            show_cmd_usage(interp, command_table, argc, argv);
            return &dummy_subcmd;
        }
        help = 1;


        cmd = argv[2];
    }


    if (Jim_CompareStringImmediate(interp, cmd, "-commands")) {
        Jim_SetResult(interp, subcmd_cmd_list(interp, command_table, " "));
        return &dummy_subcmd;
    }

    cmdstr = Jim_GetString(cmd, &cmdlen);

    for (ct = command_table; ct->cmd; ct++) {
        if (Jim_CompareStringImmediate(interp, cmd, ct->cmd)) {

            break;
        }
        if (strncmp(cmdstr, ct->cmd, cmdlen) == 0) {
            if (partial) {

                if (help) {

                    show_cmd_usage(interp, command_table, argc, argv);
                    return &dummy_subcmd;
                }
                bad_subcmd(interp, command_table, "ambiguous", argv[0], argv[1 + help]);
                return 0;
            }
            partial = ct;
        }
        continue;
    }


    if (partial && !ct->cmd) {
        ct = partial;
    }

    if (!ct->cmd) {

        if (help) {

            show_cmd_usage(interp, command_table, argc, argv);
            return &dummy_subcmd;
        }
        bad_subcmd(interp, command_table, "unknown", argv[0], argv[1 + help]);
        return 0;
    }

    if (help) {
        Jim_SetResultString(interp, "Usage: ", -1);

        add_cmd_usage(interp, ct, argv[0]);
        return &dummy_subcmd;
    }


    Jim_FreeIntRep(interp, cmd);
    cmd->typePtr = &subcmdLookupObjType;
    cmd->internalRep.ptrIntValue.ptr = (void *)command_table;
    cmd->internalRep.ptrIntValue.int1 = ct - command_table;

found:


    if (argc - 2 < ct->minargs) {
        argsok = 0;
    }
    else if (ct->maxargs >= 0 && argc - 2 > ct->maxargs) {
        argsok = 0;
    }
    else if (ct->maxargs < -1 && (argc - 2) % -ct->maxargs != 0) {

        argsok = 0;
    }
    if (!argsok) {
        Jim_SetResultString(interp, "wrong # args: should be \"", -1);

        add_cmd_usage(interp, ct, argv[0]);
        Jim_AppendStrings(interp, Jim_GetResult(interp), "\"", NULL);

        return 0;
    }


    return ct;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r12
movq %rdi, %rbx
cmpl $0x1, %edx
jg 0x107b1
movq (%r12), %rcx
leaq 0x168bc(%rip), %rsi     # 0x27058
xorl %r15d, %r15d
movq %rbx, %rdi
movq %rcx, %rdx
xorl %eax, %eax
callq 0x68a7
jmp 0x10858
movl %edx, %r13d
movq %rsi, %r15
movq 0x8(%r12), %r14
leaq 0x211b5(%rip), %rax     # 0x31978
cmpq %rax, 0x8(%r14)
jne 0x107d3
cmpq %r15, 0x18(%r14)
je 0x1092e
leaq 0x16bd1(%rip), %rdx     # 0x273ab
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7223
testl %eax, %eax
je 0x10804
cmpl $0x2, %r13d
jne 0x107ff
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x10a76
jmp 0x10851
movq 0x10(%r12), %r14
movl %eax, -0x2c(%rbp)
leaq 0x16801(%rip), %rdx     # 0x2700f
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7223
testl %eax, %eax
je 0x1086a
leaq 0x18d40(%rip), %rdx     # 0x29564
movq %rbx, %rdi
movq %r15, %rsi
callq 0x10aaa
movq %rax, %r14
incl 0x10(%rax)
movq (%rbx), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x1084e
movq %rbx, %rdi
callq 0x73bf
movq %r14, (%rbx)
leaq 0x21148(%rip), %r15     # 0x319a0
movq %r15, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r13d, -0x3c(%rbp)
movq %r12, -0x48(%rbp)
leaq -0x4c(%rbp), %rsi
movq %r14, %rdi
callq 0x7fc7
movq %rax, %r12
xorl %r13d, %r13d
movq %r15, -0x38(%rbp)
movq (%r15), %rdx
testq %rdx, %rdx
je 0x108c4
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7223
testl %eax, %eax
jne 0x108c4
movq (%r15), %rsi
movslq -0x4c(%rbp), %rdx
movq %r12, %rdi
callq 0x60b0
testl %eax, %eax
jne 0x108be
testq %r13, %r13
movq %r15, %r13
jne 0x10a28
addq $0x20, %r15
jmp 0x10888
testq %r13, %r13
je 0x108d1
cmpq $0x0, (%r15)
cmoveq %r13, %r15
movq -0x48(%rbp), %r12
movl -0x3c(%rbp), %r13d
movl -0x2c(%rbp), %eax
cmpq $0x0, (%r15)
je 0x1093b
testl %eax, %eax
je 0x1094f
leaq 0x167c2(%rip), %rsi     # 0x270af
pushq $-0x1
popq %rdx
movq %rbx, %rdi
callq 0x7363
movq %rax, %r14
incl 0x10(%rax)
movq (%rbx), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x10917
movq %rbx, %rdi
callq 0x73bf
movq %r14, (%rbx)
movq (%r12), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x106ef
jmp 0x10851
movslq 0x20(%r14), %rax
shlq $0x5, %rax
addq %rax, %r15
jmp 0x1098a
testl %eax, %eax
je 0x10a3e
movq %rbx, %rdi
movq -0x38(%rbp), %rsi
jmp 0x107f5
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x10969
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x10969
movq %rbx, %rdi
movq %r14, %rsi
callq *%rax
leaq 0x21008(%rip), %rax     # 0x31978
movq %rax, 0x8(%r14)
movq -0x38(%rbp), %rcx
movq %rcx, 0x18(%r14)
movq %r15, %rax
subq %rcx, %rax
shrq $0x5, %rax
movl %eax, 0x20(%r14)
addl $-0x2, %r13d
movswl 0x18(%r15), %eax
cmpl %eax, %r13d
jl 0x109c7
movswl 0x1a(%r15), %ecx
testl %ecx, %ecx
setns %al
cmpl %ecx, %r13d
setg %dl
testb %dl, %al
jne 0x109c7
cmpw $-0x2, %cx
jg 0x10858
negl %ecx
movl %r13d, %eax
xorl %edx, %edx
divl %ecx
testl %edx, %edx
je 0x10858
leaq 0x16670(%rip), %rsi     # 0x2703e
pushq $-0x1
popq %rdx
movq %rbx, %rdi
callq 0x7363
movq %rax, %r14
incl 0x10(%rax)
movq (%rbx), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x109f8
movq %rbx, %rdi
callq 0x73bf
movq %r14, (%rbx)
movq (%r12), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x106ef
movq (%rbx), %rsi
leaq 0x16fbc(%rip), %rdx     # 0x279d0
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %ecx, %ecx
xorl %eax, %eax
callq 0xa731
jmp 0x10858
cmpl $0x0, -0x2c(%rbp)
je 0x10a50
movq %rbx, %rdi
movq -0x38(%rbp), %rsi
movq -0x48(%rbp), %rdx
jmp 0x107f8
movq (%r12), %rcx
movq 0x8(%r12), %r8
leaq 0x163bf(%rip), %rdx     # 0x26e0d
jmp 0x10a62
movq -0x48(%rbp), %rax
movq (%rax), %rcx
movq 0x8(%rax), %r8
leaq 0x16643(%rip), %rdx     # 0x270a5
movq %rbx, %rdi
movq -0x38(%rbp), %rsi
callq 0x10b60
xorl %r15d, %r15d
jmp 0x10858