// File: /workspace/github_c_makefile_star2_O0/msteveb[P]autosetup/./jimsh0.c
// Function: SetIndexFromAny
static int SetIndexFromAny(Jim_Interp *interp, Jim_Obj *objPtr)
{
    jim_wide idx;
    int end = 0;
    const char *str;
    Jim_Obj *exprObj = objPtr;

    JimPanic((objPtr->refCount == 0, "SetIndexFromAny() called with zero refcount object"));


    str = Jim_String(objPtr);


    if (strncmp(str, "end", 3) == 0) {
        end = 1;
        str += 3;
        idx = 0;
        switch (*str) {
            case '\0':
                exprObj = NULL;
                break;

            case '-':
            case '+':
                exprObj = Jim_NewStringObj(interp, str, -1);
                break;

            default:
                goto badindex;
        }
    }
    if (exprObj) {
        int ret;
        Jim_IncrRefCount(exprObj);
        ret = Jim_GetWideExpr(interp, exprObj, &idx);
        Jim_DecrRefCount(interp, exprObj);
        if (ret != JIM_OK) {
            goto badindex;
        }
    }

    if (end) {
        if (idx > 0) {
            idx = INT_MAX;
        }
        else {

            idx--;
        }
    }
    else if (idx < 0) {
        idx = -INT_MAX;
    }


    Jim_FreeIntRep(interp, objPtr);
    objPtr->typePtr = &indexObjType;
    objPtr->internalRep.intValue = idx;
    return JIM_OK;

  badindex:
    Jim_SetResultFormatted(interp,
        "bad index \"%#s\": must be intexpr or end?[+-]intexpr?", objPtr);
    return JIM_ERR;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
callq 0x7960
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
leaq 0x2ace6(%rip), %rsi     # 0x3c6ad
movl $0x3, %edx
callq 0x60b0
cmpl $0x0, %eax
jne 0x11a3e
movl $0x1, -0x24(%rbp)
movq -0x30(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x30(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x40(%rbp)
testl %eax, %eax
je 0x11a15
jmp 0x11a01
movl -0x40(%rbp), %eax
subl $0x2b, %eax
je 0x11a1f
jmp 0x11a0b
movl -0x40(%rbp), %eax
subl $0x2d, %eax
je 0x11a1f
jmp 0x11a37
movq $0x0, -0x38(%rbp)
jmp 0x11a3c
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7990
movq %rax, -0x38(%rbp)
jmp 0x11a3c
jmp 0x11b1d
jmp 0x11a3e
cmpq $0x0, -0x38(%rbp)
je 0x11a92
movq -0x38(%rbp), %rax
movl 0x10(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq -0x20(%rbp), %rdx
callq 0xf830
movl %eax, -0x3c(%rbp)
movq -0x38(%rbp), %rcx
movl 0x10(%rcx), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rcx)
cmpl $0x0, %eax
jg 0x11a85
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x7a10
cmpl $0x0, -0x3c(%rbp)
je 0x11a90
jmp 0x11b1d
jmp 0x11a92
cmpl $0x0, -0x24(%rbp)
je 0x11ab7
cmpq $0x0, -0x20(%rbp)
jle 0x11aa9
movq $0x7fffffff, -0x20(%rbp) # imm = 0x7FFFFFFF
jmp 0x11ab5
movq -0x20(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x11ac8
cmpq $0x0, -0x20(%rbp)
jge 0x11ac6
movq $-0x7fffffff, -0x20(%rbp) # imm = 0x80000001
jmp 0x11ac8
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x11af8
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
cmpq $0x0, 0x8(%rax)
je 0x11af8
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq *%rax
movq -0x18(%rbp), %rax
leaq 0x349b5(%rip), %rcx     # 0x464b8
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x18(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x11b3a
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x2a612(%rip), %rsi     # 0x3c13e
movb $0x0, %al
callq 0x6b40
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)