// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl $0xd3, 0x41b4e(%rip)    # 0x5a564
movl $0x1a60, %edi           # imm = 0x1A60
callq 0x1a735
movq %rax, 0x41b41(%rip)     # 0x5a568
leaq 0xc(%rsp), %rbx
leaq 0x3d97d(%rip), %r12     # 0x563b0
leaq 0x2cd88(%rip), %r14     # 0x457c2
xorl %r13d, %r13d
movl $0x1, 0xc(%rsp)
movl $0x8, %edi
callq 0x1a735
movq %rax, %r15
movq %rax, 0x10(%rsp)
callq 0x1d966
movq (%r13,%r12), %rdx
movq %rax, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x1e60a
movq %rax, (%r15)
movq %rax, 0x18(%rsp)
movl $0x2, 0x8(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x41ada(%rip), %rax     # 0x5a568
movups 0x8(%rsp), %xmm0
movups %xmm0, (%rax,%r13,4)
movupd 0x18(%rsp), %xmm0
movupd %xmm0, 0x10(%rax,%r13,4)
addq $0x8, %r13
cmpq $0x70, %r13
jne 0x18a3d
movl $0x1c0, %r14d           # imm = 0x1C0
leaq 0x3f904(%rip), %r15     # 0x583c0
movq (%r15), %rdi
movq %rbx, %rsi
callq 0x1f4e7
movq %rax, 0x10(%rsp)
movq (%r15), %rdi
callq 0x1d989
movq %rax, 0x18(%rsp)
movl $0x1, 0x8(%rsp)
movq %r15, 0x20(%rsp)
movq 0x41a7b(%rip), %rax     # 0x5a568
movups 0x8(%rsp), %xmm0
movups %xmm0, (%rax,%r14)
movupd 0x18(%rsp), %xmm0
movupd %xmm0, 0x10(%rax,%r14)
addq $0x20, %r14
addq $0x28, %r15
cmpq $0x1a60, %r14           # imm = 0x1A60
jne 0x18abc
xorl %edi, %edi
callq 0x18946
cmpl $-0x1, %eax
je 0x18d66
movq 0x41a2c(%rip), %rdi     # 0x5a558
leaq 0x285e9(%rip), %rsi     # 0x4111c
xorl %eax, %eax
callq 0x1d2d0
testq %rax, %rax
je 0x18d66
movq %rax, %rdi
cmpl $0x2, (%rax)
jne 0x18d66
movq 0x20(%rdi), %r8
testq %r8, %r8
je 0x18d61
xorl %esi, %esi
movq %rdi, 0x28(%rsp)
movq 0x28(%rdi), %rax
movq (%rax,%rsi,8), %r14
cmpl $0x2, (%r14)
jne 0x18d66
cmpq $0x4, 0x20(%r14)
jb 0x18d66
movq 0x28(%r14), %rcx
movq (%rcx), %rax
cmpl $0x1, (%rax)
jne 0x18d66
movq 0x8(%rcx), %rdx
cmpl $0x3, (%rdx)
jne 0x18d66
movq 0x18(%rcx), %rcx
cmpl $0x3, (%rcx)
jne 0x18d66
movq 0x18(%rax), %rbp
movslq 0x419af(%rip), %rbx     # 0x5a564
testq %rbx, %rbx
movq %rsi, 0x30(%rsp)
jle 0x18bf2
movq %r8, 0x38(%rsp)
movq 0x4199d(%rip), %r13     # 0x5a568
leaq 0x8(%r13), %r15
xorl %r12d, %r12d
movq (%r15), %rax
movq (%rax), %rdi
movq %rbp, %rsi
callq 0x10080
testl %eax, %eax
je 0x18bf7
incq %r12
addq $0x20, %r15
cmpq %r12, %rbx
jne 0x18bd2
jmp 0x18c16
xorl %r12d, %r12d
jmp 0x18c06
movq 0x28(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %r8
cmpl %ebx, %r12d
jne 0x18d55
movq 0x41952(%rip), %r13     # 0x5a568
movq %rbx, %rsi
shlq $0x5, %rsi
leal 0x1(%rbx), %eax
movl %eax, 0x4193e(%rip)     # 0x5a564
addq $0x20, %rsi
movq %r13, %rdi
callq 0x1a7e1
movq %rax, %r13
movq %rax, 0x4192c(%rip)     # 0x5a568
movslq 0x41921(%rip), %rbx     # 0x5a564
shlq $0x5, %rbx
movl $0x1, %r12d
movl %r12d, -0x1c(%rax,%rbx)
movl $0x8, %edi
callq 0x1a735
movq %rax, -0x18(%r13,%rbx)
movq %rbp, %rdi
callq 0x1d989
movq -0x18(%r13,%rbx), %rcx
movq %rax, (%rcx)
movq -0x18(%r13,%rbx), %rax
movq (%rax), %rdi
movq %rdi, -0x10(%r13,%rbx)
movl %r12d, -0x20(%r13,%rbx)
callq 0x1effd
movl $0x28, %edi
callq 0x1a735
movq %rax, %rbp
movq -0x18(%r13,%rbx), %rax
movq (%rax), %rax
movq %rax, (%rbp)
callq 0x1d966
movq %rax, 0x8(%rbp)
movq 0x28(%r14), %rcx
movq 0x8(%rcx), %rdx
movq 0x18(%rcx), %rcx
movq 0x8(%rdx), %rdx
movq %rdx, %r12
negq %r12
cmovsq %rdx, %r12
cmpq $0x1, 0x8(%rcx)
jne 0x18ce1
movq %rax, %rdi
leaq 0x2cb3a(%rip), %rsi     # 0x4580f
callq 0x1e279
movq %rax, 0x8(%rbp)
decl %r12d
testl %r12d, %r12d
je 0x18d01
leaq 0x2cb27(%rip), %r15     # 0x45814
movq %rax, %rdi
movq %r15, %rsi
callq 0x1e279
movq %rax, 0x8(%rbp)
decl %r12d
jne 0x18ced
movq 0x28(%r14), %rcx
movq 0x8(%rcx), %rcx
cmpq $0x0, 0x8(%rcx)
jns 0x18d23
movq %rax, %rdi
leaq 0x2caff(%rip), %rsi     # 0x45819
callq 0x1e279
movq %rax, 0x8(%rbp)
addq %rbx, %r13
leaq 0x2cafa(%rip), %rax     # 0x45827
movq %rax, 0x10(%rbp)
movl $0x0, 0x18(%rbp)
leaq 0x2cafb(%rip), %rax     # 0x4583a
movq %rax, 0x20(%rbp)
movq %rbp, -0x8(%r13)
movq 0x28(%rsp), %rdi
movq 0x20(%rdi), %r8
movq 0x30(%rsp), %rsi
incq %rsi
cmpq %r8, %rsi
jb 0x18b63
callq 0x1b6f0
movl $0x1, 0x416c4(%rip)     # 0x5a434
movl $0x1, %edi
callq 0x201e0
leaq 0xfd3(%rip), %rdi       # 0x19d54
callq 0x201fd
leaq 0x10dc(%rip), %rdi      # 0x19e69
callq 0x20205
leaq 0x128a(%rip), %rdi      # 0x1a023
callq 0x2020d
movq 0x3f223(%rip), %rax     # 0x57fc8
movq (%rax), %rdi
callq 0x10420
movl %eax, %edi
callq 0x100f0
testl %eax, %eax
je 0x18de6
leaq 0x2c939(%rip), %rdi     # 0x456f8
leaq 0x2c944(%rip), %rsi     # 0x4570a
callq 0x16065
movq %rax, %rbx
testq %rax, %rax
sete %r14b
je 0x18ddf
movq %rbx, %rdi
callq 0x2199d
callq 0x15f9c
jmp 0x18deb
movb $0x1, %r14b
xorl %ebx, %ebx
callq 0x196cc
cmpq $0x0, 0x41760(%rip)     # 0x5a558
leaq 0x2c91d(%rip), %rax     # 0x4571c
leaq 0x416b2(%rip), %rdi     # 0x5a4b8
cmoveq %rax, %rdi
callq 0x20f23
testq %rax, %rax
je 0x19173
movq %rax, %rbp
movb (%rbp), %r15b
testb %r15b, %r15b
je 0x19140
cmpl $0x0, 0x41711(%rip)     # 0x5a540
je 0x18eb8
movl $0x5, %edx
movq %rbp, %rdi
leaq 0x2ca06(%rip), %rsi     # 0x4584a
callq 0x100c0
testl %eax, %eax
je 0x18e59
cmpb $0x65, %r15b
jne 0x18eb8
cmpb $0x20, 0x1(%rbp)
jne 0x18eb8
movl $0x10, %edi
callq 0x1f995
movq %rax, %r12
movl $0x2, 0x4(%rsp)
movq %rbp, %rdi
callq 0x101c0
xorl %ecx, %ecx
cmpb $0x20, 0x1(%rbp)
movq %rax, %r15
setne %cl
leal (%rcx,%rcx,2), %r13d
leal (%rcx,%rcx,2), %esi
incl %esi
movq %rbp, %rdi
callq 0x1d854
movq %rax, (%r12)
leaq 0x2(,%rbp), %rdi
addq %r13, %rdi
subl %r13d, %r15d
addl $-0x2, %r15d
movslq %r15d, %rsi
callq 0x1d854
movq %rax, 0x8(%r12)
jmp 0x18ec8
movq %rbp, %rdi
leaq 0x4(%rsp), %rsi
callq 0x1f4e7
movq %rax, %r12
testb %r14b, %r14b
jne 0x18ed5
movq %rbp, %rdi
callq 0x21762
testq %rbx, %rbx
je 0x18ee2
movq %rbx, %rdi
callq 0x21906
testq %r12, %r12
je 0x18f42
movl 0x4(%rsp), %r13d
testl %r13d, %r13d
jle 0x19134
movq (%r12), %r15
movq %r15, %rdi
leaq 0x2c829(%rip), %rsi     # 0x4572c
callq 0x10080
testl %eax, %eax
je 0x19173
movq %r15, %rdi
leaq 0x2c817(%rip), %rsi     # 0x45731
callq 0x10080
testl %eax, %eax
je 0x19173
cmpb $0x3a, (%r15)
jne 0x18f53
movq %r12, %rdi
movl %r13d, %esi
movl $0x1, %edx
callq 0x15ee2
jmp 0x19148
leaq 0x2cea9(%rip), %rdi     # 0x45df2
callq 0x100e0
jmp 0x19140
movq %r15, %rdi
leaq 0x2c7d9(%rip), %rsi     # 0x45736
callq 0x10080
testl %eax, %eax
je 0x18fca
cmpl $0x1, %r13d
je 0x18feb
cmpl $0x3, %r13d
jne 0x19002
movq %r15, %rdi
leaq 0x2c7e8(%rip), %rsi     # 0x45768
callq 0x10080
testl %eax, %eax
jne 0x19002
movq 0x41478(%rip), %rdi     # 0x5a408
callq 0x1da09
movq 0x8(%r12), %rdi
callq 0x1d989
movq %rax, 0x41462(%rip)     # 0x5a408
movq 0x10(%r12), %rdi
callq 0x10600
movl %eax, 0x4145a(%rip)     # 0x5a410
callq 0x196cc
movl $0x1, %edi
callq 0x18946
jmp 0x19134
cmpq $0x0, 0x41566(%rip)     # 0x5a538
jne 0x1917a
leaq 0x2c75f(%rip), %rdi     # 0x4573e
xorl %eax, %eax
callq 0x101f0
jmp 0x19134
movq %r15, %rdi
leaq 0x2c77b(%rip), %rsi     # 0x45770
callq 0x10080
testl %eax, %eax
je 0x1912f
xorl %r15d, %r15d
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0x10240
imulq $0xf4240, 0x8(%rsp), %rax # imm = 0xF4240
addq 0x10(%rsp), %rax
movabsq $-0x20c49ba5e353f7cf, %rcx # imm = 0xDF3B645A1CAC0831
imulq %rcx
movq %rdx, %r13
movq (%r12), %rdi
leaq 0x40(%rsp), %rsi
movl $0xa, %edx
callq 0x103f0
movl 0x4(%rsp), %edi
movl $0x1, %edx
cmpl $0x2, %edi
jl 0x1906a
movq 0x40(%rsp), %rcx
cmpb $0x0, (%rcx)
jne 0x1906a
movl %eax, %ecx
testq %rcx, %rcx
je 0x1906a
movslq %eax, %rdx
movl $0x1, %r15d
subl %r15d, %edi
movl %r15d, %eax
leaq (%r12,%rax,8), %rsi
callq 0x1a028
cmpl $0x0, 0x414c8(%rip)     # 0x5a548
je 0x190ba
movl $0x0, 0x414bc(%rip)     # 0x5a548
xorl %edi, %edi
callq 0x19433
cmpl $0x0, 0x414aa(%rip)     # 0x5a544
leaq 0x2c1ef(%rip), %rsi     # 0x45290
leaq 0x2c6f1(%rip), %rax     # 0x45799
cmoveq %rax, %rsi
leaq 0x2c6c3(%rip), %rdi     # 0x45776
xorl %eax, %eax
callq 0x101f0
movq %r13, %rax
shrq $0x3f, %rax
sarq $0x7, %r13
addq %rax, %r13
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0x10240
imulq $0xf4240, 0x8(%rsp), %rax # imm = 0xF4240
addq 0x10(%rsp), %rax
movabsq $0x20c49ba5e353f7cf, %rcx # imm = 0x20C49BA5E353F7CF
imulq %rcx
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x7, %rdx
addq %rax, %rdx
addq %r13, %rdx
cmpq $0x1f4, %rdx            # imm = 0x1F4
jl 0x19134
cmpl $0x0, 0x41398(%rip)     # 0x5a4a8
jne 0x19134
cvtsi2sd %rdx, %xmm0
divsd 0x270d1(%rip), %xmm0    # 0x401f0
leaq 0x2c693(%rip), %rdi     # 0x457b9
movb $0x1, %al
callq 0x101f0
jmp 0x19134
callq 0x201e7
movl 0x4(%rsp), %esi
movq %r12, %rdi
callq 0x1f2e1
movq %rbp, %rdi
callq 0x2175d
cmpq $0x0, 0x41408(%rip)     # 0x5a558
leaq 0x41361(%rip), %rdi     # 0x5a4b8
leaq 0x2c5be(%rip), %rax     # 0x4571c
cmoveq %rax, %rdi
callq 0x20f23
movq %rax, %rbp
testq %rax, %rax
jne 0x18e1b
xorl %edi, %edi
callq 0x10630
movl $0x1, %eax
movl %eax, 0x413bb(%rip)     # 0x5a540
movl %eax, 0x4131d(%rip)     # 0x5a4a8
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq