// File: /workspace/github_c_makefile_star2_O2/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 $0x28, %rsp
movq %rdi, %rbx
leaq 0x1573d(%rip), %rdi     # 0x2732d
pushq $0x54
popq %rdx
xorl %esi, %esi
xorl %eax, %eax
callq 0x61d0
leaq 0x15227(%rip), %rsi     # 0x26e2a
leaq 0x163a6(%rip), %rdx     # 0x27fb0
movq %rbx, %rdi
callq 0xb9a9
leaq -0x50(%rbp), %r15
leaq -0x29(%rbp), %r13
xorl %r12d, %r12d
testl %r12d, %r12d
je 0x11c5b
leaq 0x15835(%rip), %rcx     # 0x2745e
cmpl $0x7, %r12d
ja 0x11c3d
movl %r12d, %eax
leaq 0x1f847(%rip), %rcx     # 0x31480
movq (%rcx,%rax,8), %rcx
cmpb $0x3f, (%rcx)
jne 0x11c67
movq %r15, %rdi
pushq $0x11
popq %rsi
leaq 0x156fc(%rip), %rdx     # 0x2734b
movl %r12d, %ecx
xorl %eax, %eax
callq 0x61e0
jmp 0x11c7b
movb $0x0, -0x4e(%rbp)
movw $0x202e, -0x50(%rbp)    # imm = 0x202E
jmp 0x11c7b
movq %r15, %rdi
pushq $0x11
popq %rsi
leaq 0x156df(%rip), %rdx     # 0x27353
xorl %eax, %eax
callq 0x61e0
movq %rbx, %rdi
leaq 0x179bc(%rip), %rsi     # 0x29641
xorl %edx, %edx
callq 0x7363
movq %rax, %r14
incl 0x10(%rax)
movq %r15, %rsi
callq 0x11b19
testq %rax, %rax
je 0x11d0b
movq %rax, %r12
movq %r14, %rdi
callq 0xa61a
testl %eax, %eax
je 0x11cc3
movq %rbx, %rdi
movq %r14, %rsi
leaq 0x15d18(%rip), %rdx     # 0x279d3
pushq $0x1
popq %rcx
callq 0x823a
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
pushq $-0x1
popq %rcx
callq 0x823a
movq %r12, %rdi
xorl %esi, %esi
callq *0x215a9(%rip)          # 0x33288
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0xad59
testl %eax, %eax
jne 0x11d1b
movsbl -0x29(%rbp), %ecx
movq %r15, %rdi
pushq $0x14
popq %rsi
leaq 0x15659(%rip), %rdx     # 0x2735b
xorl %eax, %eax
callq 0x61e0
jmp 0x11c92
callq 0x6080
cmpl $0x4, (%rax)
je 0x11c92
jmp 0x11d95
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8b54
movl %eax, %r12d
movl 0x10(%r14), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%r14)
cmpl $0x1, %eax
jg 0x11d44
movq %rbx, %rdi
movq %r14, %rsi
callq 0x73bf
cmpl $0x1, %r12d
je 0x11d52
cmpl $0x6, %r12d
jne 0x11d5a
jmp 0x11db3
movq %rbx, %rdi
callq 0x104aa
movq (%rbx), %rdi
leaq -0x30(%rbp), %rsi
callq 0x7fc7
movslq -0x30(%rbp), %rsi
testq %rsi, %rsi
je 0x11c1d
movq 0x211fe(%rip), %rcx     # 0x32f78
movq (%rcx), %rcx
movq %rax, %rdi
pushq $0x1
popq %rdx
callq 0x6490
pushq $0xa
popq %rdi
callq 0x6050
jmp 0x11c1d
movl 0x10(%r14), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%r14)
cmpl $0x1, %eax
jg 0x11db0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x73bf
xorl %r12d, %r12d
xorl %edi, %edi
xorl %esi, %esi
callq *0x214cb(%rip)          # 0x33288
movl %r12d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq