// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/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 (!config.eval_ldb && /* In debugging mode, let's pass "help" to Redis. */
        (!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,"debug") &&
                      ((!strcasecmp(argv[1],"jemalloc") && !strcasecmp(argv[2],"info")) ||
                       !strcasecmp(argv[1],"htstats"))) ||
        (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") ||
        !strcasecmp(command,"psubscribe")) config.pubsub_mode = 1;
    if (!strcasecmp(command,"sync") ||
        !strcasecmp(command,"psync")) config.slave_mode = 1;

    /* When the user manually calls SCRIPT DEBUG, setup the activation of
     * debugging mode on the next eval if needed. */
    if (argc == 3 && !strcasecmp(argv[0],"script") &&
                     !strcasecmp(argv[1],"debug"))
    {
        if (!strcasecmp(argv[2],"yes") || !strcasecmp(argv[2],"sync")) {
            config.enable_ldb_on_eval = 1;
        } else {
            config.enable_ldb_on_eval = 0;
        }
    }

    /* Actually activate LDB on EVAL if needed. */
    if (!strcasecmp(command,"eval") && config.enable_ldb_on_eval) {
        config.eval_ldb = 1;
        config.output = OUTPUT_RAW;
    }

    /* Setup argument length */
    argvlen = zmalloc(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;
            zfree(argvlen);
            return REDIS_ERR;  /* Error = slaveMode lost connection to master */
        }

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

    zfree(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
cmpl $0x0, 0x4076c(%rip)     # 0x56540
je 0x15ee5
pushq $-0x1
popq %rbp
cmpq $0x0, 0x40773(%rip)     # 0x56558
je 0x16321
leaq 0x2a9b0(%rip), %rsi     # 0x407a2
movq %r12, %rdi
callq 0x10080
testl %eax, %eax
je 0x1608a
xorl %r13d, %r13d
cmpl $0x2, %r14d
jl 0x1608e
leaq 0x2d487(%rip), %rsi     # 0x4329d
movq %r12, %rdi
callq 0x10080
testl %eax, %eax
jne 0x15e68
movq 0x8(%rbx), %rbp
leaq 0x2a97a(%rip), %rsi     # 0x407a7
movq %rbp, %rdi
callq 0x10080
testl %eax, %eax
jne 0x15e51
movq 0x10(%rbx), %rdi
leaq 0x2a95e(%rip), %rsi     # 0x407a2
callq 0x10080
testl %eax, %eax
je 0x1608a
leaq 0x2a958(%rip), %rsi     # 0x407b0
movq %rbp, %rdi
callq 0x10080
testl %eax, %eax
je 0x1608a
cmpl $0x3, %r14d
je 0x15f8d
cmpl $0x2, %r14d
jne 0x1608e
leaq 0x2a8d0(%rip), %rsi     # 0x40753
movq %r12, %rdi
callq 0x10080
testl %eax, %eax
je 0x1605c
leaq 0x25bc5(%rip), %rsi     # 0x3ba5f
movq %r12, %rdi
callq 0x10080
testl %eax, %eax
jne 0x15ebe
movq 0x8(%rbx), %rdi
leaq 0x27116(%rip), %rsi     # 0x3cfc7
callq 0x10080
testl %eax, %eax
je 0x1608a
leaq 0x28fab(%rip), %rsi     # 0x3ee70
movq %r12, %rdi
callq 0x10080
testl %eax, %eax
jne 0x1608e
movq 0x8(%rbx), %rdi
leaq 0x2a8e4(%rip), %rsi     # 0x407c4
jmp 0x15faf
leaq 0x28f68(%rip), %rsi     # 0x3ee54
movq %r12, %rdi
callq 0x10080
testl %eax, %eax
je 0x15f0f
leaq 0x2a8a1(%rip), %rsi     # 0x407a0
movq %r12, %rdi
callq 0x10080
testl %eax, %eax
jne 0x15dda
movl %r14d, %eax
decl %eax
movl %eax, 0xc(%rsp)
je 0x15f65
cmpl $0x2, %r14d
jl 0x1635b
movq 0x8(%rbx), %r14
pushq $-0x1
popq %r15
cmpb $0x40, (%r14)
jne 0x15f5e
incq %r14
leaq 0x3c474(%rip), %rbp     # 0x523b0
xorl %r13d, %r13d
cmpq $0xe, %r13
je 0x15f5e
movq (%rbp), %rsi
movq %r14, %rdi
callq 0x10080
testl %eax, %eax
je 0x15fc1
incq %r13
addq $0x8, %rbp
jmp 0x15f3f
movl %r15d, 0x10(%rsp)
jmp 0x15fc6
callq 0x14f99
movq %rax, %rbx
leaq 0x2a8af(%rip), %rdi     # 0x40823
xorl %ebp, %ebp
movq %rax, %rsi
xorl %eax, %eax
callq 0x101f0
movq %rbx, %rdi
callq 0x18f40
jmp 0x16321
leaq 0x28edc(%rip), %rsi     # 0x3ee70
movq %r12, %rdi
callq 0x10080
testl %eax, %eax
jne 0x1608e
movq 0x8(%rbx), %rdi
leaq 0x2a80f(%rip), %rsi     # 0x407be
callq 0x10080
testl %eax, %eax
jne 0x1608e
jmp 0x1608a
movl %r13d, 0x10(%rsp)
movl 0xc(%rsp), %r13d
xorl %ebp, %ebp
movslq 0x40590(%rip), %rax     # 0x56564
cmpq %rax, %rbp
jge 0x1604b
movq 0x40588(%rip), %rax     # 0x56568
movq %rbp, %rcx
shlq $0x5, %rcx
cmpl $0x1, (%rax,%rcx)
jne 0x16046
addq %rcx, %rax
movq 0x18(%rax), %r14
movl 0x10(%rsp), %ecx
cmpl $-0x1, %ecx
je 0x1600a
cmpl 0x18(%r14), %ecx
jne 0x16046
movq %r14, %rdi
xorl %esi, %esi
jmp 0x16041
movl 0xc(%rsp), %ecx
cmpl %ecx, 0x4(%rax)
jne 0x16046
movq 0x8(%rax), %r12
xorl %r15d, %r15d
cmpq %r15, %r13
je 0x1603b
movq 0x8(%rbx,%r15,8), %rdi
movq (%r12,%r15,8), %rsi
callq 0x10080
testl %eax, %eax
jne 0x16036
incq %r15
jmp 0x1601a
cmpl %r15d, %r13d
jne 0x16046
movq %r14, %rdi
pushq $0x1
popq %rsi
callq 0x1637a
incq %rbp
jmp 0x15fcd
leaq 0x29d41(%rip), %rdi     # 0x3fd93
callq 0x100e0
jmp 0x162fa
movq 0x8(%rbx), %rbp
leaq 0x2a751(%rip), %rsi     # 0x407b8
movq %rbp, %rdi
callq 0x10080
testl %eax, %eax
je 0x1608a
leaq 0x2a728(%rip), %rsi     # 0x407a2
movq %rbp, %rdi
callq 0x10080
testl %eax, %eax
jne 0x15e93
pushq $0x1
popq %r13
leaq 0x2a736(%rip), %rsi     # 0x407cb
movq %r12, %rdi
callq 0x10080
testl %eax, %eax
jne 0x160ab
movl $0x1, 0x4038d(%rip)     # 0x56438
leaq 0x2a722(%rip), %rsi     # 0x407d4
movq %r12, %rdi
callq 0x10080
testl %eax, %eax
jne 0x160c8
movl $0x1, 0x40374(%rip)     # 0x5643c
leaq 0x2a70e(%rip), %rsi     # 0x407dd
movq %r12, %rdi
callq 0x10080
testl %eax, %eax
je 0x160ee
leaq 0x2a6fa(%rip), %rsi     # 0x407dc
movq %r12, %rdi
callq 0x10080
testl %eax, %eax
jne 0x160f8
movl $0x1, 0x40348(%rip)     # 0x56440
leaq 0x2a930(%rip), %rsi     # 0x40a2f
movq %r12, %rdi
callq 0x10080
testl %eax, %eax
je 0x1611e
leaq 0x2a6d5(%rip), %rsi     # 0x407e7
movq %r12, %rdi
callq 0x10080
testl %eax, %eax
jne 0x16128
movl $0x1, 0x40340(%rip)     # 0x56468
movq %r12, 0x10(%rsp)
pushq $0x1
popq %r12
cmpl $0x3, %r14d
jne 0x16196
leaq 0x27ac1(%rip), %rsi     # 0x3dbff
movq 0x10(%rsp), %rdi
callq 0x10080
testl %eax, %eax
jne 0x16196
movq 0x8(%rbx), %rdi
leaq 0x2d146(%rip), %rsi     # 0x4329d
callq 0x10080
testl %eax, %eax
jne 0x16196
movq 0x10(%rbx), %rbp
leaq 0x2a8d6(%rip), %rsi     # 0x40a41
movq %rbp, %rdi
callq 0x10080
movl %r12d, %ecx
testl %eax, %eax
je 0x16190
leaq 0x2a8ae(%rip), %rsi     # 0x40a2f
movq %rbp, %rdi
callq 0x10080
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
movl %ecx, 0x403b6(%rip)     # 0x5654c
leaq 0x28d6a(%rip), %rsi     # 0x3ef07
movq 0x10(%rsp), %rdi
callq 0x10080
testl %eax, %eax
jne 0x161c2
cmpl $0x0, 0x4039a(%rip)     # 0x5654c
je 0x161c2
movl %r12d, 0x40385(%rip)    # 0x56540
movl %r12d, 0x402e6(%rip)    # 0x564a8
movslq %r14d, %rdi
shlq $0x3, %rdi
callq 0x163fd
movq %rax, %rbp
xorl %r12d, %r12d
testl %r14d, %r14d
movl %r14d, %eax
movl $0x0, %r14d
movl %eax, 0xc(%rsp)
cmovgl %eax, %r14d
cmpq %r12, %r14
je 0x16200
movq (%rbx,%r12,8), %rdi
callq 0x159d8
movq %rax, (%rbp,%r12,8)
incq %r12
jmp 0x161e8
movq 0x3ddb9(%rip), %r12     # 0x53fc0
movl 0xc(%rsp), %r14d
subl $0x1, %r15d
jb 0x162f2
movq 0x4033b(%rip), %rdi     # 0x56558
movl %r14d, %esi
movq %rbx, %rdx
movq %rbp, %rcx
callq 0x187e6
cmpl $0x0, 0x4020a(%rip)     # 0x5643c
je 0x1624f
movl %r13d, %edi
callq 0x1524e
testl %eax, %eax
jne 0x16353
movq (%r12), %rdi
callq 0x10470
jmp 0x1622b
cmpl $0x0, 0x401ea(%rip)     # 0x56440
jne 0x16332
cmpl $0x0, 0x40205(%rip)     # 0x56468
jne 0x162fe
movl %r13d, %edi
callq 0x1524e
testl %eax, %eax
jne 0x16316
movq 0x10(%rsp), %rdi
leaq 0x2a568(%rip), %rsi     # 0x407ed
callq 0x10080
cmpl $0x2, %r14d
jne 0x162b3
testl %eax, %eax
jne 0x162b3
cmpl $0x6, 0x402b5(%rip)     # 0x56550
je 0x162b3
movq 0x8(%rbx), %rdi
callq 0x10600
movl %eax, 0x40184(%rip)     # 0x56430
callq 0x15497
jmp 0x162d3
movq 0x10(%rsp), %rdi
leaq 0x2a535(%rip), %rsi     # 0x407f4
callq 0x10080
cmpl $0x2, %r14d
jne 0x162d3
testl %eax, %eax
jne 0x162d3
callq 0x1502d
movq 0x4014e(%rip), %rdi     # 0x56428
testq %rdi, %rdi
je 0x162e4
callq 0x10720
movq (%r12), %rdi
callq 0x10470
jmp 0x1620c
movq %rbp, %rdi
callq 0x1653d
xorl %ebp, %ebp
jmp 0x16321
leaq 0x2ab1f(%rip), %rdi     # 0x40e24
callq 0x100e0
callq 0x1478b
andl $0x0, 0x40152(%rip)     # 0x56468
movq %rbp, %rdi
callq 0x1653d
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, 0x4016f(%rip)     # 0x564a8
je 0x16347
leaq 0x2ab18(%rip), %rdi     # 0x40e5a
callq 0x100e0
movl %r13d, %edi
callq 0x1524e
testl %eax, %eax
je 0x16347
pushq $0x1
popq %rdi
callq 0x10630
leaq 0x2a497(%rip), %rdi     # 0x407f9
leaq 0x299be(%rip), %rsi     # 0x3fd27
leaq 0x2a492(%rip), %rcx     # 0x40802
movl $0x174, %edx            # imm = 0x174
callq 0x10250