// File: /workspace/github_c_makefile_star2_O2/erikdubbelboer[P]discnt/src/discnt-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")) ||
        (argc == 3 && !strcasecmp(command,"latency") &&
                       !strcasecmp(argv[1],"graph")) ||
        (argc == 2 && !strcasecmp(command,"latency") &&
                       !strcasecmp(argv[1],"doctor")))
    {
        output_raw = 1;
    }

    if (!strcasecmp(command,"shutdown")) config.shutdown = 1;
    if (!strcasecmp(command,"monitor")) config.monitor_mode = 1;
    if (!strcasecmp(command,"subscribe")) config.pubsub_mode = 1;
    if (!strcasecmp(command,"isubscribe")) config.pubsub_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 (cliReadReply(output_raw) != REDIS_OK) {
            free(argvlen);
            return REDIS_ERR;
        }
        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
pushq %rax
movl %edx, %r15d
movq %rsi, %rbx
movl %edi, %ebp
movq (%rsi), %r13
leaq 0x252c0(%rip), %rsi     # 0x35f89
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
je 0x10d97
leaq 0x25f51(%rip), %rsi     # 0x36c31
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
je 0x10d97
pushq $-0x1
popq %r14
cmpq $0x0, 0x38f9c(%rip)     # 0x49c98
je 0x11039
leaq 0x25f2a(%rip), %rsi     # 0x36c33
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
je 0x10f06
xorl %r12d, %r12d
cmpl $0x3, %ebp
je 0x10eaf
cmpl $0x2, %ebp
jne 0x10f0a
leaq 0x25f03(%rip), %rsi     # 0x36c38
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
je 0x10ed8
leaq 0x248b4(%rip), %rsi     # 0x35600
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
jne 0x10d70
movq 0x8(%rbx), %rdi
leaq 0x25ee3(%rip), %rsi     # 0x36c46
callq 0xc080
testl %eax, %eax
je 0x10f06
leaq 0x2522e(%rip), %rsi     # 0x35fa5
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
jne 0x10f0a
movq 0x8(%rbx), %rdi
leaq 0x25ebf(%rip), %rsi     # 0x36c51
jmp 0x10ecd
movl %ebp, %eax
decl %eax
movl %eax, 0x4(%rsp)
je 0x10dea
cmpl $0x2, %ebp
jl 0x11082
movq 0x8(%rbx), %r14
pushq $-0x1
popq %r15
cmpb $0x40, (%r14)
jne 0x10de4
incq %r14
leaq 0x3663e(%rip), %rbp     # 0x47400
xorl %r13d, %r13d
cmpq $0x4, %r13
je 0x10de4
movq (%rbp), %rsi
movq %r14, %rdi
callq 0xc080
testl %eax, %eax
je 0x10e13
incq %r13
addq $0x8, %rbp
jmp 0x10dc5
movl %r15d, (%rsp)
jmp 0x10e17
callq 0x1099e
movq %rax, %rbx
leaq 0x25ea5(%rip), %rdi     # 0x36c9e
xorl %r14d, %r14d
movq %rax, %rsi
xorl %eax, %eax
callq 0xc1e0
movq %rbx, %rdi
callq 0xd7f4
jmp 0x11039
movl %r13d, (%rsp)
movl 0x4(%rsp), %r13d
xorl %ebp, %ebp
cmpb $0x1, 0x38e63(%rip)     # 0x49c88
jne 0x10e9e
cmpq $0x31, %rbp
ja 0x10e9e
movq 0x38e5c(%rip), %rax     # 0x49c90
movq %rbp, %rcx
shlq $0x5, %rcx
cmpl $0x1, (%rax,%rcx)
jne 0x10e99
addq %rcx, %rax
movq 0x18(%rax), %r14
movl (%rsp), %ecx
cmpl $-0x1, %ecx
je 0x10e5d
cmpl 0x18(%r14), %ecx
jne 0x10e99
movq %r14, %rdi
xorl %esi, %esi
jmp 0x10e94
movl 0x4(%rsp), %ecx
cmpl %ecx, 0x4(%rax)
jne 0x10e99
movq 0x8(%rax), %r12
xorl %r15d, %r15d
cmpq %r15, %r13
je 0x10e8e
movq 0x8(%rbx,%r15,8), %rdi
movq (%r12,%r15,8), %rsi
callq 0xc080
testl %eax, %eax
jne 0x10e89
incq %r15
jmp 0x10e6d
cmpl %r15d, %r13d
jne 0x10e99
movq %r14, %rdi
pushq $0x1
popq %rsi
callq 0x11235
incq %rbp
jmp 0x10e1e
leaq 0x25c78(%rip), %rdi     # 0x36b1d
callq 0xc0e0
jmp 0x11036
leaq 0x250ef(%rip), %rsi     # 0x35fa5
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
jne 0x10f0a
movq 0x8(%rbx), %rdi
leaq 0x25d7e(%rip), %rsi     # 0x36c4b
callq 0xc080
testl %eax, %eax
jne 0x10f0a
jmp 0x10f06
movq 0x8(%rbx), %r14
leaq 0x25d5d(%rip), %rsi     # 0x36c40
movq %r14, %rdi
callq 0xc080
testl %eax, %eax
je 0x10f06
leaq 0x25d3d(%rip), %rsi     # 0x36c33
movq %r14, %rdi
callq 0xc080
testl %eax, %eax
jne 0x10d45
pushq $0x1
popq %r12
leaq 0x25d47(%rip), %rsi     # 0x36c58
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
jne 0x10f27
movl $0x1, 0x38c8d(%rip)     # 0x49bb4
leaq 0x25d33(%rip), %rsi     # 0x36c61
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
jne 0x10f44
movl $0x1, 0x38c74(%rip)     # 0x49bb8
leaq 0x25d1f(%rip), %rsi     # 0x36c6a
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
jne 0x10f61
movl $0x1, 0x38c5b(%rip)     # 0x49bbc
leaq 0x25d01(%rip), %rsi     # 0x36c69
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
jne 0x10f7e
movl $0x1, 0x38c3e(%rip)     # 0x49bbc
movslq %ebp, %rdi
shlq $0x3, %rdi
callq 0xc3f0
movq %rax, %r13
xorl %r14d, %r14d
testl %ebp, %ebp
movl %ebp, %eax
movl $0x0, %ebp
movl %eax, (%rsp)
cmovgl %eax, %ebp
cmpq %r14, %rbp
je 0x10fb7
movq (%rbx,%r14,8), %rdi
callq 0x110ca
movq %rax, (%r13,%r14,8)
incq %r14
jmp 0x10f9f
movq 0x38002(%rip), %r14     # 0x48fc0
movl (%rsp), %ebp
subl $0x1, %r15d
jb 0x1102e
movq 0x38cca(%rip), %rdi     # 0x49c98
movl %ebp, %esi
movq %rbx, %rdx
movq %r13, %rcx
callq 0x13ade
cmpl $0x0, 0x38bd6(%rip)     # 0x49bb8
je 0x10ffe
movl %r12d, %edi
callq 0x11102
testl %eax, %eax
jne 0x1107a
movq (%r14), %rdi
callq 0xc410
jmp 0x10fdb
cmpl $0x0, 0x38bb7(%rip)     # 0x49bbc
jne 0x11059
movl %r12d, %edi
callq 0x11102
testl %eax, %eax
jne 0x1104b
movq 0x38b8e(%rip), %rdi     # 0x49ba8
testq %rdi, %rdi
je 0x11024
callq 0xc6a0
movq (%r14), %rdi
callq 0xc410
jmp 0x10fc1
movq %r13, %rdi
callq 0xc060
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, %rdi
callq 0xc060
pushq $-0x1
popq %r14
jmp 0x11039
cmpl $0x1, 0x38b88(%rip)     # 0x49be8
je 0x1106e
leaq 0x25f0b(%rip), %rdi     # 0x36f74
callq 0xc0e0
movl %r12d, %edi
callq 0x11102
testl %eax, %eax
je 0x1106e
pushq $0x1
popq %rdi
callq 0xc5b0
leaq 0x25beb(%rip), %rdi     # 0x36c74
leaq 0x25a49(%rip), %rsi     # 0x36ad9
leaq 0x25be6(%rip), %rcx     # 0x36c7d
movl $0xea, %edx
callq 0xc230