// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
leaq 0x6f4b8(%rip), %rsi     # 0x83000
callq 0xc060
cmpl $0x0, %eax
je 0x13b67
movq -0x20(%rbp), %rdi
leaq 0x7026c(%rip), %rsi     # 0x83dc9
callq 0xc060
cmpl $0x0, %eax
jne 0x13b8d
movl -0x8(%rbp), %edi
addl $-0x1, %edi
movl %edi, -0x8(%rbp)
movq -0x10(%rbp), %rsi
addq $0x8, %rsi
movq %rsi, -0x10(%rbp)
callq 0x13ec0
movl $0x0, -0x4(%rbp)
jmp 0x13e76
cmpq $0x0, 0x83133(%rip)     # 0x96cc8
jne 0x13ba3
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x13e76
movl $0x0, -0x30(%rbp)
movq -0x20(%rbp), %rdi
leaq 0x70216(%rip), %rsi     # 0x83dcb
callq 0xc060
cmpl $0x0, %eax
je 0x13cb4
cmpl $0x2, -0x8(%rbp)
jne 0x13c18
movq -0x20(%rbp), %rdi
leaq 0x701fc(%rip), %rsi     # 0x83dd0
callq 0xc060
cmpl $0x0, %eax
jne 0x13c18
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x701eb(%rip), %rsi     # 0x83dd8
callq 0xc060
cmpl $0x0, %eax
je 0x13cb4
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x701c1(%rip), %rsi     # 0x83dcb
callq 0xc060
cmpl $0x0, %eax
je 0x13cb4
cmpl $0x2, -0x8(%rbp)
jne 0x13c4c
movq -0x20(%rbp), %rdi
leaq 0x6ea4b(%rip), %rsi     # 0x82674
callq 0xc060
cmpl $0x0, %eax
jne 0x13c4c
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x7019c(%rip), %rsi     # 0x83dde
callq 0xc060
cmpl $0x0, %eax
je 0x13cb4
cmpl $0x3, -0x8(%rbp)
jne 0x13c80
movq -0x20(%rbp), %rdi
leaq 0x6f3d1(%rip), %rsi     # 0x8302e
callq 0xc060
cmpl $0x0, %eax
jne 0x13c80
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x7016d(%rip), %rsi     # 0x83de3
callq 0xc060
cmpl $0x0, %eax
je 0x13cb4
cmpl $0x2, -0x8(%rbp)
jne 0x13cbb
movq -0x20(%rbp), %rdi
leaq 0x6f39d(%rip), %rsi     # 0x8302e
callq 0xc060
cmpl $0x0, %eax
jne 0x13cbb
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x7013f(%rip), %rsi     # 0x83de9
callq 0xc060
cmpl $0x0, %eax
jne 0x13cbb
movl $0x1, -0x30(%rbp)
movq -0x20(%rbp), %rdi
leaq 0x7012a(%rip), %rsi     # 0x83df0
callq 0xc060
cmpl $0x0, %eax
jne 0x13cda
movl $0x1, 0x82f0a(%rip)     # 0x96be4
movq -0x20(%rbp), %rdi
leaq 0x70114(%rip), %rsi     # 0x83df9
callq 0xc060
cmpl $0x0, %eax
jne 0x13cf9
movl $0x1, 0x82eef(%rip)     # 0x96be8
movq -0x20(%rbp), %rdi
leaq 0x700fe(%rip), %rsi     # 0x83e02
callq 0xc060
cmpl $0x0, %eax
jne 0x13d18
movl $0x1, 0x82ed4(%rip)     # 0x96bec
movq -0x20(%rbp), %rdi
leaq 0x700de(%rip), %rsi     # 0x83e01
callq 0xc060
cmpl $0x0, %eax
jne 0x13d37
movl $0x1, 0x82eb5(%rip)     # 0x96bec
movslq -0x8(%rbp), %rdi
shlq $0x3, %rdi
callq 0xc3c0
movq %rax, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x13d82
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x14070
movq %rax, %rdx
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x13d4f
jmp 0x13d84
movl -0x14(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x14(%rbp)
cmpl $0x0, %eax
je 0x13e66
movq 0x82f29(%rip), %rdi     # 0x96cc8
movl -0x8(%rbp), %esi
movq -0x10(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x189d0
cmpl $0x0, 0x82e32(%rip)     # 0x96be8
je 0x13de0
movl -0x30(%rbp), %edi
callq 0x14100
cmpl $0x0, %eax
je 0x13dcf
movl $0x1, %edi
callq 0xc590
movq 0x821ea(%rip), %rax     # 0x95fc0
movq (%rax), %rdi
callq 0xc3e0
jmp 0x13daf
cmpl $0x0, 0x82e05(%rip)     # 0x96bec
je 0x13e1b
cmpl $0x1, 0x82e28(%rip)     # 0x96c18
je 0x13e00
leaq 0x70013(%rip), %rdi     # 0x83e0c
movb $0x0, %al
callq 0xc1c0
jmp 0x13e02
movl -0x30(%rbp), %edi
callq 0x14100
cmpl $0x0, %eax
je 0x13e19
movl $0x1, %edi
callq 0xc590
jmp 0x13e02
movl -0x30(%rbp), %edi
callq 0x14100
cmpl $0x0, %eax
je 0x13e3a
movq -0x28(%rbp), %rdi
callq 0xc050
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x13e76
cmpq $0x0, 0x82d96(%rip)     # 0x96bd8
je 0x13e52
movq 0x82d8d(%rip), %rax     # 0x96bd8
movl %eax, %edi
callq 0xc670
movq 0x82167(%rip), %rax     # 0x95fc0
movq (%rax), %rdi
callq 0xc3e0
jmp 0x13d84
movq -0x28(%rbp), %rdi
callq 0xc050
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nop