// File: /workspace/github_c_makefile_star2_O2/nilyang[P]redis-tdd-annotation/src/redis-cli.c
// Function: cliSendCommand
static int cliSendCommand(int argc, char **argv, int repeat) {
    char *command = argv[0];
    size_t *argvlen;
    int j, output_raw;

    if (!strcasecmp(command,"help") || !strcasecmp(command,"?")) {
        cliOutputHelp(--argc, ++argv);
        return REDIS_OK;
    }

    if (context == NULL) return REDIS_ERR;

    output_raw = 0;
    if (!strcasecmp(command,"info") ||
        (argc == 2 && !strcasecmp(command,"cluster") &&
                      (!strcasecmp(argv[1],"nodes") ||
                       !strcasecmp(argv[1],"info"))) ||
        (argc == 2 && !strcasecmp(command,"client") &&
                       !strcasecmp(argv[1],"list")))

    {
        output_raw = 1;
    }

    if (!strcasecmp(command,"shutdown")) config.shutdown = 1;
    if (!strcasecmp(command,"monitor")) config.monitor_mode = 1;
    if (!strcasecmp(command,"subscribe") ||
        !strcasecmp(command,"psubscribe")) config.pubsub_mode = 1;
    if (!strcasecmp(command,"sync") ||
        !strcasecmp(command,"psync")) config.slave_mode = 1;

    /* Setup argument length */
    argvlen = malloc(argc*sizeof(size_t));
    for (j = 0; j < argc; j++)
        argvlen[j] = sdslen(argv[j]);

    while(repeat--) {
        redisAppendCommandArgv(context,argc,(const char**)argv,argvlen);
        while (config.monitor_mode) {
            if (cliReadReply(output_raw) != REDIS_OK) exit(1);
            fflush(stdout);
        }

        if (config.pubsub_mode) {
            if (config.output != OUTPUT_RAW)
                printf("Reading messages... (press Ctrl-C to quit)\n");
            while (1) {
                if (cliReadReply(output_raw) != REDIS_OK) exit(1);
            }
        }

        if (config.slave_mode) {
            printf("Entering slave output mode...  (press Ctrl-C to quit)\n");
            slaveMode();
            config.slave_mode = 0;
            return REDIS_ERR;  /* Error = slaveMode lost connection to master */
        }

        if (cliReadReply(output_raw) != REDIS_OK) {
            free(argvlen);
            return REDIS_ERR;
        } else {
            /* Store database number when SELECT was successfully executed. */
            if (!strcasecmp(command,"select") && argc == 2) {
                config.dbnum = atoi(argv[1]);
                cliRefreshPrompt();
            }
        }
        if (config.interval) usleep(config.interval);
        fflush(stdout); /* Make it grep friendly */
    }

    free(argvlen);
    return REDIS_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %r15d
movq %rsi, %rbx
movl %edi, %r14d
movq (%rsi), %r12
leaq 0x1c38d(%rip), %rsi     # 0x2ece6
movq %r12, %rdi
callq 0xd080
testl %eax, %eax
je 0x12a00
leaq 0x1d7a6(%rip), %rsi     # 0x30116
movq %r12, %rdi
callq 0xd080
testl %eax, %eax
je 0x12a00
pushq $-0x1
popq %rbp
cmpq $0x0, 0x2f4e5(%rip)     # 0x41e70
je 0x12d15
leaq 0x1d780(%rip), %rsi     # 0x30118
movq %r12, %rdi
callq 0xd080
testl %eax, %eax
je 0x12b52
xorl %r13d, %r13d
cmpl $0x2, %r14d
jne 0x12b56
leaq 0x1d761(%rip), %rsi     # 0x3011d
movq %r12, %rdi
callq 0xd080
testl %eax, %eax
je 0x12b24
leaq 0x19ca4(%rip), %rsi     # 0x2c677
movq %r12, %rdi
callq 0xd080
testl %eax, %eax
jne 0x12b56
movq 0x8(%rbx), %rdi
leaq 0x1a7e0(%rip), %rsi     # 0x2d1ce
callq 0xd080
testl %eax, %eax
jne 0x12b56
jmp 0x12b52
movl %r14d, %eax
decl %eax
movl %eax, 0x14(%rsp)
je 0x12a56
cmpl $0x2, %r14d
jl 0x12d4f
movq 0x8(%rbx), %r14
pushq $-0x1
popq %r15
cmpb $0x40, (%r14)
jne 0x12a4f
incq %r14
leaq 0x2bd33(%rip), %rbp     # 0x3e760
xorl %r13d, %r13d
cmpq $0xc, %r13
je 0x12a4f
movq (%rbp), %rsi
movq %r14, %rdi
callq 0xd080
testl %eax, %eax
je 0x12a7e
incq %r13
addq $0x8, %rbp
jmp 0x12a30
movl %r15d, 0x8(%rsp)
jmp 0x12a83
callq 0x11fdc
movq %rax, %rbx
leaq 0x1d719(%rip), %rdi     # 0x3017e
xorl %ebp, %ebp
movq %rax, %rsi
xorl %eax, %eax
callq 0xd1d0
movq %rbx, %rdi
callq 0xe4eb
jmp 0x12d15
movl %r13d, 0x8(%rsp)
movl 0x14(%rsp), %r13d
xorl %ebp, %ebp
cmpb $0x1, 0x2f3cf(%rip)     # 0x41e60
jne 0x12b11
cmpq $0xab, %rbp
ja 0x12b11
movq 0x2f3c5(%rip), %rax     # 0x41e68
movq %rbp, %rcx
shlq $0x5, %rcx
cmpl $0x1, (%rax,%rcx)
jne 0x12b09
addq %rcx, %rax
movq 0x18(%rax), %r14
movl 0x8(%rsp), %ecx
cmpl $-0x1, %ecx
je 0x12acd
cmpl 0x18(%r14), %ecx
jne 0x12b09
movq %r14, %rdi
xorl %esi, %esi
jmp 0x12b04
movl 0x14(%rsp), %ecx
cmpl %ecx, 0x4(%rax)
jne 0x12b09
movq 0x8(%rax), %r12
xorl %r15d, %r15d
cmpq %r15, %r13
je 0x12afe
movq 0x8(%rbx,%r15,8), %rdi
movq (%r12,%r15,8), %rsi
callq 0xd080
testl %eax, %eax
jne 0x12af9
incq %r15
jmp 0x12add
cmpl %r15d, %r13d
jne 0x12b09
movq %r14, %rdi
pushq $0x1
popq %rsi
callq 0x12d6e
incq %rbp
jmp 0x12a8a
leaq 0x1d513(%rip), %rdi     # 0x3002b
callq 0xd0d0
xorl %ebp, %ebp
jmp 0x12d15
movq 0x8(%rbx), %rbp
leaq 0x1d5f6(%rip), %rsi     # 0x30125
movq %rbp, %rdi
callq 0xd080
testl %eax, %eax
je 0x12b52
leaq 0x1d5d6(%rip), %rsi     # 0x30118
movq %rbp, %rdi
callq 0xd080
testl %eax, %eax
jne 0x129cc
pushq $0x1
popq %r13
leaq 0x1d5ce(%rip), %rsi     # 0x3012b
movq %r12, %rdi
callq 0xd080
testl %eax, %eax
jne 0x12b73
movl $0x1, 0x2f1f5(%rip)     # 0x41d68
leaq 0x1d5ba(%rip), %rsi     # 0x30134
movq %r12, %rdi
callq 0xd080
testl %eax, %eax
jne 0x12b90
movl $0x1, 0x2f1dc(%rip)     # 0x41d6c
leaq 0x1d5a6(%rip), %rsi     # 0x3013d
movq %r12, %rdi
callq 0xd080
testl %eax, %eax
je 0x12bb6
leaq 0x1d592(%rip), %rsi     # 0x3013c
movq %r12, %rdi
callq 0xd080
testl %eax, %eax
jne 0x12bc0
movl $0x1, 0x2f1b0(%rip)     # 0x41d70
leaq 0x1d581(%rip), %rsi     # 0x30148
movq %r12, %rdi
callq 0xd080
testl %eax, %eax
je 0x12be6
leaq 0x1d56d(%rip), %rsi     # 0x30147
movq %r12, %rdi
callq 0xd080
testl %eax, %eax
jne 0x12bf0
movl $0x1, 0x2f194(%rip)     # 0x41d84
movslq %r14d, %rdi
shlq $0x3, %rdi
callq 0xd3e0
movq %rax, %rbp
xorl %eax, %eax
testl %r14d, %r14d
movl $0x0, %ecx
cmovgl %r14d, %ecx
cmpq %rax, %rcx
je 0x12c24
movq (%rbx,%rax,8), %rdx
movslq -0x8(%rdx), %rdx
movq %rdx, (%rbp,%rax,8)
incq %rax
jmp 0x12c0d
movq %r12, 0x8(%rsp)
movq 0x2d370(%rip), %r12     # 0x3ffa0
subl $0x1, %r15d
jb 0x12ce3
movq 0x2f22f(%rip), %rdi     # 0x41e70
movl %r14d, %esi
movq %rbx, %rdx
movq %rbp, %rcx
callq 0x14fbb
cmpl $0x0, 0x2f116(%rip)     # 0x41d6c
je 0x12c73
movl %r13d, %edi
callq 0x120a5
testl %eax, %eax
jne 0x12d47
movq (%r12), %rdi
callq 0xd400
jmp 0x12c4f
cmpl $0x0, 0x2f0f6(%rip)     # 0x41d70
jne 0x12d26
cmpl $0x0, 0x2f0fd(%rip)     # 0x41d84
jne 0x12cf0
movl %r13d, %edi
callq 0x120a5
testl %eax, %eax
jne 0x12d0a
movq 0x8(%rsp), %rdi
leaq 0x1d4ac(%rip), %rsi     # 0x3014d
callq 0xd080
cmpl $0x2, %r14d
jne 0x12cc4
testl %eax, %eax
jne 0x12cc4
movq 0x8(%rbx), %rdi
callq 0xd590
movl %eax, 0x2f0a1(%rip)     # 0x41d60
callq 0x1228a
movq 0x2f08d(%rip), %rdi     # 0x41d58
testq %rdi, %rdi
je 0x12cd5
callq 0xd6c0
movq (%r12), %rdi
callq 0xd400
jmp 0x12c30
movq %rbp, %rdi
callq 0xd060
jmp 0x12b1d
leaq 0x1d7c6(%rip), %rdi     # 0x304bd
callq 0xd0d0
callq 0x11ece
andl $0x0, 0x2f07c(%rip)     # 0x41d84
jmp 0x12d12
movq %rbp, %rdi
callq 0xd060
pushq $-0x1
popq %rbp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x1, 0x2f09b(%rip)     # 0x41dc8
je 0x12d3b
leaq 0x1d7bd(%rip), %rdi     # 0x304f3
callq 0xd0d0
movl %r13d, %edi
callq 0x120a5
testl %eax, %eax
je 0x12d3b
pushq $0x1
popq %rdi
callq 0xd5d0
leaq 0x1d3fe(%rip), %rdi     # 0x30154
leaq 0x1d06d(%rip), %rsi     # 0x2fdca
leaq 0x1d3f9(%rip), %rcx     # 0x3015d
movl $0xf4, %edx
callq 0xd220