// File: /workspace/github_c_makefile_star2_O1/msteveb[P]autosetup/./jimsh0.c
// Function: Jim_LsortCoreCommand
static int Jim_LsortCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const argv[])
{
    static const char * const options[] = {
        "-ascii", "-nocase", "-increasing", "-decreasing", "-command", "-integer", "-real", "-index", "-unique",
        "-stride", "-dictionary", NULL
    };
    enum {
        OPT_ASCII, OPT_NOCASE, OPT_INCREASING, OPT_DECREASING, OPT_COMMAND, OPT_INTEGER, OPT_REAL, OPT_INDEX, OPT_UNIQUE,
        OPT_STRIDE, OPT_DICT
    };
    Jim_Obj *resObj;
    int i;
    int retCode;
    int shared;
    long stride = 1;
    Jim_Obj **elements;
    int listlen;

    struct lsort_info info;

    if (argc < 2) {
wrongargs:
        Jim_WrongNumArgs(interp, 1, argv, "?options? list");
        return JIM_ERR;
    }

    info.type = JIM_LSORT_ASCII;
    info.order = 1;
    info.indexc = 0;
    info.unique = 0;
    info.command = NULL;
    info.interp = interp;

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

        if (Jim_GetEnum(interp, argv[i], options, &option, NULL, JIM_ENUM_ABBREV | JIM_ERRMSG)
            != JIM_OK)
            return JIM_ERR;
        switch (option) {
            case OPT_ASCII:
                info.type = JIM_LSORT_ASCII;
                break;
            case OPT_DICT:
                info.type = JIM_LSORT_DICT;
                break;
            case OPT_NOCASE:
                info.type = JIM_LSORT_NOCASE;
                break;
            case OPT_INTEGER:
                info.type = JIM_LSORT_INTEGER;
                break;
            case OPT_REAL:
                info.type = JIM_LSORT_REAL;
                break;
            case OPT_INCREASING:
                info.order = 1;
                break;
            case OPT_DECREASING:
                info.order = -1;
                break;
            case OPT_UNIQUE:
                info.unique = 1;
                break;
            case OPT_COMMAND:
                if (i >= (argc - 2)) {
                    Jim_SetResultString(interp, "\"-command\" option must be followed by comparison command", -1);
                    return JIM_ERR;
                }
                info.type = JIM_LSORT_COMMAND;
                info.command = argv[i + 1];
                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 < 2) {
                    Jim_SetResultString(interp, "stride length must be at least 2", -1);
                    return JIM_ERR;
                }
                break;
            case OPT_INDEX:
                if (i >= (argc - 2)) {
badindex:
                    Jim_SetResultString(interp, "\"-index\" option must be followed by list index", -1);
                    return JIM_ERR;
                }
                JimListGetElements(interp, argv[i + 1], &info.indexc, &info.indexv);
                if (info.indexc == 0) {
                    goto badindex;
                }
                i++;
                break;
        }
    }
    resObj = argv[argc - 1];
    JimListGetElements(interp, resObj, &listlen, &elements);
    if (listlen <= 1) {

        Jim_SetResult(interp, resObj);
        return JIM_OK;
    }

    if (stride > 1) {
        Jim_Obj *tmpListObj;
        int i;

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

        tmpListObj = Jim_NewListObj(interp, NULL, 0);
        Jim_IncrRefCount(tmpListObj);
        for (i = 0; i < listlen; i += stride) {
            Jim_ListAppendElement(interp, tmpListObj, Jim_NewListObj(interp, elements + i, stride));
        }
        retCode = ListSortElements(interp, tmpListObj, &info);
        if (retCode == JIM_OK) {
            resObj = Jim_NewListObj(interp, NULL, 0);

            for (i = 0; i < listlen; i += stride) {
                Jim_ListAppendList(interp, resObj, Jim_ListGetIndex(interp, tmpListObj, i / stride));
            }
            Jim_SetResult(interp, resObj);
        }
        Jim_DecrRefCount(interp, tmpListObj);
    }
    else {
        if ((shared = Jim_IsShared(resObj))) {
            resObj = Jim_DuplicateObj(interp, resObj);
        }
        retCode = ListSortElements(interp, resObj, &info);
        if (retCode == JIM_OK) {
            Jim_SetResult(interp, resObj);
        }
        else if (shared) {
            Jim_FreeNewObj(interp, resObj);
        }
    }
    return retCode;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rdx, %r15
movq %rdi, %rbx
cmpl $0x1, %esi
jg 0x1deed
leaq 0xf93c(%rip), %rcx      # 0x2d80e
movl $0x1, %r12d
movq %rbx, %rdi
movl $0x1, %esi
movq %r15, %rdx
callq 0x7454
jmp 0x1e34b
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, -0x78(%rbp)
xorl %eax, %eax
movq %rax, -0x68(%rbp)
movq %rax, -0x88(%rbp)
movq %rbx, -0x80(%rbp)
leal -0x1(%rsi), %eax
movl %eax, -0x38(%rbp)
movl $0x1, %eax
movq %rax, -0x40(%rbp)
movq %rsi, -0x30(%rbp)
cmpl $0x2, %esi
jne 0x1df6c
movl -0x38(%rbp), %eax
movq (%r15,%rax,8), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe338
movslq 0x20(%r14), %rcx
cmpq $0x1, %rcx
jg 0x1e16a
incl 0x10(%r14)
movq (%rbx), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x1df61
movq %rbx, %rdi
callq 0x759a
movq %r14, (%rbx)
xorl %r12d, %r12d
jmp 0x1e34b
movq -0x30(%rbp), %rax
addl $-0x2, %eax
movq %rax, -0x30(%rbp)
movl $0x1, %eax
movq %rax, -0x40(%rbp)
movl $0x1, %r14d
movslq %r14d, %r12
movq (%r15,%r12,8), %rsi
movq %rbx, %rdi
leaq 0x19339(%rip), %rdx     # 0x372d0
leaq -0x44(%rbp), %rcx
xorl %r8d, %r8d
movl $0x3, %r9d
callq 0x7e97
testl %eax, %eax
je 0x1dfca
movl $0x1, %r13d
testl %r13d, %r13d
jne 0x1e15e
incl %r14d
cmpl -0x38(%rbp), %r14d
jl 0x1df86
jmp 0x1df24
movl -0x44(%rbp), %eax
xorl %r13d, %r13d
cmpq $0xa, %rax
ja 0x1dfb3
leaq 0xa4eb(%rip), %rcx      # 0x284c8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x0, -0x78(%rbp)
jmp 0x1dfb3
cmpl -0x30(%rbp), %r14d
jge 0x1e0e4
movl $0x4, -0x78(%rbp)
incl %r14d
movq 0x8(%r15,%r12,8), %rax
movq %rax, -0x88(%rbp)
jmp 0x1dfb3
cmpl -0x30(%rbp), %r14d
jge 0x1e11f
movq 0x8(%r15,%r12,8), %r12
leaq 0x182b9(%rip), %rax     # 0x362e0
cmpq %rax, 0x8(%r12)
je 0x1e12a
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0xd6d7
testl %eax, %eax
je 0x1e12a
xorl %ecx, %ecx
jmp 0x1e131
movl $0x1, -0x74(%rbp)
jmp 0x1dfb3
movl $0xffffffff, -0x74(%rbp) # imm = 0xFFFFFFFF
jmp 0x1dfb3
cmpl -0x30(%rbp), %r14d
jge 0x1e0d8
movq 0x8(%r15,%r12,8), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0xe338
movl 0x20(%r12), %eax
movl %eax, -0x68(%rbp)
movq 0x18(%r12), %rcx
movq %rcx, -0x70(%rbp)
testl %eax, %eax
je 0x1e0d8
incl %r14d
jmp 0x1dfb3
movl $0x1, -0x78(%rbp)
jmp 0x1dfb3
movl $0x2, -0x78(%rbp)
jmp 0x1dfb3
movl $0x3, -0x78(%rbp)
jmp 0x1dfb3
movl $0x5, -0x78(%rbp)
jmp 0x1dfb3
movl $0x1, -0x64(%rbp)
jmp 0x1dfb3
movq %rbx, %rdi
leaq 0xf795(%rip), %rsi      # 0x2d877
jmp 0x1e0ee
movq %rbx, %rdi
leaq 0xf72f(%rip), %rsi      # 0x2d81d
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7516
movq %rax, %r12
incl 0x10(%rax)
movq (%rbx), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x1e117
movq %rbx, %rdi
callq 0x759a
movq %r12, (%rbx)
jmp 0x1dfad
movl $0x2, %r13d
jmp 0x1dfb3
movq 0x18(%r12), %rax
movb $0x1, %cl
incl %r14d
testb %cl, %cl
movq -0x40(%rbp), %rcx
cmovneq %rax, %rcx
movq %rcx, -0x40(%rbp)
je 0x1dfad
cmpq $0x1, %rcx
jg 0x1dfb3
movq %rbx, %rdi
leaq 0xf6fa(%rip), %rsi      # 0x2d856
jmp 0x1e0ee
cmpl $0x2, %r13d
je 0x1decb
jmp 0x1e1be
movq -0x40(%rbp), %r15
cmpq $0x2, %r15
jl 0x1e1c9
xorl %r12d, %r12d
movq %rcx, %rax
xorl %edx, %edx
divq %r15
testq %rdx, %rdx
je 0x1e213
leaq 0xf5ba(%rip), %rsi      # 0x2d749
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 0x1e1bb
movq %rbx, %rdi
callq 0x759a
movq %r14, (%rbx)
movl $0x1, %r12d
jmp 0x1e34b
movl 0x10(%r14), %r15d
cmpl $0x2, %r15d
jl 0x1e1e1
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8fa8
movq %rax, %r14
leaq -0x150(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x22f84
testl %eax, %eax
je 0x1df44
movl %eax, %r12d
cmpl $0x2, %r15d
jl 0x1e34b
movq %rbx, %rdi
movq %r14, %rsi
jmp 0x1e346
movq 0x18(%r14), %rax
movq %rax, -0x38(%rbp)
movq %rbx, %rdi
movq %rcx, %r14
callq 0xae58
movq %rax, %r13
leaq 0x18128(%rip), %rax     # 0x36358
movq %rax, 0x8(%r13)
movq $0x0, (%r13)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%r13)
incl 0x10(%r13)
movslq %r12d, %r12
movq -0x38(%rbp), %rax
leaq (%rax,%r12,8), %rsi
movq %rbx, %rdi
movl %r15d, %edx
callq 0x7640
movq %rbx, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x7695
addl %r15d, %r12d
cmpl %r14d, %r12d
jl 0x1e248
movq %r14, -0x58(%rbp)
leaq -0x150(%rbp), %rdx
movq %rbx, -0x50(%rbp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x22f84
movl %eax, %r12d
testl %eax, %eax
movq %r13, %rbx
jne 0x1e331
movq -0x50(%rbp), %r13
movq %r13, %rdi
callq 0xae58
movq %rax, %rcx
leaq 0x180a6(%rip), %rax     # 0x36358
movq %rax, 0x8(%rcx)
movq $0x0, (%rcx)
xorps %xmm0, %xmm0
movq %rcx, -0x38(%rbp)
movups %xmm0, 0x18(%rcx)
movq %rbx, -0x30(%rbp)
xorl %r14d, %r14d
movq -0x40(%rbp), %r15
movq -0x58(%rbp), %rbx
movslq %r14d, %r14
movq %r14, %rax
cqto
idivq %r15
movq %r13, %rdi
movq -0x30(%rbp), %rsi
movl %eax, %edx
callq 0xe871
movq %r13, %rdi
movq -0x38(%rbp), %rsi
movq %rax, %rdx
callq 0xe787
addl %r15d, %r14d
cmpl %ebx, %r14d
jl 0x1e2d7
movq -0x30(%rbp), %rbx
movq -0x38(%rbp), %r14
incl 0x10(%r14)
movq (%r13), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x1e32d
movq %r13, %rdi
callq 0x759a
movq %r14, (%r13)
movl 0x10(%rbx), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rbx)
cmpl $0x1, %eax
jg 0x1e34b
movq -0x50(%rbp), %rdi
movq %rbx, %rsi
callq 0x759a
movl %r12d, %eax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq