// File: /workspace/github_c_makefile_star2_O3/msteveb[P]autosetup/./jimsh0.c
// Function: Jim_LsearchCoreCommand
static int Jim_LsearchCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
    static const char * const options[] = {
        "-bool", "-not", "-nocase", "-exact", "-glob", "-regexp", "-all", "-inline", "-command",
        "-stride", "-index", NULL
    };
    enum
    { OPT_BOOL, OPT_NOT, OPT_NOCASE, OPT_EXACT, OPT_GLOB, OPT_REGEXP, OPT_ALL, OPT_INLINE,
            OPT_COMMAND, OPT_STRIDE, OPT_INDEX };
    int i;
    int opt_bool = 0;
    int opt_not = 0;
    int opt_all = 0;
    int opt_inline = 0;
    int opt_match = OPT_EXACT;
    int listlen;
    int rc = JIM_OK;
    Jim_Obj *listObjPtr = NULL;
    Jim_Obj *commandObj = NULL;
    Jim_Obj *indexObj = NULL;
    int match_flags = 0;
    long stride = 1;

    if (argc < 3) {
      wrongargs:
        Jim_WrongNumArgs(interp, 1, argv,
            "?-exact|-glob|-regexp|-command 'command'? ?-bool|-inline? ?-not? ?-nocase? ?-all? ?-stride len? ?-index val? list value");
        return JIM_ERR;
    }

    for (i = 1; i < argc - 2; i++) {
        int option;

        if (Jim_GetEnum(interp, argv[i], options, &option, NULL, JIM_ERRMSG) != JIM_OK) {
            return JIM_ERR;
        }
        switch (option) {
            case OPT_BOOL:
                opt_bool = 1;
                opt_inline = 0;
                break;
            case OPT_NOT:
                opt_not = 1;
                break;
            case OPT_NOCASE:
                match_flags |= JIM_NOCASE;
                break;
            case OPT_INLINE:
                opt_inline = 1;
                opt_bool = 0;
                break;
            case OPT_ALL:
                opt_all = 1;
                break;
            case OPT_REGEXP:
                opt_match = option;
                match_flags |= JIM_OPT_END;
                break;
            case OPT_COMMAND:
                if (i >= argc - 2) {
                    goto wrongargs;
                }
                commandObj = argv[++i];

            case OPT_EXACT:
            case OPT_GLOB:
                opt_match = option;
                break;
            case OPT_INDEX:
                if (i >= argc - 2) {
                    goto wrongargs;
                }
                indexObj = argv[++i];
                break;
            case OPT_STRIDE:
                if (i >= argc - 2) {
                    goto wrongargs;
                }
                if (Jim_GetLong(interp, argv[++i], &stride) != JIM_OK) {
                    return JIM_ERR;
                }
                if (stride < 1) {
                    Jim_SetResultString(interp, "stride length must be at least 1", -1);
                    return JIM_ERR;
                }
                break;
        }
    }

    argc -= i;
    if (argc < 2) {
        goto wrongargs;
    }
    argv += i;

    listlen = Jim_ListLength(interp, argv[0]);
    if (listlen % stride) {
        Jim_SetResultString(interp, "list size must be a multiple of the stride length", -1);
        return JIM_ERR;
    }

    if (opt_all) {
        listObjPtr = Jim_NewListObj(interp, NULL, 0);
    }
    if (opt_match == OPT_REGEXP) {
        commandObj = Jim_NewStringObj(interp, "regexp", -1);
    }
    if (commandObj) {
        Jim_IncrRefCount(commandObj);
    }

    for (i = 0; i < listlen; i += stride) {
        int eq = 0;
        Jim_Obj *searchListObj;
        Jim_Obj *objPtr;
        int offset;

        if (indexObj) {
            int indexlen = Jim_ListLength(interp, indexObj);
            if (stride == 1) {
                searchListObj = Jim_ListGetIndex(interp, argv[0], i);
            }
            else {
                searchListObj = Jim_NewListObj(interp, argv[0]->internalRep.listValue.ele + i, stride);
            }
            Jim_IncrRefCount(searchListObj);
            rc = Jim_ListIndices(interp, searchListObj, indexObj->internalRep.listValue.ele, indexlen, &objPtr, JIM_ERRMSG);
            if (rc != JIM_OK) {
                Jim_DecrRefCount(interp, searchListObj);
                rc = JIM_ERR;
                goto done;
            }

            offset = 0;
        }
        else {

            searchListObj = argv[0];
            offset = i;
            objPtr = Jim_ListGetIndex(interp, searchListObj, i);
            Jim_IncrRefCount(searchListObj);
        }

        switch (opt_match) {
            case OPT_EXACT:
                eq = Jim_StringCompareObj(interp, argv[1], objPtr, match_flags) == 0;
                break;

            case OPT_GLOB:
                eq = Jim_StringMatchObj(interp, argv[1], objPtr, match_flags);
                break;

            case OPT_REGEXP:
            case OPT_COMMAND:
                eq = Jim_CommandMatchObj(interp, commandObj, argv[1], objPtr, match_flags);
                if (eq < 0) {
                    Jim_DecrRefCount(interp, searchListObj);
                    rc = JIM_ERR;
                    goto done;
                }
                break;
        }


        if ((!opt_bool && eq == !opt_not) || (opt_bool && (eq || opt_all))) {
            Jim_Obj *resultObj;

            if (opt_bool) {
                resultObj = Jim_NewIntObj(interp, eq ^ opt_not);
            }
            else if (!opt_inline) {
                resultObj = Jim_NewIntObj(interp, i);
            }
            else if (stride == 1) {
                resultObj = objPtr;
            }
            else if (opt_all) {

                ListInsertElements(listObjPtr, -1, stride,
                    searchListObj->internalRep.listValue.ele + offset);

                resultObj = NULL;
            }
            else {
                resultObj = Jim_NewListObj(interp, searchListObj->internalRep.listValue.ele + offset, stride);
            }

            if (opt_all) {

                if (stride == 1) {
                    Jim_ListAppendElement(interp, listObjPtr, resultObj);
                }
            }
            else {
                Jim_SetResult(interp, resultObj);
                Jim_DecrRefCount(interp, searchListObj);
                goto done;
            }
        }
        Jim_DecrRefCount(interp, searchListObj);
    }

    if (opt_all) {
        Jim_SetResult(interp, listObjPtr);
        listObjPtr = NULL;
    }
    else {

        if (opt_bool) {
            Jim_SetResultBool(interp, opt_not);
        }
        else if (!opt_inline) {
            Jim_SetResultInt(interp, -1);
        }
    }

  done:
    if (listObjPtr) {
        Jim_FreeNewObj(interp, listObjPtr);
    }
    if (commandObj) {
        Jim_DecrRefCount(interp, commandObj);
    }
    return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %r12
cmpl $0x3, %esi
jl 0x1cd88
movq %r12, -0x48(%rbp)
jne 0x1cc08
movl $0x1, %r14d
movq $0x0, -0x40(%rbp)
movb $0x1, %cl
movl $0x3, %eax
movq %rax, -0x68(%rbp)
movl $0x1, %r13d
xorl %r15d, %r15d
movl $0x0, -0x34(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x0, -0x54(%rbp)
movb $0x1, -0x29(%rbp)
jmp 0x1cd80
movq %rsi, -0x80(%rbp)
leal -0x2(%rsi), %r12d
movl $0x1, %eax
movq %rax, -0x70(%rbp)
movl $0x3, %eax
movq %rax, -0x68(%rbp)
movq $0x0, -0x78(%rbp)
movl $0x1, %r14d
movl $0x0, -0x54(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
xorl %r15d, %r15d
movq $0x0, -0x40(%rbp)
movl $0x0, -0x60(%rbp)
movslq %r14d, %rbx
movq %rdx, %r13
movq (%rdx,%rbx,8), %rsi
movq -0x48(%rbp), %rdi
leaq 0x19604(%rip), %rdx     # 0x36270
leaq -0x90(%rbp), %rcx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0x7eac
testl %eax, %eax
jne 0x1ce09
movl -0x90(%rbp), %eax
cmpq $0xa, %rax
ja 0x1ccf5
leaq 0xa7ac(%rip), %rdx      # 0x27448
movslq (%rdx,%rax,4), %rcx
addq %rdx, %rcx
movq %r13, %rdx
jmpq *%rcx
jmp 0x1cd55
orl $0x1, -0x34(%rbp)
jmp 0x1cd59
movq 0x8(%rdx,%rbx,8), %rbx
leaq 0x1862e(%rip), %rax     # 0x352f0
cmpq %rax, 0x8(%rbx)
je 0x1cce1
movq -0x48(%rbp), %rdi
movq %rbx, %rsi
movl $0x1, %edx
callq 0xd6c3
testl %eax, %eax
jne 0x1ce09
movq 0x18(%rbx), %rax
movq %rax, -0x70(%rbp)
testq %rax, %rax
jle 0x1d197
incl %r14d
movq %r13, %rdx
jmp 0x1cd59
movl $0x1, %eax
movq %rax, -0x78(%rbp)
movl $0x0, -0x60(%rbp)
jmp 0x1cd59
movl $0x1, -0x54(%rbp)
jmp 0x1cd59
movq $0x0, -0x78(%rbp)
movl $0x1, -0x60(%rbp)
jmp 0x1cd59
orl $0x2, -0x34(%rbp)
movl $0x5, %eax
jmp 0x1cd55
movl $0x1, -0x30(%rbp)
jmp 0x1cd59
incl %r14d
movq 0x8(%rdx,%rbx,8), %r15
jmp 0x1cd59
incl %r14d
movq 0x8(%rdx,%rbx,8), %rax
movq %rax, -0x40(%rbp)
movl $0x8, %eax
movq %rax, -0x68(%rbp)
incl %r14d
cmpl %r12d, %r14d
jl 0x1cc57
cmpl $0x0, -0x78(%rbp)
sete -0x29(%rbp)
cmpl $0x0, -0x60(%rbp)
sete %cl
movq -0x48(%rbp), %r12
movq -0x70(%rbp), %r13
movq -0x80(%rbp), %rsi
subl %r14d, %esi
cmpl $0x2, %esi
jge 0x1cda4
leaq 0xf8c3(%rip), %rcx      # 0x2c652
movl $0x1, %r14d
movq %r12, %rdi
movl $0x1, %esi
callq 0x7446
jmp 0x1ce0f
movb %cl, -0x2a(%rbp)
movq %r15, -0x78(%rbp)
movl %r14d, %r14d
movq (%rdx,%r14,8), %rbx
movq %r12, %rdi
movq %rbx, %rsi
movq %rdx, %r15
callq 0xe2fe
movslq 0x20(%rbx), %rbx
movq %rbx, %rax
cqto
idivq %r13
testq %rdx, %rdx
je 0x1ce21
leaq 0xf913(%rip), %rsi      # 0x2c6eb
movq %r12, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7508
movq %rax, %rbx
incl 0x10(%rax)
movq (%r12), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x1ce05
movq %r12, %rdi
callq 0x758c
movq %rbx, (%r12)
movl $0x1, %r14d
movl %r14d, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, -0x80(%rbp)
movq %r15, -0x60(%rbp)
cmpl $0x0, -0x30(%rbp)
je 0x1ce56
movq %r12, %rdi
callq 0xae38
leaq 0x1852a(%rip), %rcx     # 0x35368
movq %rcx, 0x8(%rax)
movq $0x0, (%rax)
xorps %xmm0, %xmm0
movq %rax, -0x50(%rbp)
movups %xmm0, 0x18(%rax)
jmp 0x1ce5e
movq $0x0, -0x50(%rbp)
movq -0x68(%rbp), %rax
cmpl $0x5, %eax
jne 0x1ce7f
leaq 0xf703(%rip), %rsi      # 0x2c571
movq %r12, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7508
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
testq %rax, %rax
je 0x1ce8b
incl 0x10(%rax)
testl %ebx, %ebx
jle 0x1d0d6
xorl %eax, %eax
cmpl $0x0, -0x54(%rbp)
sete %al
movl %eax, -0x8c(%rbp)
xorl %r14d, %r14d
movq -0x68(%rbp), %rax
addl $-0x3, %eax
movq %rax, -0x68(%rbp)
movq %r13, -0x70(%rbp)
movq %rbx, -0x98(%rbp)
movq -0x78(%rbp), %rsi
testq %rsi, %rsi
je 0x1cef1
movq %r12, %rdi
movq %rsi, %rbx
callq 0xe2fe
movl 0x20(%rbx), %ebx
movq -0x80(%rbp), %rax
movq -0x60(%rbp), %rcx
movq (%rcx,%rax,8), %rsi
cmpq $0x1, %r13
jne 0x1cf1b
movq %r12, %rdi
movl %r14d, %edx
callq 0xe803
jmp 0x1cf34
movq -0x80(%rbp), %rbx
movq -0x60(%rbp), %rax
movq (%rax,%rbx,8), %r13
movq %r12, %rdi
movq %r13, %rsi
movl %r14d, %edx
callq 0xe803
movq %rax, -0x88(%rbp)
incl 0x10(%r13)
movslq %r14d, %r15
jmp 0x1cf6b
movslq %r14d, %rax
shlq $0x3, %rax
addq 0x18(%rsi), %rax
movq %r12, %rdi
movq %rax, %rsi
movl %r13d, %edx
callq 0x762e
movq %rax, %r13
incl 0x10(%rax)
movq -0x78(%rbp), %rax
movq 0x18(%rax), %rdx
movq %r12, %rdi
movq %r13, %rsi
movl %ebx, %ecx
leaq -0x88(%rbp), %r8
movl $0x1, %r9d
callq 0x225a2
testl %eax, %eax
jne 0x1d178
xorl %r15d, %r15d
movq -0x80(%rbp), %rbx
xorl %r12d, %r12d
movq -0x68(%rbp), %rax
cmpl $0x5, %eax
ja 0x1cff2
leaq 0xa4f6(%rip), %rcx      # 0x27474
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x60(%rbp), %rax
movq 0x8(%rax,%rbx,8), %rdx
movq -0x88(%rbp), %rcx
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rsi
movl -0x34(%rbp), %r8d
callq 0x11468
movl %eax, %r12d
testl %eax, %eax
jns 0x1cff2
jmp 0x1d224
movq -0x60(%rbp), %rax
movq 0x8(%rax,%rbx,8), %rsi
movq -0x88(%rbp), %rdx
movl -0x34(%rbp), %ecx
callq 0xb104
movl %eax, %r12d
jmp 0x1cff2
movq -0x60(%rbp), %rax
movq 0x8(%rax,%rbx,8), %rsi
movq -0x88(%rbp), %rdx
movl -0x34(%rbp), %ecx
callq 0xb312
xorl %r12d, %r12d
testl %eax, %eax
sete %r12b
cmpb $0x0, -0x29(%rbp)
je 0x1d00c
cmpl -0x8c(%rbp), %r12d
jne 0x1d075
cmpb $0x0, -0x2a(%rbp)
je 0x1d04d
movslq %r14d, %r12
jmp 0x1d018
movl %r12d, %eax
orl -0x30(%rbp), %eax
je 0x1d075
xorl -0x54(%rbp), %r12d
movq -0x48(%rbp), %rdi
callq 0xae38
movq %rax, %rbx
leaq 0x182c5(%rip), %rax     # 0x352f0
movq %rax, 0x8(%rbx)
movq $0x0, (%rbx)
movq %r12, 0x18(%rbx)
cmpl $0x0, -0x30(%rbp)
je 0x1d268
cmpq $0x1, -0x70(%rbp)
je 0x1d065
jmp 0x1d075
cmpq $0x1, -0x70(%rbp)
jne 0x1d0ad
movq -0x88(%rbp), %rbx
cmpl $0x0, -0x30(%rbp)
je 0x1d268
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq %rbx, %rdx
callq 0x7683
movl 0x10(%r13), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%r13)
cmpl $0x1, %eax
movq -0x48(%rbp), %r12
jg 0x1d094
movq %r12, %rdi
movq %r13, %rsi
callq 0x758c
movq -0x70(%rbp), %r13
addl %r13d, %r14d
movq -0x98(%rbp), %rbx
cmpl %ebx, %r14d
jl 0x1cebb
jmp 0x1d0d6
shlq $0x3, %r15
addq 0x18(%r13), %r15
cmpl $0x0, -0x30(%rbp)
je 0x1d255
movq -0x50(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq -0x70(%rbp), %rdx
movq %r15, %rcx
callq 0xe263
jmp 0x1d075
cmpl $0x0, -0x30(%rbp)
movb -0x2a(%rbp), %al
je 0x1d110
movq -0x50(%rbp), %rbx
incl 0x10(%rbx)
movq (%r12), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
movq -0x40(%rbp), %r15
jg 0x1d104
movq %r12, %rdi
callq 0x758c
movq %rbx, (%r12)
xorl %r14d, %r14d
jmp 0x1d2c3
cmpb $0x0, -0x29(%rbp)
movq -0x40(%rbp), %r15
movq -0x50(%rbp), %r13
je 0x1d1d6
xorl %r14d, %r14d
testb %al, %al
je 0x1d2b3
movq %r12, %rdi
callq 0xae38
movq %rax, %rbx
leaq 0x181b1(%rip), %rax     # 0x352f0
movq %rax, 0x8(%rbx)
movq $0x0, (%rbx)
movq $-0x1, 0x18(%rbx)
incl 0x10(%rbx)
movq (%r12), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x1d16f
movq %r12, %rdi
callq 0x758c
movq %rbx, (%r12)
jmp 0x1d2b3
movl 0x10(%r13), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%r13)
movl $0x1, %r14d
cmpl $0x1, %eax
jle 0x1d23e
jmp 0x1d24f
leaq 0xf52c(%rip), %rsi      # 0x2c6ca
movq -0x48(%rbp), %r14
movq %r14, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7508
movq %rax, %rbx
incl 0x10(%rax)
movq (%r14), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x1d1ce
movq %r14, %rdi
callq 0x758c
movq %rbx, (%r14)
jmp 0x1ce09
movl -0x54(%rbp), %r14d
movq %r12, %rdi
callq 0xae38
movq %rax, %rbx
leaq 0x18104(%rip), %rax     # 0x352f0
movq %rax, 0x8(%rbx)
movq $0x0, (%rbx)
movq %r14, 0x18(%rbx)
incl 0x10(%rbx)
movq (%r12), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x1d218
movq %r12, %rdi
callq 0x758c
movq %rbx, (%r12)
xorl %r14d, %r14d
jmp 0x1d2b3
movl 0x10(%r13), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%r13)
movl $0x1, %r14d
cmpl $0x1, %eax
jg 0x1d24b
movq -0x48(%rbp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x758c
jmp 0x1d24f
movq -0x48(%rbp), %r12
movq -0x40(%rbp), %r15
jmp 0x1d2af
movq -0x48(%rbp), %rdi
movq %r15, %rsi
movq -0x70(%rbp), %rdx
callq 0x762e
movq %rax, %rbx
incl 0x10(%rbx)
movq -0x48(%rbp), %r12
movq (%r12), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x1d289
movq %r12, %rdi
callq 0x758c
movq %rbx, (%r12)
movl 0x10(%r13), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%r13)
xorl %r14d, %r14d
cmpl $0x1, %eax
movq -0x40(%rbp), %r15
jg 0x1d2af
movq %r12, %rdi
movq %r13, %rsi
callq 0x758c
movq -0x50(%rbp), %r13
testq %r13, %r13
je 0x1d2c3
movq %r12, %rdi
movq %r13, %rsi
callq 0x758c
testq %r15, %r15
je 0x1ce0f
movl 0x10(%r15), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%r15)
cmpl $0x1, %eax
jg 0x1ce0f
movq %r12, %rdi
movq %r15, %rsi
callq 0x758c
jmp 0x1ce0f