// File: /workspace/github_c_makefile_star2_O3/msteveb[P]autosetup/./jimsh0.c
// Function: Jim_InteractivePrompt
int Jim_InteractivePrompt(Jim_Interp *interp)
{
    int retcode = JIM_OK;
    char *history_file = NULL;
#ifdef USE_LINENOISE
    const char *home;

    home = getenv("HOME");
    if (home && isatty(STDIN_FILENO)) {
        int history_len = strlen(home) + sizeof("/.jim_history");
        history_file = Jim_Alloc(history_len);
        snprintf(history_file, history_len, "%s/.jim_history", home);
        Jim_HistoryLoad(history_file);
    }

    Jim_HistorySetCompletion(interp, Jim_NewStringObj(interp, "tcl::autocomplete", -1));
    Jim_HistorySetHints(interp, Jim_NewStringObj(interp, "tcl::stdhint", -1));
#endif

    printf("Welcome to Jim version %d.%d\n",
        JIM_VERSION / 100, JIM_VERSION % 100);
    Jim_SetVariableStrWithStr(interp, JIM_INTERACTIVE, "1");

    while (1) {
        Jim_Obj *scriptObjPtr;
        const char *result;
        int reslen;
        char prompt[20];

        if (retcode != JIM_OK) {
            const char *retcodestr = Jim_ReturnCode(retcode);

            if (*retcodestr == '?') {
                snprintf(prompt, sizeof(prompt) - 3, "[%d] . ", retcode);
            }
            else {
                snprintf(prompt, sizeof(prompt) - 3, "[%s] . ", retcodestr);
            }
        }
        else {
            strcpy(prompt, ". ");
        }

        scriptObjPtr = Jim_NewStringObj(interp, "", 0);
        Jim_IncrRefCount(scriptObjPtr);
        while (1) {
            char state;
            char *line;

            line = Jim_HistoryGetline(interp, prompt);
            if (line == NULL) {
                if (errno == EINTR) {
                    continue;
                }
                Jim_DecrRefCount(interp, scriptObjPtr);
                retcode = JIM_OK;
                goto out;
            }
            if (Jim_Length(scriptObjPtr) != 0) {

                Jim_AppendString(interp, scriptObjPtr, "\n", 1);
            }
            Jim_AppendString(interp, scriptObjPtr, line, -1);
            Jim_Free(line);
            if (Jim_ScriptIsComplete(interp, scriptObjPtr, &state))
                break;

            snprintf(prompt, sizeof(prompt), "%c> ", state);
        }
#ifdef USE_LINENOISE
        if (strcmp(Jim_String(scriptObjPtr), "h") == 0) {

            Jim_HistoryShow();
            Jim_DecrRefCount(interp, scriptObjPtr);
            continue;
        }

        Jim_HistoryAdd(Jim_String(scriptObjPtr));
        if (history_file) {
            Jim_HistorySave(history_file);
        }
#endif
        retcode = Jim_EvalObj(interp, scriptObjPtr);
        Jim_DecrRefCount(interp, scriptObjPtr);

        if (retcode == JIM_EXIT) {
            break;
        }
        if (retcode == JIM_ERR) {
            Jim_MakeErrorMessage(interp);
        }
        result = Jim_GetString(Jim_GetResult(interp), &reslen);
        if (reslen) {
            if (fwrite(result, reslen, 1, stdout) == 0) {

            }
            putchar('\n');
        }
    }
  out:
    Jim_Free(history_file);

    return retcode;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x180d8(%rip), %rdi     # 0x2b2dd
xorl %esi, %esi
movl $0x54, %edx
xorl %eax, %eax
callq 0x61d0
leaq 0x17bc0(%rip), %rsi     # 0x2adda
leaq 0x18d3f(%rip), %rdx     # 0x2bf60
movq %rbx, %rdi
callq 0xc4a3
leaq -0x40(%rbp), %r14
leaq 0x180d7(%rip), %r15     # 0x2b30b
xorl %r13d, %r13d
testl %r13d, %r13d
je 0x13277
leaq 0x181cb(%rip), %rcx     # 0x2b40e
cmpl $0x7, %r13d
ja 0x13257
movl %r13d, %eax
leaq 0x2218d(%rip), %rcx     # 0x353e0
movq (%rcx,%rax,8), %rcx
cmpb $0x3f, (%rcx)
jne 0x13283
movl $0x11, %esi
movq %r14, %rdi
leaq 0x18090(%rip), %rdx     # 0x2b2fb
movl %r13d, %ecx
xorl %eax, %eax
callq 0x61e0
jmp 0x13299
movb $0x0, -0x3e(%rbp)
movw $0x202e, -0x40(%rbp)    # imm = 0x202E
jmp 0x13299
movl $0x11, %esi
movq %r14, %rdi
leaq 0x18071(%rip), %rdx     # 0x2b303
xorl %eax, %eax
callq 0x61e0
movq %rbx, %rdi
callq 0xae38
movq %rax, %r12
leaq 0x23fed(%rip), %rax     # 0x37298
movq %rax, (%r12)
movl $0x0, 0x14(%r12)
movq $0x0, 0x8(%r12)
incl 0x10(%r12)
movq %r14, %rsi
callq 0x1312e
testq %rax, %rax
je 0x1335b
movq %rax, %r13
cmpq $0x0, (%r12)
jne 0x132ec
movq 0x8(%r12), %rax
movq %r12, %rdi
callq *0x18(%rax)
cmpl $0x0, 0x14(%r12)
je 0x1330b
movq %rbx, %rdi
movq %r12, %rsi
leaq 0x18682(%rip), %rdx     # 0x2b983
movl $0x1, %ecx
callq 0x86a0
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x86a0
movq %r13, %rdi
xorl %esi, %esi
callq *0x23f5f(%rip)          # 0x37288
movq %rbx, %rdi
movq %r12, %rsi
callq 0xb679
movl 0x24(%rax), %eax
cmpl $0x20, %eax
je 0x1336e
cmpl $0x7d, %eax
je 0x1336e
movsbl %al, %ecx
movl $0x14, %esi
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x61e0
jmp 0x132c6
callq 0x6080
cmpl $0x4, (%rax)
je 0x132c6
jmp 0x133f9
movq %rbx, %rdi
movq %r12, %rsi
callq 0x908a
movl %eax, %r13d
movl 0x10(%r12), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%r12)
cmpl $0x1, %eax
jg 0x13399
movq %rbx, %rdi
movq %r12, %rsi
callq 0x758c
cmpl $0x1, %r13d
je 0x133a7
cmpl $0x6, %r13d
jne 0x133af
jmp 0x13419
movq %rbx, %rdi
callq 0x1178b
movq (%rbx), %r12
cmpq $0x0, (%r12)
jne 0x133c4
movq 0x8(%r12), %rax
movq %r12, %rdi
callq *0x18(%rax)
movslq 0x14(%r12), %rsi
testq %rsi, %rsi
je 0x13237
movq (%r12), %rdi
movq 0x23b9b(%rip), %rax     # 0x36f78
movq (%rax), %rcx
movl $0x1, %edx
callq 0x6490
movl $0xa, %edi
callq 0x6050
jmp 0x13237
movl 0x10(%r12), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%r12)
xorl %r13d, %r13d
cmpl $0x1, %eax
jg 0x13419
movq %rbx, %rdi
movq %r12, %rsi
callq 0x758c
xorl %edi, %edi
xorl %esi, %esi
callq *0x23e65(%rip)          # 0x37288
movl %r13d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq