// File: /workspace/github_c_makefile_star2_O1/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
cmpl $0x3, %esi
jl 0x1d4ef
movq %rsi, -0x68(%rbp)
jne 0x1d2f1
movl $0x1, %r12d
movq $0x0, -0x48(%rbp)
movb $0x1, %cl
movl $0x3, %eax
movq %rax, -0x60(%rbp)
movl $0x1, %r13d
xorl %eax, %eax
movl $0x0, -0x38(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x0, -0x3c(%rbp)
movb $0x1, -0x50(%rbp)
jmp 0x1d4e3
movq %rdi, %r14
leal -0x2(%rsi), %eax
movl %eax, -0x70(%rbp)
movl $0x1, %eax
movq %rax, -0x58(%rbp)
movl $0x3, %eax
movq %rax, -0x60(%rbp)
movq $0x0, -0x50(%rbp)
movl $0x1, %r12d
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x0, -0x38(%rbp)
movq $0x0, -0x88(%rbp)
movq $0x0, -0x48(%rbp)
movl $0x0, -0x80(%rbp)
movslq %r12d, %r15
movq %rdx, %rbx
movq (%rdx,%r15,8), %rsi
xorl %r13d, %r13d
movq %r14, %rdi
leaq 0x19f10(%rip), %rdx     # 0x37270
leaq -0x9c(%rbp), %rcx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0x7e97
testl %eax, %eax
je 0x1d393
movq %rbx, %rdx
testb %r13b, %r13b
je 0x1d56d
incl %r12d
cmpl -0x70(%rbp), %r12d
jl 0x1d349
jmp 0x1d4c6
movl -0x9c(%rbp), %eax
movb $0x1, %r13b
cmpq $0xa, %rax
ja 0x1d379
leaq 0xb0db(%rip), %rdx      # 0x28484
movslq (%rdx,%rax,4), %rcx
addq %rdx, %rcx
movq %rbx, %rdx
jmpq *%rcx
movl $0x1, %eax
movq %rax, -0x50(%rbp)
movl $0x0, -0x80(%rbp)
jmp 0x1d37c
orl $0x1, -0x38(%rbp)
jmp 0x1d37c
movq 0x8(%rdx,%r15,8), %r15
leaq 0x18f07(%rip), %rax     # 0x362e0
cmpq %rax, 0x8(%r15)
je 0x1d45a
movq %r14, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0xd6d7
movq %rbx, %rdx
testl %eax, %eax
je 0x1d45a
xorl %ecx, %ecx
jmp 0x1d460
movl $0x1, -0x3c(%rbp)
jmp 0x1d37c
movq $0x0, -0x50(%rbp)
movl $0x1, -0x80(%rbp)
jmp 0x1d37c
orl $0x2, -0x38(%rbp)
movl $0x5, %eax
jmp 0x1d451
movl $0x1, -0x30(%rbp)
jmp 0x1d37c
incl %r12d
movq 0x8(%rdx,%r15,8), %rax
movq %rax, -0x88(%rbp)
jmp 0x1d37c
incl %r12d
movq 0x8(%rdx,%r15,8), %rcx
movq %rcx, -0x48(%rbp)
movq %rax, -0x60(%rbp)
jmp 0x1d37c
movq 0x18(%r15), %rax
movb $0x1, %cl
incl %r12d
testb %cl, %cl
movq -0x58(%rbp), %rcx
cmovneq %rax, %rcx
movq %rcx, -0x58(%rbp)
je 0x1d4be
testq %rcx, %rcx
jg 0x1d37c
movq %r14, %r13
movq %r14, %rdi
leaq 0x1029f(%rip), %rsi     # 0x2d728
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7516
movq %rax, %r15
incl 0x10(%rax)
movq (%r14), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x1d4b2
movq %r13, %rdi
callq 0x759a
movq %r15, (%r13)
xorl %r13d, %r13d
jmp 0x1d379
xorl %r13d, %r13d
jmp 0x1d37c
cmpl $0x0, -0x50(%rbp)
sete -0x50(%rbp)
cmpl $0x0, -0x80(%rbp)
sete %cl
movq %r14, %rdi
movq -0x58(%rbp), %r13
movq -0x88(%rbp), %rax
movq -0x68(%rbp), %rsi
subl %r12d, %esi
cmpl $0x2, %esi
jge 0x1d507
leaq 0x101ba(%rip), %rcx     # 0x2d6b0
movl $0x1, %ebx
movl $0x1, %esi
callq 0x7454
jmp 0x1d572
movb %cl, -0x29(%rbp)
movq %rax, -0x88(%rbp)
movl %r12d, %r12d
movq (%rdx,%r12,8), %r14
movq %r14, %rsi
movq %rdi, %r15
movq %rdx, %rbx
callq 0xe338
movslq 0x20(%r14), %rcx
movq %rcx, %rax
cqto
idivq %r13
testq %rdx, %rdx
je 0x1d583
leaq 0x1020b(%rip), %rsi     # 0x2d749
movq %r15, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7516
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 0x1d56a
movq %r15, %rdi
callq 0x759a
movq %r14, (%r15)
movl $0x1, %ebx
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rcx, -0x80(%rbp)
movq %rbx, -0x70(%rbp)
cmpl $0x0, -0x30(%rbp)
je 0x1d5bf
movq %r15, %rbx
movq %r15, %rdi
callq 0xae58
leaq 0x18db5(%rip), %rcx     # 0x36358
movq %rcx, 0x8(%rax)
movq $0x0, (%rax)
xorps %xmm0, %xmm0
movq %rax, -0x78(%rbp)
movups %xmm0, 0x18(%rax)
movq -0x48(%rbp), %rax
jmp 0x1d5ce
movq $0x0, -0x78(%rbp)
movq -0x48(%rbp), %rax
movq %r15, %rbx
movq -0x60(%rbp), %r14
cmpl $0x5, %r14d
jne 0x1d5ec
leaq 0xfff0(%rip), %rsi      # 0x2d5cf
movq %rbx, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7516
testq %rax, %rax
je 0x1d5f4
incl 0x10(%rax)
movq %rax, -0x48(%rbp)
cmpl $0x0, -0x80(%rbp)
jle 0x1d94c
movq %r12, -0x68(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x3c(%rbp)
sete %al
movl %eax, -0x98(%rbp)
xorl %r12d, %r12d
addl $-0x3, %r14d
movq %r14, -0x60(%rbp)
movl $0x0, -0x34(%rbp)
movq %r13, -0x58(%rbp)
movq -0x88(%rbp), %r14
testq %r14, %r14
je 0x1d665
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe338
movl 0x20(%r14), %r15d
movq -0x70(%rbp), %rax
movq -0x68(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
cmpq $0x1, %r13
jne 0x1d696
movq %rbx, %rdi
movl %r12d, %edx
callq 0xe871
jmp 0x1d6af
movq -0x70(%rbp), %rax
movq -0x68(%rbp), %rcx
movq (%rax,%rcx,8), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl %r12d, %edx
callq 0xe871
movq %rax, -0x90(%rbp)
incl 0x10(%r14)
movl %r12d, -0x94(%rbp)
jmp 0x1d729
movslq %r12d, %rax
shlq $0x3, %rax
addq 0x18(%rsi), %rax
movq %rbx, %rdi
movq %rax, %rsi
movl %r13d, %edx
callq 0x7640
movq %rax, %r14
incl 0x10(%rax)
movq -0x88(%rbp), %rax
movq 0x18(%rax), %rdx
movq %rbx, %rdi
movq %r14, %rsi
movl %r15d, %ecx
leaq -0x90(%rbp), %r8
movl $0x1, %r9d
callq 0x22e05
movl %eax, %r15d
testl %eax, %eax
je 0x1d70c
movl 0x10(%r14), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%r14)
movl $0xe, %r13d
movl $0x1, -0x34(%rbp)
cmpl $0x1, %eax
jg 0x1d720
movq %rbx, %rdi
movq %r14, %rsi
callq 0x759a
jmp 0x1d720
movl $0x0, -0x34(%rbp)
xorl %r13d, %r13d
movl $0x0, -0x94(%rbp)
testl %r15d, %r15d
jne 0x1d8c6
xorl %r13d, %r13d
movq -0x60(%rbp), %rax
cmpl $0x5, %eax
ja 0x1d7e0
leaq 0xad70(%rip), %rcx      # 0x284b0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x70(%rbp), %rax
movq -0x68(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rdx
movq -0x90(%rbp), %rcx
movq %rbx, %rdi
movq -0x48(%rbp), %rsi
movl -0x38(%rbp), %r8d
callq 0x11589
movl %eax, %r13d
testl %eax, %eax
jns 0x1d7e0
movl 0x10(%r14), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%r14)
movl $0xe, %r13d
movl $0x1, -0x34(%rbp)
cmpl $0x2, %eax
jl 0x1d8bb
jmp 0x1d8c6
movq -0x70(%rbp), %rax
movq -0x68(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rsi
movq -0x90(%rbp), %rdx
movl -0x38(%rbp), %ecx
callq 0xb120
movl %eax, %r13d
jmp 0x1d7e0
movq -0x70(%rbp), %rax
movq -0x68(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rsi
movq -0x90(%rbp), %rdx
movl -0x38(%rbp), %ecx
callq 0xb302
xorl %r13d, %r13d
testl %eax, %eax
sete %r13b
cmpb $0x0, -0x50(%rbp)
je 0x1d7f4
cmpl -0x98(%rbp), %r13d
je 0x1d800
jmp 0x1d8a8
movl %r13d, %eax
orl -0x30(%rbp), %eax
je 0x1d8a8
cmpb $0x0, -0x50(%rbp)
je 0x1d815
cmpb $0x0, -0x29(%rbp)
je 0x1d8de
movslq %r12d, %r13
jmp 0x1d819
xorl -0x3c(%rbp), %r13d
movq %rbx, %rdi
callq 0xae58
movq %rax, %r15
leaq 0x18ab5(%rip), %rax     # 0x362e0
movq %rax, 0x8(%r15)
movq $0x0, (%r15)
movq %r13, 0x18(%r15)
movq -0x58(%rbp), %r13
cmpl $0x0, -0x30(%rbp)
je 0x1d861
movq %r13, %rax
xorl %r13d, %r13d
cmpq $0x1, %rax
jne 0x1d8a2
movq %rbx, %rdi
movq -0x78(%rbp), %rsi
movq %r15, %rdx
callq 0x7695
jmp 0x1d8a2
incl 0x10(%r15)
movq (%rbx), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x1d87e
movq %rbx, %rdi
callq 0x759a
movq %r15, (%rbx)
movl 0x10(%r14), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%r14)
movl $0xe, %r13d
cmpl $0x1, %eax
jg 0x1d8a2
movq %rbx, %rdi
movq %r14, %rsi
callq 0x759a
cmpl $0x0, -0x30(%rbp)
je 0x1d8c6
movl 0x10(%r14), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%r14)
xorl %r13d, %r13d
cmpl $0x1, %eax
jg 0x1d8c6
movq %rbx, %rdi
movq %r14, %rsi
callq 0x759a
testl %r13d, %r13d
jne 0x1d938
movq -0x58(%rbp), %r13
addl %r13d, %r12d
cmpl -0x80(%rbp), %r12d
jl 0x1d62b
jmp 0x1d953
movq -0x58(%rbp), %r13
cmpq $0x1, %r13
jne 0x1d8f4
movq -0x90(%rbp), %r15
jmp 0x1d83e
movslq -0x94(%rbp), %rcx
shlq $0x3, %rcx
addq 0x18(%r14), %rcx
cmpl $0x0, -0x30(%rbp)
je 0x1d922
movq -0x78(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl %r13d, %edx
callq 0xe29d
xorl %r15d, %r15d
jmp 0x1d83e
movq %rbx, %rdi
movq %rcx, %rsi
movl %r13d, %edx
callq 0x7640
movq %rax, %r15
jmp 0x1d83e
cmpl $0xe, %r13d
jne 0x1d56d
movq -0x48(%rbp), %r12
movq -0x78(%rbp), %r13
jmp 0x1d987
movl $0x0, -0x34(%rbp)
cmpl $0x0, -0x30(%rbp)
je 0x1d9c1
movq -0x78(%rbp), %r14
incl 0x10(%r14)
movq (%rbx), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
movl $0x0, %r13d
cmpl $0x2, %eax
movq -0x48(%rbp), %r12
jge 0x1d984
movq %rbx, %rdi
callq 0x759a
movq %r14, (%rbx)
testq %r13, %r13
je 0x1d997
movq %rbx, %rdi
movq %r13, %rsi
callq 0x759a
testq %r12, %r12
je 0x1d9b9
movl 0x10(%r12), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%r12)
cmpl $0x1, %eax
jg 0x1d9b9
movq %rbx, %rdi
movq %r12, %rsi
callq 0x759a
movl -0x34(%rbp), %ebx
jmp 0x1d572
cmpb $0x0, -0x50(%rbp)
movq -0x48(%rbp), %r12
movq -0x78(%rbp), %r13
je 0x1da18
cmpb $0x0, -0x29(%rbp)
je 0x1d987
movq %rbx, %rdi
callq 0xae58
movq %rax, %r14
leaq 0x188f9(%rip), %rax     # 0x362e0
movq %rax, 0x8(%r14)
movq $0x0, (%r14)
movq $-0x1, 0x18(%r14)
incl 0x10(%r14)
movq (%rbx), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jle 0x1d97c
jmp 0x1d984
movl -0x3c(%rbp), %r15d
movq %rbx, %rdi
callq 0xae58
movq %rax, %r14
leaq 0x188b2(%rip), %rax     # 0x362e0
movq %rax, 0x8(%r14)
movq $0x0, (%r14)
movq %r15, 0x18(%r14)
incl 0x10(%r14)
movq (%rbx), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x2, %eax
jl 0x1d97c
jmp 0x1d984