// File: /workspace/github_c_makefile_star2_O1/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 0x11bf2
movq (%r12), %rcx
leaq 0x1a483(%rip), %rsi     # 0x2c060
xorl %r15d, %r15d
movq %rbx, %rdi
movq %rcx, %rdx
xorl %eax, %eax
callq 0x692d
jmp 0x11cb8
movl %edx, %r13d
movq %rsi, %r15
movq 0x8(%r12), %r14
leaq 0x24cc4(%rip), %rax     # 0x368c8
cmpq %rax, 0x8(%r14)
jne 0x11c14
cmpq %r15, 0x18(%r14)
je 0x11d38
leaq 0x1a798(%rip), %rdx     # 0x2c3b3
movq %rbx, %rdi
movq %r14, %rsi
callq 0x73d6
testl %eax, %eax
je 0x11c64
cmpl $0x2, %r13d
jne 0x11c5f
movq (%r12), %r14
leaq 0x1c93a(%rip), %rdx     # 0x2e575
movq %rbx, %rdi
movq %r15, %rsi
callq 0x11f43
leaq 0x1c939(%rip), %rsi     # 0x2e586
movq %rbx, %rdi
movq %r14, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x692d
jmp 0x11cb1
movq 0x10(%r12), %r14
movl %eax, -0x2c(%rbp)
leaq 0x1a3a9(%rip), %rdx     # 0x2c017
movq %rbx, %rdi
movq %r14, %rsi
callq 0x73d6
testl %eax, %eax
je 0x11cca
leaq 0x1c8f2(%rip), %rdx     # 0x2e576
movq %rbx, %rdi
movq %r15, %rsi
callq 0x11f43
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 0x11cae
movq %rbx, %rdi
callq 0x759a
movq %r14, (%rbx)
leaq 0x24c38(%rip), %r15     # 0x368f0
movq %r15, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, (%r14)
jne 0x11cda
movq 0x8(%r14), %rax
movq %r14, %rdi
callq *0x18(%rax)
movl %r13d, -0x44(%rbp)
movq %r12, -0x50(%rbp)
movq %rbx, -0x40(%rbp)
movq (%r15), %rdx
testq %rdx, %rdx
movq %r15, -0x38(%rbp)
je 0x11d48
movq (%r14), %r12
movslq 0x14(%r14), %r13
xorl %ebx, %ebx
movq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x73d6
testl %eax, %eax
jne 0x11d4a
movq (%r15), %rsi
movq %r12, %rdi
movq %r13, %rdx
callq 0x60b0
testl %eax, %eax
jne 0x11d29
testq %rbx, %rbx
movq %r15, %rbx
jne 0x11ecc
movq 0x20(%r15), %rdx
addq $0x20, %r15
testq %rdx, %rdx
jne 0x11cfb
jmp 0x11d4a
movslq 0x20(%r14), %rax
shlq $0x5, %rax
addq %rax, %r15
jmp 0x11e14
xorl %ebx, %ebx
testq %rbx, %rbx
je 0x11d57
cmpq $0x0, (%r15)
cmoveq %rbx, %r15
movq -0x40(%rbp), %rbx
movq -0x50(%rbp), %r12
movl -0x44(%rbp), %r13d
movl -0x2c(%rbp), %eax
cmpq $0x0, (%r15)
je 0x11dba
testl %eax, %eax
je 0x11dd9
leaq 0x1a340(%rip), %rsi     # 0x2c0b7
movq %rbx, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7516
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 0x11da3
movq %rbx, %rdi
callq 0x759a
movq %r14, (%rbx)
movq (%r12), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x11b26
jmp 0x11cb1
movq (%r12), %r14
testl %eax, %eax
je 0x11eb4
leaq 0x1c7a8(%rip), %rdx     # 0x2e575
movq %rbx, %rdi
movq -0x38(%rbp), %rsi
jmp 0x11c41
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x11df3
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x11df3
movq %rbx, %rdi
movq %r14, %rsi
callq *%rax
leaq 0x24ace(%rip), %rax     # 0x368c8
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 0x11e51
movswl 0x1a(%r15), %ecx
testl %ecx, %ecx
setns %al
cmpl %ecx, %r13d
setg %dl
testb %dl, %al
jne 0x11e51
cmpw $-0x2, %cx
jg 0x11cb8
negl %ecx
movl %r13d, %eax
xorl %edx, %edx
divl %ecx
testl %edx, %edx
je 0x11cb8
leaq 0x1a1ee(%rip), %rsi     # 0x2c046
movq %rbx, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7516
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 0x11e84
movq %rbx, %rdi
callq 0x759a
movq %r14, (%rbx)
movq (%r12), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x11b26
movq (%rbx), %rsi
leaq 0x1ab3e(%rip), %rdx     # 0x2c9de
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %ecx, %ecx
xorl %eax, %eax
callq 0xafef
jmp 0x11cb8
movq 0x8(%r12), %r8
leaq 0x19f55(%rip), %rdx     # 0x2be15
movq %rbx, %rdi
movq -0x38(%rbp), %rsi
movq %r14, %rcx
jmp 0x11f02
cmpl $0x0, -0x2c(%rbp)
je 0x11ee8
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x50(%rbp), %rdx
callq 0x11f0f
jmp 0x11cb1
movq -0x50(%rbp), %rax
movq (%rax), %rcx
movq 0x8(%rax), %r8
leaq 0x1a1b3(%rip), %rdx     # 0x2c0ad
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x12018
xorl %r15d, %r15d
jmp 0x11cb8