// File: /workspace/github_c_makefile_star2_O3/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 0x41111(%rip), %rdi     # 0x5a558
movq %rsp, %rsi
callq 0x1cf7f
testl %eax, %eax
je 0x1947c
cmpl $0x0, 0x40fde(%rip)     # 0x5a438
je 0x194e2
movq 0x410f1(%rip), %rdi     # 0x5a558
callq 0x1c9fe
movq $0x0, 0x410e1(%rip) # 0x5a558
jmp 0x1968b
movq (%rsp), %rbx
movl (%rbx), %eax
movl %eax, 0x410c8(%rip)     # 0x5a550
cmpl $0x0, 0x40fd1(%rip)     # 0x5a460
setne %cl
cmpl $0x6, %eax
sete %al
andb %cl, %al
cmpb $0x1, %al
jne 0x194cd
movq 0x18(%rbx), %r14
leaq 0x2ba37(%rip), %rsi     # 0x44ee0
movl $0x5, %edx
movq %r14, %rdi
callq 0x100c0
testl %eax, %eax
je 0x1952f
leaq 0x2ba25(%rip), %rsi     # 0x44ee6
movq %r14, %rdi
callq 0x10380
testl %eax, %eax
je 0x1952f
testl %ebp, %ebp
je 0x195d7
movq %rbx, %rdi
callq 0x19782
jmp 0x19621
cmpl $0x0, 0x40f4b(%rip)     # 0x5a434
je 0x19520
movq 0x41066(%rip), %rax     # 0x5a558
movl (%rax), %eax
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $0x3, %eax
je 0x1968d
cmpl $0x1, %eax
jne 0x19520
callq 0x100a0
movl (%rax), %eax
cmpl $0x20, %eax
je 0x1968d
cmpl $0x68, %eax
je 0x1968d
callq 0x196a3
movl $0x1, %edi
callq 0x10630
movq %r14, %rdi
movl $0x20, %esi
callq 0x101e0
leaq 0x1(%rax), %r14
movq %r14, %rdi
movl $0x20, %esi
callq 0x101e0
movq %rax, %r15
xorl %r13d, %r13d
movb %r13b, (%rax)
movq %r14, %rdi
callq 0x10600
movl %eax, %ebp
incq %r15
movq %r15, %rdi
movl $0x3a, %esi
callq 0x10230
movq %rax, %r12
movb %r13b, (%rax)
movq 0x40e8b(%rip), %rdi     # 0x5a408
callq 0x1da09
movq %r15, %rdi
callq 0x1d989
movq %rax, %r14
movq %rax, 0x40e74(%rip)     # 0x5a408
incq %r12
movq %r12, %rdi
callq 0x10600
movl %eax, 0x40e6b(%rip)     # 0x5a410
cmpl $0x0, 0x40e88(%rip)     # 0x5a434
je 0x195c3
leaq 0x2b935(%rip), %rdi     # 0x44eea
movl %ebp, %esi
movq %r14, %rdx
movl %eax, %ecx
xorl %eax, %eax
callq 0x101f0
movl $0x1, 0x40e97(%rip)     # 0x5a464
callq 0x196cc
jmp 0x19683
movl 0x40ecb(%rip), %eax     # 0x5a4a8
testl %eax, %eax
je 0x19612
cmpl $0x2, %eax
je 0x195f9
cmpl $0x1, %eax
jne 0x1969e
movq %rbx, %rdi
callq 0x19782
jmp 0x19601
movq %rbx, %rdi
callq 0x19b23
leaq 0x2bc87(%rip), %rsi     # 0x4528f
movq %rax, %rdi
callq 0x1e279
jmp 0x19621
leaq 0x2bc77(%rip), %rsi     # 0x45290
movq %rbx, %rdi
callq 0x1991b
movq %rax, %r14
movzbl -0x1(%r14), %esi
movl %esi, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x19662
leaq 0x26c56(%rip), %rcx     # 0x40290
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
shrl $0x3, %esi
jmp 0x19664
movq -0x11(%r14), %rsi
jmp 0x19664
movzwl -0x5(%r14), %esi
jmp 0x19664
movl -0x9(%r14), %esi
jmp 0x19664
movzbl -0x3(%r14), %esi
jmp 0x19664
xorl %esi, %esi
movq 0x3e955(%rip), %rax     # 0x57fc0
movq (%rax), %rcx
movl $0x1, %edx
movq %r14, %rdi
callq 0x10650
movq %r14, %rdi
callq 0x1da09
movq %rbx, %rdi
callq 0x1b6f0
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 0x19624