// File: /workspace/github_c_makefile_star2_O3/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 0x24e1e(%rip), %rsi     # 0x3a2d9
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
je 0x1558b
leaq 0x25aaf(%rip), %rsi     # 0x3af81
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
je 0x1558b
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpq $0x0, 0x377a8(%rip)     # 0x4cc98
je 0x15870
leaq 0x25a86(%rip), %rsi     # 0x3af83
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
je 0x1570a
xorl %r12d, %r12d
cmpl $0x3, %ebp
je 0x156b3
cmpl $0x2, %ebp
jne 0x15710
leaq 0x25a5f(%rip), %rsi     # 0x3af88
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
je 0x156dc
leaq 0x24410(%rip), %rsi     # 0x39950
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
jne 0x15564
movq 0x8(%rbx), %rdi
leaq 0x25a3f(%rip), %rsi     # 0x3af96
callq 0xc080
testl %eax, %eax
je 0x1570a
leaq 0x24d8a(%rip), %rsi     # 0x3a2f5
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
jne 0x15710
movq 0x8(%rbx), %rdi
leaq 0x25a1b(%rip), %rsi     # 0x3afa1
jmp 0x156d1
movl %ebp, %eax
decl %eax
movl %eax, 0x4(%rsp)
je 0x155db
cmpl $0x2, %ebp
jl 0x158bd
movq 0x8(%rbx), %r14
cmpb $0x40, (%r14)
jne 0x155d2
incq %r14
leaq 0x34e4e(%rip), %r13     # 0x4a400
xorl %r12d, %r12d
movq (%r13), %rsi
movq %r14, %rdi
callq 0xc080
testl %eax, %eax
je 0x15604
incq %r12
addq $0x8, %r13
cmpq $0x4, %r12
jne 0x155b5
movl $0xffffffff, (%rsp)     # imm = 0xFFFFFFFF
jmp 0x15608
callq 0x1519b
movq %rax, %rbx
leaq 0x25a04(%rip), %rdi     # 0x3afee
xorl %r14d, %r14d
movq %rax, %rsi
xorl %eax, %eax
callq 0xc1e0
movq %rbx, %rdi
callq 0x11441
jmp 0x15870
movl %r12d, (%rsp)
cmpb $0x1, 0x37679(%rip)     # 0x4cc88
jne 0x156a2
movl 0x4(%rsp), %r12d
xorl %r13d, %r13d
movq 0x3766c(%rip), %rax     # 0x4cc90
movq %r13, %rcx
shlq $0x5, %rcx
cmpl $0x1, (%rax,%rcx)
jne 0x1568c
addq %rcx, %rax
movq 0x18(%rax), %r14
movl (%rsp), %ecx
cmpl $-0x1, %ecx
je 0x1564d
cmpl 0x18(%r14), %ecx
jne 0x1568c
movq %r14, %rdi
xorl %esi, %esi
jmp 0x15687
movl 0x4(%rsp), %ecx
cmpl %ecx, 0x4(%rax)
jne 0x1568c
movq 0x8(%rax), %rbp
xorl %r15d, %r15d
movq 0x8(%rbx,%r15,8), %rdi
movq (%rbp,%r15,8), %rsi
callq 0xc080
testl %eax, %eax
jne 0x1567a
incq %r15
cmpq %r15, %r12
jne 0x1565d
jmp 0x1567f
cmpl %r15d, %r12d
jne 0x1568c
movq %r14, %rdi
movl $0x1, %esi
callq 0x15a7e
cmpq $0x30, %r13
ja 0x156a2
incq %r13
testb $0x1, 0x375ec(%rip)     # 0x4cc88
jne 0x1561d
leaq 0x257c4(%rip), %rdi     # 0x3ae6d
callq 0xc0e0
jmp 0x1586d
leaq 0x24c3b(%rip), %rsi     # 0x3a2f5
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
jne 0x15710
movq 0x8(%rbx), %rdi
leaq 0x258ca(%rip), %rsi     # 0x3af9b
callq 0xc080
testl %eax, %eax
jne 0x15710
jmp 0x1570a
movq 0x8(%rbx), %r14
leaq 0x258a9(%rip), %rsi     # 0x3af90
movq %r14, %rdi
callq 0xc080
testl %eax, %eax
je 0x1570a
leaq 0x25889(%rip), %rsi     # 0x3af83
movq %r14, %rdi
callq 0xc080
testl %eax, %eax
jne 0x15539
movl $0x1, %r12d
leaq 0x25891(%rip), %rsi     # 0x3afa8
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
jne 0x1572d
movl $0x1, 0x37487(%rip)     # 0x4cbb4
leaq 0x2587d(%rip), %rsi     # 0x3afb1
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
jne 0x1574a
movl $0x1, 0x3746e(%rip)     # 0x4cbb8
leaq 0x25869(%rip), %rsi     # 0x3afba
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
jne 0x15767
movl $0x1, 0x37455(%rip)     # 0x4cbbc
leaq 0x2584b(%rip), %rsi     # 0x3afb9
movq %r13, %rdi
callq 0xc080
testl %eax, %eax
jne 0x15784
movl $0x1, 0x37438(%rip)     # 0x4cbbc
movslq %ebp, %rdi
shlq $0x3, %rdi
callq 0xc3f0
movq %rax, %r13
testl %ebp, %ebp
jle 0x157ec
movl %ebp, %eax
xorl %ecx, %ecx
leaq 0x24046(%rip), %rdx     # 0x397e8
movq (%rbx,%rcx,8), %rdi
movzbl -0x1(%rdi), %esi
movl %esi, %r8d
andl $0x7, %r8d
cmpl $0x4, %r8d
ja 0x157dd
movslq (%rdx,%r8,4), %r8
addq %rdx, %r8
jmpq *%r8
shrl $0x3, %esi
jmp 0x157df
movq -0x11(%rdi), %rsi
jmp 0x157df
movzwl -0x5(%rdi), %esi
jmp 0x157df
movl -0x9(%rdi), %esi
jmp 0x157df
movzbl -0x3(%rdi), %esi
jmp 0x157df
xorl %esi, %esi
movq %rsi, (%r13,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x157a2
testl %r15d, %r15d
je 0x15865
movq 0x367c8(%rip), %r14     # 0x4bfc0
movq 0x37499(%rip), %rdi     # 0x4cc98
movl %ebp, %esi
movq %rbx, %rdx
movq %r13, %rcx
callq 0x18aad
cmpl $0x0, 0x373a5(%rip)     # 0x4cbb8
je 0x1582f
movl %r12d, %edi
callq 0x15905
testl %eax, %eax
jne 0x158b3
movq (%r14), %rdi
callq 0xc410
jmp 0x1580c
cmpl $0x0, 0x37386(%rip)     # 0x4cbbc
jne 0x15892
movl %r12d, %edi
callq 0x15905
testl %eax, %eax
jne 0x15882
movq 0x3735d(%rip), %rdi     # 0x4cba8
testq %rdi, %rdi
je 0x15855
callq 0xc6a0
decl %r15d
movq (%r14), %rdi
callq 0xc410
testl %r15d, %r15d
jne 0x157f8
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 0x15870
cmpl $0x1, 0x3734f(%rip)     # 0x4cbe8
je 0x158a7
leaq 0x25a22(%rip), %rdi     # 0x3b2c4
callq 0xc0e0
movl %r12d, %edi
callq 0x15905
testl %eax, %eax
je 0x158a7
movl $0x1, %edi
callq 0xc5b0
leaq 0x25700(%rip), %rdi     # 0x3afc4
leaq 0x2555e(%rip), %rsi     # 0x3ae29
leaq 0x256fb(%rip), %rcx     # 0x3afcd
movl $0xea, %edx
callq 0xc230