// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/redis-cli.c
// Function: cliReadReply
static int cliReadReply(int output_raw_strings) {
    void *_reply;
    redisReply *reply;
    sds out = NULL;
    int output = 1;

    if (redisGetReply(context,&_reply) != REDIS_OK) {
        if (config.shutdown) {
            redisFree(context);
            context = NULL;
            return REDIS_OK;
        }
        if (config.interactive) {
            /* Filter cases where we should reconnect */
            if (context->err == REDIS_ERR_IO &&
                (errno == ECONNRESET || errno == EPIPE))
                return REDIS_ERR;
            if (context->err == REDIS_ERR_EOF)
                return REDIS_ERR;
        }
        cliPrintContextError();
        exit(1);
        return REDIS_ERR; /* avoid compiler warning */
    }

    reply = (redisReply*)_reply;

    config.last_cmd_type = reply->type;

    /* Check if we need to connect to a different node and reissue the
     * request. */
    if (config.cluster_mode && reply->type == REDIS_REPLY_ERROR &&
        (!strncmp(reply->str,"MOVED",5) || !strcmp(reply->str,"ASK")))
    {
        char *p = reply->str, *s;
        int slot;

        output = 0;
        /* Comments show the position of the pointer as:
         *
         * [S] for pointer 's'
         * [P] for pointer 'p'
         */
        s = strchr(p,' ');      /* MOVED[S]3999 127.0.0.1:6381 */
        p = strchr(s+1,' ');    /* MOVED[S]3999[P]127.0.0.1:6381 */
        *p = '\0';
        slot = atoi(s+1);
        s = strrchr(p+1,':');    /* MOVED 3999[P]127.0.0.1[S]6381 */
        *s = '\0';
        sdsfree(config.hostip);
        config.hostip = sdsnew(p+1);
        config.hostport = atoi(s+1);
        if (config.interactive)
            printf("-> Redirected to slot [%d] located at %s:%d\n",
                slot, config.hostip, config.hostport);
        config.cluster_reissue_command = 1;
        cliRefreshPrompt();
    }

    if (output) {
        if (output_raw_strings) {
            out = cliFormatReplyRaw(reply);
        } else {
            if (config.output == OUTPUT_RAW) {
                out = cliFormatReplyRaw(reply);
                out = sdscat(out,"\n");
            } else if (config.output == OUTPUT_STANDARD) {
                out = cliFormatReplyTTY(reply,"");
            } else if (config.output == OUTPUT_CSV) {
                out = cliFormatReplyCSV(reply);
                out = sdscat(out,"\n");
            }
        }
        fwrite(out,sdslen(out),1,stdout);
        sdsfree(out);
    }
    freeReplyObject(reply);
    return REDIS_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebp
movq 0x412f6(%rip), %rdi     # 0x56558
movq %rsp, %rsi
callq 0x18621
testl %eax, %eax
je 0x15290
cmpl $0x0, 0x411c3(%rip)     # 0x56438
je 0x152f4
movq 0x412da(%rip), %rdi     # 0x56558
callq 0x18214
andq $0x0, 0x412cd(%rip)     # 0x56558
jmp 0x15456
movq (%rsp), %rbx
movl (%rbx), %eax
movl %eax, 0x412b4(%rip)     # 0x56550
cmpl $0x0, 0x411bd(%rip)     # 0x56460
setne %cl
cmpl $0x6, %eax
sete %al
andb %cl, %al
cmpb $0x1, %al
jne 0x152df
movq 0x18(%rbx), %r14
leaq 0x2ab73(%rip), %rsi     # 0x3fe30
pushq $0x5
popq %rdx
movq %r14, %rdi
callq 0x100c0
testl %eax, %eax
je 0x1533d
leaq 0x2ab63(%rip), %rsi     # 0x3fe36
movq %r14, %rdi
callq 0x10380
testl %eax, %eax
je 0x1533d
testl %ebp, %ebp
je 0x153dd
movq %rbx, %rdi
callq 0x1554d
jmp 0x15423
cmpl $0x0, 0x41139(%rip)     # 0x56434
je 0x15330
movq 0x41254(%rip), %rax     # 0x56558
movl (%rax), %eax
pushq $-0x1
popq %rbx
cmpl $0x3, %eax
je 0x15458
cmpl $0x1, %eax
jne 0x15330
callq 0x100a0
movl (%rax), %eax
cmpl $0x20, %eax
je 0x15458
cmpl $0x68, %eax
je 0x15458
callq 0x1546e
pushq $0x1
popq %rdi
callq 0x10630
pushq $0x20
popq %rbp
movq %r14, %rdi
movl %ebp, %esi
callq 0x101e0
leaq 0x1(%rax), %r14
movq %r14, %rdi
movl %ebp, %esi
callq 0x101e0
movq %rax, %r15
xorl %r13d, %r13d
movb %r13b, (%rax)
movq %r14, %rdi
callq 0x10600
movl %eax, %ebp
incq %r15
pushq $0x3a
popq %rsi
movq %r15, %rdi
callq 0x10230
movq %rax, %r12
movb %r13b, (%rax)
movq 0x41082(%rip), %rdi     # 0x56408
callq 0x18f40
movq %r15, %rdi
callq 0x18ed2
movq %rax, %r14
movq %rax, 0x4106b(%rip)     # 0x56408
incq %r12
movq %r12, %rdi
callq 0x10600
movl %eax, 0x41062(%rip)     # 0x56410
cmpl $0x0, 0x4107f(%rip)     # 0x56434
je 0x153cc
leaq 0x2aa7c(%rip), %rdi     # 0x3fe3a
movl %ebp, %esi
movq %r14, %rdx
movl %eax, %ecx
xorl %eax, %eax
callq 0x101f0
movl $0x1, 0x4108e(%rip)     # 0x56464
callq 0x15497
jmp 0x1544e
movl 0x410c5(%rip), %eax     # 0x564a8
testl %eax, %eax
je 0x15414
cmpl $0x2, %eax
je 0x153fb
cmpl $0x1, %eax
jne 0x15469
movq %rbx, %rdi
callq 0x1554d
jmp 0x15403
movq %rbx, %rdi
callq 0x1589b
leaq 0x2add5(%rip), %rsi     # 0x401df
movq %rax, %rdi
callq 0x1952f
jmp 0x15423
leaq 0x2adc5(%rip), %rsi     # 0x401e0
movq %rbx, %rdi
callq 0x156c5
movq %rax, %r14
movq %r14, %rdi
callq 0x159d8
movq 0x3eb8b(%rip), %rcx     # 0x53fc0
movq (%rcx), %rcx
pushq $0x1
popq %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x10650
movq %r14, %rdi
callq 0x18f40
movq %rbx, %rdi
callq 0x170f8
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r14d, %r14d
jmp 0x15426