// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/redis-cli.c
// Function: repl
static void repl(void) {
    sds historyfile = NULL;
    int history = 0;
    char *line;
    int argc;
    sds *argv;

    /* Initialize the help and, if possible, use the COMMAND command in order
     * to retrieve missing entries. */
    cliInitHelp();
    cliIntegrateHelp();

    config.interactive = 1;
    linenoiseSetMultiLine(1);
    linenoiseSetCompletionCallback(completionCallback);
    linenoiseSetHintsCallback(hintsCallback);
    linenoiseSetFreeHintsCallback(freeHintsCallback);

    /* Only use history and load the rc file when stdin is a tty. */
    if (isatty(fileno(stdin))) {
        historyfile = getDotfilePath(REDIS_CLI_HISTFILE_ENV,REDIS_CLI_HISTFILE_DEFAULT);
        if (historyfile != NULL) {
            history = 1;
            linenoiseHistoryLoad(historyfile);
        }
        cliLoadPreferences();
    }

    cliRefreshPrompt();
    while((line = linenoise(context ? config.prompt : "not connected> ")) != NULL) {
        if (line[0] != '\0') {
            argv = cliSplitArgs(line,&argc);
            if (history) linenoiseHistoryAdd(line);
            if (historyfile) linenoiseHistorySave(historyfile);

            if (argv == NULL) {
                printf("Invalid argument(s)\n");
                linenoiseFree(line);
                continue;
            } else if (argc > 0) {
                if (strcasecmp(argv[0],"quit") == 0 ||
                    strcasecmp(argv[0],"exit") == 0)
                {
                    exit(0);
                } else if (argv[0][0] == ':') {
                    cliSetPreferences(argv,argc,1);
                    continue;
                } else if (strcasecmp(argv[0],"restart") == 0) {
                    if (config.eval) {
                        config.eval_ldb = 1;
                        config.output = OUTPUT_RAW;
                        return; /* Return to evalMode to restart the session. */
                    } else {
                        printf("Use 'restart' only in Lua debugging mode.");
                    }
                } else if (argc == 3 && !strcasecmp(argv[0],"connect")) {
                    sdsfree(config.hostip);
                    config.hostip = sdsnew(argv[1]);
                    config.hostport = atoi(argv[2]);
                    cliRefreshPrompt();
                    cliConnect(1);
                } else if (argc == 1 && !strcasecmp(argv[0],"clear")) {
                    linenoiseClearScreen();
                } else {
                    long long start_time = mstime(), elapsed;
                    int repeat, skipargs = 0;
                    char *endptr;

                    repeat = strtol(argv[0], &endptr, 10);
                    if (argc > 1 && *endptr == '\0' && repeat) {
                        skipargs = 1;
                    } else {
                        repeat = 1;
                    }

                    issueCommandRepeat(argc-skipargs, argv+skipargs, repeat);

                    /* If our debugging session ended, show the EVAL final
                     * reply. */
                    if (config.eval_ldb_end) {
                        config.eval_ldb_end = 0;
                        cliReadReply(0);
                        printf("\n(Lua debugging session ended%s)\n\n",
                            config.eval_ldb_sync ? "" :
                            " -- dataset changes rolled back");
                    }

                    elapsed = mstime()-start_time;
                    if (elapsed >= 500 &&
                        config.output == OUTPUT_STANDARD)
                    {
                        printf("(%.2fs)\n",(double)elapsed/1000);
                    }
                }
            }
            /* Free the argument vector */
            sdsfreesplitres(argv,argc);
        }
        /* linenoise() returns malloc-ed lines like readline() */
        linenoiseFree(line);
    }
    exit(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq $0x0, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
callq 0x18450
callq 0x18610
movl $0x1, 0x8af59(%rip)     # 0xa14b4
movl $0x1, %edi
callq 0x22270
leaq 0x23d4(%rip), %rdi      # 0x18940
callq 0x222c0
leaq 0x2528(%rip), %rdi      # 0x18aa0
callq 0x222e0
leaq 0x274c(%rip), %rdi      # 0x18cd0
callq 0x22300
movq 0x88a38(%rip), %rax     # 0x9efc8
movq (%rax), %rdi
callq 0x103d0
movl %eax, %edi
callq 0x100d0
cmpl $0x0, %eax
je 0x165d7
leaq 0x762f6(%rip), %rdi     # 0x8c8a1
leaq 0x76301(%rip), %rsi     # 0x8c8b3
callq 0x13060
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x165d2
movl $0x1, -0xc(%rbp)
movq -0x8(%rbp), %rdi
callq 0x23570
callq 0x12f90
callq 0x17480
movq 0x8aff5(%rip), %rcx     # 0xa15d8
leaq 0x762db(%rip), %rdi     # 0x8c8c5
leaq 0x8ae97(%rip), %rax     # 0xa1488
addq $0xb0, %rax
cmpq $0x0, %rcx
cmovneq %rax, %rdi
callq 0x22e80
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x168d0
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x168c2
movq -0x18(%rbp), %rdi
leaq -0x1c(%rbp), %rsi
callq 0x18cf0
movq %rax, -0x28(%rbp)
cmpl $0x0, -0xc(%rbp)
je 0x16642
movq -0x18(%rbp), %rdi
callq 0x23250
cmpq $0x0, -0x8(%rbp)
je 0x16652
movq -0x8(%rbp), %rdi
callq 0x234c0
cmpq $0x0, -0x28(%rbp)
jne 0x16675
leaq 0x76275(%rip), %rdi     # 0x8c8d5
movb $0x0, %al
callq 0x101d0
movq -0x18(%rbp), %rdi
callq 0x23230
jmp 0x165dc
cmpl $0x0, -0x1c(%rbp)
jle 0x168b4
movq -0x28(%rbp), %rax
movq (%rax), %rdi
leaq 0x7625d(%rip), %rsi     # 0x8c8ea
callq 0x10060
cmpl $0x0, %eax
je 0x166af
movq -0x28(%rbp), %rax
movq (%rax), %rdi
leaq 0x7624a(%rip), %rsi     # 0x8c8ef
callq 0x10060
cmpl $0x0, %eax
jne 0x166b6
xorl %edi, %edi
callq 0x10600
movq -0x28(%rbp), %rax
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
jne 0x166db
movq -0x28(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl $0x1, %edx
callq 0x12ea0
jmp 0x165dc
movq -0x28(%rbp), %rax
movq (%rax), %rdi
leaq 0x7620b(%rip), %rsi     # 0x8c8f4
callq 0x10060
cmpl $0x0, %eax
jne 0x1672a
cmpq $0x0, 0x8aebd(%rip)     # 0xa15b8
je 0x16717
movl $0x1, 0x8aeb9(%rip)     # 0xa15c0
movl $0x1, 0x8ae17(%rip)     # 0xa1528
addq $0x50, %rsp
popq %rbp
retq
leaq 0x761de(%rip), %rdi     # 0x8c8fc
movb $0x0, %al
callq 0x101d0
jmp 0x168ae
cmpl $0x3, -0x1c(%rbp)
jne 0x1678f
movq -0x28(%rbp), %rax
movq (%rax), %rdi
leaq 0x761e8(%rip), %rsi     # 0x8c926
callq 0x10060
cmpl $0x0, %eax
jne 0x1678f
movq 0x8ad39(%rip), %rdi     # 0xa1488
callq 0x1ee80
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x1ed70
movq %rax, 0x8ad20(%rip)     # 0xa1488
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x105c0
movl %eax, 0x8ad15(%rip)     # 0xa1490
callq 0x17480
movl $0x1, %edi
callq 0x14530
jmp 0x168ac
cmpl $0x1, -0x1c(%rbp)
jne 0x167b7
movq -0x28(%rbp), %rax
movq (%rax), %rdi
leaq 0x7618b(%rip), %rsi     # 0x8c92e
callq 0x10060
cmpl $0x0, %eax
jne 0x167b7
callq 0x22290
jmp 0x168aa
callq 0x16f20
movq %rax, -0x30(%rbp)
movl $0x0, -0x40(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rdi
leaq -0x48(%rbp), %rsi
movl $0xa, %edx
callq 0x103a0
movl %eax, -0x3c(%rbp)
cmpl $0x1, -0x1c(%rbp)
jle 0x16800
movq -0x48(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x16800
cmpl $0x0, -0x3c(%rbp)
je 0x16800
movl $0x1, -0x40(%rbp)
jmp 0x16807
movl $0x1, -0x3c(%rbp)
movl -0x1c(%rbp), %edi
subl -0x40(%rbp), %edi
movq -0x28(%rbp), %rsi
movslq -0x40(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
movslq -0x3c(%rbp), %rdx
callq 0x18df0
cmpl $0x0, 0x8ad9c(%rip)     # 0xa15c8
je 0x16868
movl $0x0, 0x8ad90(%rip)     # 0xa15c8
xorl %edi, %edi
callq 0x17150
movl 0x8ad7f(%rip), %ecx     # 0xa15c4
leaq 0x7610b(%rip), %rsi     # 0x8c957
leaq 0x77a95(%rip), %rax     # 0x8e2e8
cmpl $0x0, %ecx
cmovneq %rax, %rsi
leaq 0x760d3(%rip), %rdi     # 0x8c934
movb $0x0, %al
callq 0x101d0
callq 0x16f20
subq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpq $0x1f4, -0x38(%rbp)     # imm = 0x1F4
jl 0x168a8
cmpl $0x0, 0x8aca2(%rip)     # 0xa1528
jne 0x168a8
cvtsi2sdq -0x38(%rbp), %xmm0
movsd 0x7094a(%rip), %xmm1    # 0x871e0
divsd %xmm1, %xmm0
leaq 0x760d6(%rip), %rdi     # 0x8c977
movb $0x1, %al
callq 0x101d0
jmp 0x168aa
jmp 0x168ac
jmp 0x168ae
jmp 0x168b0
jmp 0x168b2
jmp 0x168b4
jmp 0x168b6
movq -0x28(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x20ad0
movq -0x18(%rbp), %rdi
callq 0x23230
jmp 0x165dc
xorl %edi, %edi
callq 0x10600
nopw (%rax,%rax)