// File: /workspace/github_c_makefile_star2_O1/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 0x2479c(%rip), %rsi     # 0x3a288
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
je 0x15bf5
leaq 0x25445(%rip), %rsi     # 0x3af48
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
je 0x15bf5
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpq $0x0, 0x37177(%rip)     # 0x4cc98
je 0x15ec4
leaq 0x2541c(%rip), %rsi     # 0x3af4a
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
je 0x15d5e
cmpl $0x2, %ebp
jne 0x15b85
leaq 0x25405(%rip), %rsi     # 0x3af4f
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
je 0x15d30
leaq 0x23d9b(%rip), %rsi     # 0x398fc
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
jne 0x15b85
movq 0x8(%rbx), %rdi
leaq 0x253e5(%rip), %rsi     # 0x3af5d
callq 0xc080
testl %eax, %eax
je 0x15d5e
cmpl $0x3, %ebp
jne 0x15bb5
leaq 0x24725(%rip), %rsi     # 0x3a2b6
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
jne 0x15bb5
movq 0x8(%rbx), %rdi
leaq 0x253ba(%rip), %rsi     # 0x3af62
callq 0xc080
testl %eax, %eax
je 0x15d5e
xorl %r12d, %r12d
cmpl $0x2, %ebp
jne 0x15d64
leaq 0x246ee(%rip), %rsi     # 0x3a2b6
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
jne 0x15d64
movq 0x8(%rbx), %rdi
leaq 0x25385(%rip), %rsi     # 0x3af68
callq 0xc080
testl %eax, %eax
jne 0x15d64
jmp 0x15d5e
movl %ebp, %r12d
decl %r12d
je 0x15c43
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
cmpl $0x2, %ebp
jl 0x15c6f
movq 0x8(%rbx), %r14
cmpb $0x40, (%r14)
jne 0x15c6f
incq %r14
leaq 0x347e4(%rip), %r15     # 0x4a400
xorl %r13d, %r13d
movq (%r15), %rsi
movq %r14, %rdi
callq 0xc080
testl %eax, %eax
je 0x15c6c
incq %r13
addq $0x8, %r15
cmpq $0x4, %r13
jne 0x15c1f
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
jmp 0x15c6f
callq 0x157e4
movq %rax, %rbx
leaq 0x25363(%rip), %rdi     # 0x3afb5
xorl %r14d, %r14d
movq %rax, %rsi
xorl %eax, %eax
callq 0xc1e0
movq %rbx, %rdi
callq 0x119ef
jmp 0x15ec4
movl %r13d, %r15d
cmpl $0x2, %ebp
jl 0x15f11
cmpb $0x1, 0x37009(%rip)     # 0x4cc88
jne 0x15d1f
movl %r12d, %r13d
xorl %ebp, %ebp
movl %r12d, (%rsp)
movl %r15d, 0x4(%rsp)
movq 0x36ff6(%rip), %rax     # 0x4cc90
movq %rbp, %rcx
shlq $0x5, %rcx
cmpl $0x1, (%rax,%rcx)
jne 0x15d09
addq %rcx, %rax
movq 0x18(%rax), %r14
cmpl $-0x1, %r15d
je 0x15cbe
xorl %esi, %esi
cmpl 0x18(%r14), %r15d
je 0x15d01
jmp 0x15d09
cmpl %r12d, 0x4(%rax)
jne 0x15d09
movq 0x8(%rax), %r12
xorl %r15d, %r15d
movq 0x8(%rbx,%r15,8), %rdi
movq (%r12,%r15,8), %rsi
callq 0xc080
testl %eax, %eax
jne 0x15cee
incq %r15
cmpq %r15, %r13
jne 0x15ccb
movl (%rsp), %r12d
movl %r12d, %r15d
jmp 0x15cf2
movl (%rsp), %r12d
movl $0x1, %esi
cmpl %r12d, %r15d
movl 0x4(%rsp), %r15d
jne 0x15d09
movq %r14, %rdi
callq 0x160db
cmpq $0x30, %rbp
ja 0x15d1f
incq %rbp
testb $0x1, 0x36f6f(%rip)     # 0x4cc88
jne 0x15c93
leaq 0x2510e(%rip), %rdi     # 0x3ae34
callq 0xc0e0
jmp 0x15ec1
movq 0x8(%rbx), %r12
leaq 0x2521c(%rip), %rsi     # 0x3af57
movq %r12, %rdi
callq 0xc080
testl %eax, %eax
je 0x15d5e
leaq 0x251fc(%rip), %rsi     # 0x3af4a
movq %r12, %rdi
callq 0xc080
testl %eax, %eax
jne 0x15b5a
movl $0x1, %r12d
leaq 0x25204(%rip), %rsi     # 0x3af6f
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
jne 0x15d81
movl $0x1, 0x36e33(%rip)     # 0x4cbb4
leaq 0x251f0(%rip), %rsi     # 0x3af78
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
jne 0x15d9e
movl $0x1, 0x36e1a(%rip)     # 0x4cbb8
leaq 0x251dc(%rip), %rsi     # 0x3af81
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
jne 0x15dbb
movl $0x1, 0x36e01(%rip)     # 0x4cbbc
leaq 0x251be(%rip), %rsi     # 0x3af80
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
jne 0x15dd8
movl $0x1, 0x36de4(%rip)     # 0x4cbbc
movslq %ebp, %rdi
shlq $0x3, %rdi
callq 0xc3f0
movq %rax, %r13
testl %ebp, %ebp
jle 0x15e40
movl %ebp, %eax
xorl %ecx, %ecx
leaq 0x2399e(%rip), %rdx     # 0x39794
movq (%rbx,%rcx,8), %rdi
movzbl -0x1(%rdi), %esi
movl %esi, %r8d
andl $0x7, %r8d
cmpl $0x4, %r8d
ja 0x15e31
movslq (%rdx,%r8,4), %r8
addq %rdx, %r8
jmpq *%r8
shrl $0x3, %esi
jmp 0x15e33
movq -0x11(%rdi), %rsi
jmp 0x15e33
movzwl -0x5(%rdi), %esi
jmp 0x15e33
movl -0x9(%rdi), %esi
jmp 0x15e33
movzbl -0x3(%rdi), %esi
jmp 0x15e33
xorl %esi, %esi
movq %rsi, (%r13,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x15df6
testl %r15d, %r15d
je 0x15eb9
movq 0x36174(%rip), %r14     # 0x4bfc0
movq 0x36e45(%rip), %rdi     # 0x4cc98
movl %ebp, %esi
movq %rbx, %rdx
movq %r13, %rcx
callq 0x18f8b
cmpl $0x0, 0x36d51(%rip)     # 0x4cbb8
je 0x15e83
movl %r12d, %edi
callq 0x15f59
testl %eax, %eax
jne 0x15f07
movq (%r14), %rdi
callq 0xc410
jmp 0x15e60
cmpl $0x0, 0x36d32(%rip)     # 0x4cbbc
jne 0x15ee6
movl %r12d, %edi
callq 0x15f59
testl %eax, %eax
jne 0x15ed6
movq 0x36d09(%rip), %rdi     # 0x4cba8
testq %rdi, %rdi
je 0x15ea9
callq 0xc6a0
decl %r15d
movq (%r14), %rdi
callq 0xc410
testl %r15d, %r15d
jne 0x15e4c
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
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jmp 0x15ec4
cmpl $0x1, 0x36cfb(%rip)     # 0x4cbe8
je 0x15efb
leaq 0x25395(%rip), %rdi     # 0x3b28b
callq 0xc0e0
movl %r12d, %edi
callq 0x15f59
testl %eax, %eax
je 0x15efb
movl $0x1, %edi
callq 0xc5b0
leaq 0x25073(%rip), %rdi     # 0x3af8b
leaq 0x24ed1(%rip), %rsi     # 0x3adf0
leaq 0x2506e(%rip), %rcx     # 0x3af94
movl $0xea, %edx
callq 0xc230