// File: /workspace/github_c_makefile_star2_O2/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 $0x1, -0x58(%rbp)
cmpl $0x1, %esi
jg 0x1ac4f
leaq 0xdbc5(%rip), %rcx      # 0x28800
pushq $0x1
popq %r14
movl %r14d, %esi
movq %r15, %rdx
callq 0x72a5
jmp 0x1afa8
pushq $0x1
popq %r13
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, -0x78(%rbp)
andq $0x0, -0x68(%rbp)
andq $0x0, -0x88(%rbp)
movq %rdi, -0x30(%rbp)
movq %rdi, -0x80(%rbp)
leal -0x1(%rsi), %ebx
addl $-0x2, %esi
movq %rsi, -0x38(%rbp)
pushq $0x1
popq %rax
movq %rax, -0x40(%rbp)
leaq 0x879e(%rip), %r12      # 0x2342c
cmpl %ebx, %r13d
jge 0x1adb1
movslq %r13d, %r14
movq (%r15,%r14,8), %rsi
movq -0x30(%rbp), %rdi
leaq 0x17627(%rip), %rdx     # 0x322d0
leaq -0x4c(%rbp), %rcx
xorl %r8d, %r8d
pushq $0x3
popq %r9
callq 0x7b44
testl %eax, %eax
jne 0x1afa4
movl -0x4c(%rbp), %eax
cmpq $0xa, %rax
ja 0x1ada9
movslq (%r12,%rax,4), %rax
addq %r12, %rax
jmpq *%rax
andl $0x0, -0x78(%rbp)
jmp 0x1ada9
cmpl -0x38(%rbp), %r13d
jge 0x1af5a
movl $0x4, -0x78(%rbp)
incl %r13d
movq 0x8(%r15,%r14,8), %rax
movq %rax, -0x88(%rbp)
jmp 0x1ada9
cmpl -0x38(%rbp), %r13d
jge 0x1af63
movq 0x8(%r15,%r14,8), %rsi
movq -0x30(%rbp), %rdi
leaq -0x58(%rbp), %rdx
callq 0xc8cb
testl %eax, %eax
jne 0x1afa4
movq -0x58(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpq $0x1, %rax
jg 0x1ad79
jmp 0x1af6c
movl $0x1, -0x74(%rbp)
jmp 0x1ada9
orl $-0x1, -0x74(%rbp)
jmp 0x1ada9
cmpl -0x38(%rbp), %r13d
jge 0x1ae99
movq 0x8(%r15,%r14,8), %r14
movq -0x30(%rbp), %rdi
movq %r14, %rsi
callq 0x8b3c
movl %eax, -0x68(%rbp)
movq 0x18(%r14), %rcx
movq %rcx, -0x70(%rbp)
testl %eax, %eax
je 0x1ae99
incl %r13d
jmp 0x1ada9
movl $0x1, -0x78(%rbp)
jmp 0x1ada9
movl $0x2, -0x78(%rbp)
jmp 0x1ada9
movl $0x3, -0x78(%rbp)
jmp 0x1ada9
movl $0x5, -0x78(%rbp)
jmp 0x1ada9
movl $0x1, -0x64(%rbp)
incl %r13d
jmp 0x1ac8e
movl %ebx, %eax
movq (%r15,%rax,8), %r12
movq -0x30(%rbp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x8b3c
cmpl $0x1, %eax
jg 0x1adf6
incl 0x10(%r12)
movq (%r13), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x1adea
movq %r13, %rdi
callq 0x73bf
movq %r12, (%r13)
xorl %r14d, %r14d
jmp 0x1afa8
movq -0x40(%rbp), %rcx
cmpq $0x2, %rcx
jl 0x1ae50
movl %eax, %r15d
movl %eax, %eax
xorl %ebx, %ebx
xorl %edx, %edx
divq %rcx
testq %rdx, %rdx
je 0x1aea5
leaq 0xd91f(%rip), %rsi      # 0x2873b
pushq $-0x1
popq %rdx
movq %r13, %rdi
callq 0x7363
movq %rax, %r14
incl 0x10(%rax)
movq (%r13), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x1ae47
movq %r13, %rdi
callq 0x73bf
movq %r14, (%r13)
jmp 0x1afa4
movl 0x10(%r12), %ebx
cmpl $0x2, %ebx
jl 0x1ae68
movq %r13, %rdi
movq %r12, %rsi
callq 0x8a95
movq %rax, %r12
leaq -0x150(%rbp), %rdx
movq %r13, %rdi
movq %r12, %rsi
callq 0x1f7ad
testl %eax, %eax
je 0x1adcb
movl %eax, %r14d
cmpl $0x2, %ebx
jl 0x1afa8
movq %r13, %rdi
movq %r12, %rsi
jmp 0x1b002
leaq 0xd9c9(%rip), %rsi      # 0x28869
jmp 0x1af73
movq 0x18(%r12), %r14
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x745b
movq %rax, -0x38(%rbp)
incl 0x10(%rax)
movq -0x40(%rbp), %r12
cmpl %r15d, %ebx
jge 0x1aeec
movslq %ebx, %rax
leaq (%r14,%rax,8), %rsi
movq %r13, %rdi
movl %r12d, %edx
callq 0x745b
movq %r13, %rdi
movq -0x38(%rbp), %rsi
movq %rax, %rdx
callq 0x74ad
addl %r12d, %ebx
jmp 0x1aec1
leaq -0x150(%rbp), %rdx
movq %r13, %rdi
movq -0x38(%rbp), %rbx
movq %rbx, %rsi
callq 0x1f7ad
movl %eax, %r14d
testl %eax, %eax
jne 0x1afee
xorl %ebx, %ebx
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x745b
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %r12
movq -0x30(%rbp), %r13
cmpl %r15d, %ebx
jge 0x1afbd
movslq %ebx, %rax
cqto
idivq %r12
movq %r13, %rdi
movq -0x38(%rbp), %rsi
movl %eax, %edx
callq 0xd95e
movq %r13, %rdi
movq -0x48(%rbp), %rsi
movq %rax, %rdx
callq 0xd8ad
addl %r12d, %ebx
jmp 0x1af27
leaq 0xd8ae(%rip), %rsi      # 0x2880f
jmp 0x1af73
movq -0x30(%rbp), %rdi
jmp 0x1ac34
leaq 0xd8d5(%rip), %rsi      # 0x28848
pushq $-0x1
popq %rdx
movq -0x30(%rbp), %rbx
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 $0x2, %eax
jge 0x1afa1
movq %rbx, %rdi
callq 0x73bf
movq %r14, (%rbx)
pushq $0x1
popq %r14
movl %r14d, %eax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x48(%rbp), %rax
incl 0x10(%rax)
movq -0x30(%rbp), %r13
movq (%r13), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x1afe2
movq %r13, %rdi
callq 0x73bf
movq -0x48(%rbp), %rax
movq %rax, (%r13)
movq -0x38(%rbp), %rbx
movl 0x10(%rbx), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rbx)
cmpl $0x1, %eax
jg 0x1afa8
movq %r13, %rdi
movq %rbx, %rsi
callq 0x73bf
jmp 0x1afa8