// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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;

                    repeat = atoi(argv[0]);
                    if (argc > 1 && 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) {
                        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 $0x38, %rsp
movl $0xd3, 0x43476(%rip)    # 0x605a4
movl $0x1a60, %edi           # imm = 0x1A60
callq 0x1ee9d
movq %rax, 0x43469(%rip)     # 0x605a8
leaq 0xc(%rsp), %rbx
leaq 0x3f0c5(%rip), %r15     # 0x5c210
leaq 0x2c624(%rip), %r14     # 0x49776
xorl %r12d, %r12d
movl $0x1, 0xc(%rsp)
movl $0x8, %edi
callq 0x1ee9d
movq %rax, 0x10(%rsp)
callq 0x21faf
movq (%r12,%r15), %rdx
movq %rax, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x22c3e
movq 0x10(%rsp), %rcx
movq %rax, (%rcx)
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x18(%rsp)
movl $0x2, 0x8(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x433f9(%rip), %rax     # 0x605a8
movups 0x8(%rsp), %xmm0
movups %xmm0, (%rax,%r12,4)
movupd 0x18(%rsp), %xmm0
movupd %xmm0, 0x10(%rax,%r12,4)
addq $0x8, %r12
cmpq $0x70, %r12
jne 0x1d155
movl $0x1c0, %r14d           # imm = 0x1C0
leaq 0x411e3(%rip), %r15     # 0x5e3c0
movq (%r15), %rdi
movq %rbx, %rsi
callq 0x23b0c
movq %rax, 0x10(%rsp)
movq (%r15), %rdi
callq 0x21fd2
movq %rax, 0x18(%rsp)
movl $0x1, 0x8(%rsp)
movq %r15, 0x20(%rsp)
movq 0x4339a(%rip), %rax     # 0x605a8
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 0x1d1dd
xorl %edi, %edi
callq 0x1d05e
cmpl $-0x1, %eax
je 0x1d49b
movq 0x4334b(%rip), %rdi     # 0x60598
leaq 0x27e78(%rip), %rsi     # 0x450cc
xorl %eax, %eax
callq 0x21909
testq %rax, %rax
je 0x1d49b
movq %rax, %rbx
cmpl $0x2, (%rax)
jne 0x1d49b
cmpq $0x0, 0x20(%rbx)
je 0x1d493
xorl %r15d, %r15d
movq 0x28(%rbx), %rax
movq (%rax,%r15,8), %r14
cmpl $0x2, (%r14)
movl $0x1, %eax
jne 0x1d482
cmpq $0x4, 0x20(%r14)
jb 0x1d482
movq 0x28(%r14), %rdx
movq (%rdx), %rcx
cmpl $0x1, (%rcx)
jne 0x1d482
movq 0x8(%rdx), %rax
cmpl $0x3, (%rax)
movl $0x1, %eax
jne 0x1d482
movq 0x18(%rdx), %rax
cmpl $0x3, (%rax)
movl $0x1, %eax
jne 0x1d482
movq 0x18(%rcx), %rax
movq %rax, 0x30(%rsp)
movslq 0x432c0(%rip), %rsi     # 0x605a4
testq %rsi, %rsi
jle 0x1d32a
movq %rsi, 0x28(%rsp)
movl %esi, %r13d
movq 0x432b0(%rip), %rbp     # 0x605a8
addq $0x8, %rbp
xorl %r12d, %r12d
movq (%rbp), %rax
movq (%rax), %rdi
movq 0x30(%rsp), %rsi
callq 0x11080
testl %eax, %eax
je 0x1d323
incq %r12
addq $0x20, %rbp
cmpq %r12, %r13
jne 0x1d2ff
movl %r13d, %r12d
movq 0x28(%rsp), %rsi
jmp 0x1d32d
xorl %r12d, %r12d
movl $0x4, %eax
cmpl %esi, %r12d
jne 0x1d482
incq %rsi
movl %esi, 0x43260(%rip)     # 0x605a4
movq 0x4325d(%rip), %rdi     # 0x605a8
shlq $0x5, %rsi
callq 0x1ef49
movq %rax, %r13
movq %rax, 0x4324a(%rip)     # 0x605a8
movslq 0x4323f(%rip), %r12     # 0x605a4
shlq $0x5, %r12
movl $0x1, %ebp
movl %ebp, -0x1c(%rax,%r12)
movl $0x8, %edi
callq 0x1ee9d
movq %rax, -0x18(%r13,%r12)
movq 0x30(%rsp), %rdi
callq 0x21fd2
movq -0x18(%r13,%r12), %rcx
movq %rax, (%rcx)
movq -0x18(%r13,%r12), %rax
movq (%rax), %rcx
movq %rcx, -0x10(%r13,%r12)
movl %ebp, -0x20(%r13,%r12)
movq (%rax), %rdi
callq 0x2363e
movl $0x28, %edi
callq 0x1ee9d
movq %rax, %rbp
movq %r12, 0x30(%rsp)
movq -0x18(%r13,%r12), %rax
movq (%rax), %rax
movq %rax, (%rbp)
callq 0x21faf
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)
movq %r13, 0x28(%rsp)
jne 0x1d411
movq %rax, %rdi
leaq 0x2c3be(%rip), %rsi     # 0x497c3
callq 0x228ad
movq %rax, 0x8(%rbp)
decl %r12d
testl %r12d, %r12d
leaq 0x2c3ad(%rip), %r13     # 0x497c8
je 0x1d432
movq 0x8(%rbp), %rdi
movq %r13, %rsi
callq 0x228ad
movq %rax, 0x8(%rbp)
decl %r12d
jne 0x1d41d
movq 0x28(%r14), %rax
movq 0x8(%rax), %rax
cmpq $0x0, 0x8(%rax)
jns 0x1d455
movq 0x8(%rbp), %rdi
leaq 0x2c381(%rip), %rsi     # 0x497cd
callq 0x228ad
movq %rax, 0x8(%rbp)
movq 0x28(%rsp), %rcx
addq 0x30(%rsp), %rcx
leaq 0x2c375(%rip), %rax     # 0x497db
movq %rax, 0x10(%rbp)
movl $0x0, 0x18(%rbp)
leaq 0x2c376(%rip), %rax     # 0x497ee
movq %rax, 0x20(%rbp)
movq %rbp, -0x8(%rcx)
xorl %eax, %eax
testb $0x3, %al
jne 0x1d49b
incq %r15
cmpq 0x20(%rbx), %r15
jb 0x1d27e
movq %rbx, %rdi
callq 0x1fcac
movl $0x1, 0x42fcf(%rip)     # 0x60474
movl $0x1, %edi
callq 0x24888
leaq 0xfe4(%rip), %rdi       # 0x1e49a
callq 0x248a5
leaq 0x10d7(%rip), %rdi      # 0x1e599
callq 0x248ad
leaq 0x1289(%rip), %rdi      # 0x1e757
callq 0x248b5
movq 0x40aee(%rip), %rax     # 0x5dfc8
movq (%rax), %rdi
callq 0x11430
movl %eax, %edi
callq 0x110f0
testl %eax, %eax
je 0x1d51b
leaq 0x2c1b8(%rip), %rdi     # 0x496ac
leaq 0x2c1c3(%rip), %rsi     # 0x496be
callq 0x1a74d
movq %rax, %rbx
testq %rax, %rax
sete %r15b
je 0x1d514
movq %rbx, %rdi
callq 0x2609b
callq 0x1a684
jmp 0x1d520
movb $0x1, %r15b
xorl %ebx, %ebx
callq 0x1de0e
cmpq $0x0, 0x4306b(%rip)     # 0x60598
leaq 0x2c19c(%rip), %r14     # 0x496d0
leaq 0x42fbd(%rip), %rdi     # 0x604f8
cmoveq %r14, %rdi
callq 0x255f6
testq %rax, %rax
je 0x1d8ac
movq %rax, %rbp
cmpb $0x0, (%rbp)
je 0x1d880
cmpl $0x0, 0x4301f(%rip)     # 0x60580
je 0x1d593
movl $0x5, %edx
movq %rbp, %rdi
leaq 0x2c28c(%rip), %rsi     # 0x497fe
callq 0x110c0
testl %eax, %eax
je 0x1d5a5
movl $0x2, %edx
movq %rbp, %rdi
leaq 0x2c27a(%rip), %rsi     # 0x49804
callq 0x110c0
testl %eax, %eax
je 0x1d5a5
movq %rbp, %rdi
leaq 0x4(%rsp), %rsi
callq 0x23b0c
movq %rax, %r13
jmp 0x1d605
movl $0x10, %edi
callq 0x2400d
movq %rax, %r13
movl $0x2, 0x4(%rsp)
movq %rbp, %rdi
callq 0x111d0
xorl %ecx, %ecx
cmpb $0x20, 0x1(%rbp)
movq %rax, %r14
setne %cl
leal (%rcx,%rcx,2), %r12d
leal (%rcx,%rcx,2), %esi
incl %esi
movq %rbp, %rdi
callq 0x21e9c
movq %rax, (%r13)
leaq (%r12,%rbp), %rdi
addq $0x2, %rdi
subl %r12d, %r14d
addl $-0x2, %r14d
movslq %r14d, %rsi
leaq 0x2c0d4(%rip), %r14     # 0x496d0
callq 0x21e9c
movq %rax, 0x8(%r13)
testb %r15b, %r15b
jne 0x1d612
movq %rbp, %rdi
callq 0x25e53
testq %rbx, %rbx
je 0x1d61f
movq %rbx, %rdi
callq 0x26004
testq %r13, %r13
je 0x1d686
movl 0x4(%rsp), %r12d
testl %r12d, %r12d
jle 0x1d874
movq (%r13), %r14
movq %r14, %rdi
leaq 0x2c0a0(%rip), %rsi     # 0x496e0
callq 0x11080
testl %eax, %eax
je 0x1d8ac
movq %r14, %rdi
leaq 0x2c08e(%rip), %rsi     # 0x496e5
callq 0x11080
testl %eax, %eax
je 0x1d8ac
cmpb $0x3a, (%r14)
jne 0x1d697
movq %r13, %rdi
movl %r12d, %esi
movl $0x1, %edx
callq 0x1a5ca
leaq 0x2c04f(%rip), %r14     # 0x496d0
jmp 0x1d888
leaq 0x2c71c(%rip), %rdi     # 0x49da9
callq 0x110e0
jmp 0x1d880
movq %r14, %rdi
leaq 0x2c049(%rip), %rsi     # 0x496ea
callq 0x11080
testl %eax, %eax
je 0x1d80e
cmpl $0x1, %r12d
je 0x1d6d7
cmpl $0x3, %r12d
jne 0x1d6ee
movq %r14, %rdi
leaq 0x2c058(%rip), %rsi     # 0x4971c
callq 0x11080
testl %eax, %eax
je 0x1d833
cmpl $0x1, %r12d
jne 0x1d6ee
movq %r14, %rdi
leaq 0x2c043(%rip), %rsi     # 0x49724
callq 0x11080
testl %eax, %eax
je 0x1d82c
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0x11250
imulq $0xf4240, 0x8(%rsp), %rax # imm = 0xF4240
addq 0x10(%rsp), %rax
movabsq $-0x20c49ba5e353f7cf, %rcx # imm = 0xDF3B645A1CAC0831
imulq %rcx
movq %rdx, %r12
movq (%r13), %rdi
callq 0x11610
movl 0x4(%rsp), %edi
cmpl $0x2, %edi
setge %cl
testl %eax, %eax
setne %sil
andb %cl, %sil
movslq %eax, %rdx
movl $0x1, %eax
cmoveq %rax, %rdx
movzbl %sil, %eax
subl %eax, %edi
leaq (,%rax,8), %rsi
addq %r13, %rsi
callq 0x1e75c
cmpl $0x0, 0x42e2b(%rip)     # 0x60588
je 0x1d797
movl $0x0, 0x42e1f(%rip)     # 0x60588
xorl %edi, %edi
callq 0x1db6c
cmpl $0x0, 0x42e0d(%rip)     # 0x60584
leaq 0x2bae2(%rip), %rsi     # 0x49260
leaq 0x2bfc8(%rip), %rax     # 0x4974d
cmoveq %rax, %rsi
leaq 0x2bf9a(%rip), %rdi     # 0x4972a
xorl %eax, %eax
callq 0x11200
movq %r12, %rax
shrq $0x3f, %rax
sarq $0x7, %r12
addq %rax, %r12
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0x11250
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 %r12, %rdx
cmpq $0x1f4, %rdx            # imm = 0x1F4
leaq 0x2bee5(%rip), %r14     # 0x496d0
jl 0x1d874
cvtsi2sd %rdx, %xmm0
divsd 0x269f2(%rip), %xmm0    # 0x441f0
leaq 0x2bf68(%rip), %rdi     # 0x4976d
movb $0x1, %al
callq 0x11200
jmp 0x1d874
cmpq $0x0, 0x42d62(%rip)     # 0x60578
jne 0x1d8b3
leaq 0x2becf(%rip), %rdi     # 0x496f2
xorl %eax, %eax
callq 0x11200
jmp 0x1d86d
callq 0x2488f
jmp 0x1d86d
movq 0x42c0e(%rip), %rdi     # 0x60448
callq 0x22043
movq 0x8(%r13), %rdi
callq 0x21fd2
movq %rax, 0x42bf9(%rip)     # 0x60448
movq 0x10(%r13), %rdi
callq 0x11610
movl %eax, 0x42bf2(%rip)     # 0x60450
callq 0x1de0e
movl $0x1, %edi
callq 0x1d05e
leaq 0x2be5c(%rip), %r14     # 0x496d0
movl 0x4(%rsp), %esi
movq %r13, %rdi
callq 0x23906
movq %rbp, %rdi
callq 0x25e4e
cmpq $0x0, 0x42d08(%rip)     # 0x60598
leaq 0x42c61(%rip), %rdi     # 0x604f8
cmoveq %r14, %rdi
callq 0x255f6
movq %rax, %rbp
testq %rax, %rax
jne 0x1d550
xorl %edi, %edi
callq 0x11640
movl $0x1, %eax
movl %eax, 0x42cc2(%rip)     # 0x60580
movl %eax, 0x42c24(%rip)     # 0x604e8
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq