// File: /workspace/github_c_makefile_star2_O1/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 0x18d3c(%rip), %rdi     # 0x2c335
xorl %esi, %esi
movl $0x54, %edx
xorl %eax, %eax
callq 0x61d0
leaq 0x18824(%rip), %rsi     # 0x2be32
leaq 0x199a9(%rip), %rdx     # 0x2cfbe
movq %rbx, %rdi
callq 0xc488
leaq -0x40(%rbp), %r14
xorl %r13d, %r13d
testl %r13d, %r13d
je 0x13664
leaq 0x18e39(%rip), %rcx     # 0x2c469
cmpl $0x7, %r13d
ja 0x13644
movl %r13d, %eax
leaq 0x22d90(%rip), %rcx     # 0x363d0
movq (%rcx,%rax,8), %rcx
cmpb $0x3f, (%rcx)
jne 0x13670
movl $0x11, %esi
movq %r14, %rdi
leaq 0x18cfb(%rip), %rdx     # 0x2c353
movl %r13d, %ecx
xorl %eax, %eax
callq 0x61e0
jmp 0x13686
movb $0x0, -0x3e(%rbp)
movw $0x202e, -0x40(%rbp)    # imm = 0x202E
jmp 0x13686
movl $0x11, %esi
movq %r14, %rdi
leaq 0x18cdc(%rip), %rdx     # 0x2c35b
xorl %eax, %eax
callq 0x61e0
movq %rbx, %rdi
callq 0xae58
movq %rax, %r15
leaq 0x24c00(%rip), %rax     # 0x38298
movq %rax, (%r15)
movl $0x0, 0x14(%r15)
movq $0x0, 0x8(%r15)
incl 0x10(%r15)
movq %r14, %rsi
callq 0x13522
testq %rax, %rax
je 0x1374b
movq %rax, %r12
cmpq $0x0, (%r15)
jne 0x136d3
movq 0x8(%r15), %rax
movq %r15, %rdi
callq *0x18(%rax)
cmpl $0x0, 0x14(%r15)
je 0x136f1
movq %rbx, %rdi
movq %r15, %rsi
leaq 0x192fa(%rip), %rdx     # 0x2c9e1
movl $0x1, %ecx
callq 0x8653
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x8653
movq %r12, %rdi
xorl %esi, %esi
callq *0x24b79(%rip)          # 0x38288
movq %rbx, %rdi
movq %r15, %rsi
callq 0xb66b
movl 0x24(%rax), %eax
movl $0x5, %r12d
cmpl $0x20, %eax
je 0x1377f
cmpl $0x7d, %eax
je 0x1377f
movsbl %al, %ecx
xorl %r12d, %r12d
movl $0x14, %esi
movq %r14, %rdi
leaq 0x18c21(%rip), %rdx     # 0x2c363
xorl %eax, %eax
callq 0x61e0
jmp 0x1377f
callq 0x6080
movl $0x4, %r12d
cmpl $0x4, (%rax)
je 0x1377f
movl 0x10(%r15), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%r15)
movl $0x6, %r12d
xorl %r13d, %r13d
cmpl $0x1, %eax
jg 0x1377f
movq %rbx, %rdi
movq %r15, %rsi
callq 0x759a
testl %r12d, %r12d
je 0x136af
cmpl $0x4, %r12d
je 0x136af
cmpl $0x5, %r12d
jne 0x13821
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9078
movl %eax, %r13d
movl 0x10(%r15), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%r15)
cmpl $0x1, %eax
jg 0x137c5
movq %rbx, %rdi
movq %r15, %rsi
callq 0x759a
cmpl $0x6, %r13d
je 0x1381b
cmpl $0x1, %r13d
jne 0x137d9
movq %rbx, %rdi
callq 0x118b4
movq (%rbx), %r15
cmpq $0x0, (%r15)
jne 0x137ec
movq 0x8(%r15), %rax
movq %r15, %rdi
callq *0x18(%rax)
movslq 0x14(%r15), %rsi
xorl %r12d, %r12d
testq %rsi, %rsi
je 0x13821
movq (%r15), %rdi
movq 0x24776(%rip), %rax     # 0x37f78
movq (%rax), %rcx
movl $0x1, %edx
callq 0x6490
movl $0xa, %edi
callq 0x6050
jmp 0x13821
movl $0x3, %r12d
testl %r12d, %r12d
je 0x13624
cmpl $0x6, %r12d
je 0x13836
cmpl $0x3, %r12d
jne 0x13840
xorl %edi, %edi
xorl %esi, %esi
callq *0x24a48(%rip)          # 0x38288
movl %r13d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq