// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movl %edi, -0x8(%rbp)
movq $0x0, -0x20(%rbp)
movl $0x1, -0x24(%rbp)
movq 0x8a467(%rip), %rdi     # 0xa15d8
leaq -0x10(%rbp), %rsi
callq 0x1d3b0
cmpl $0x0, %eax
je 0x1720d
cmpl $0x0, 0x8a32e(%rip)     # 0xa14b8
je 0x171af
movq 0x8a445(%rip), %rdi     # 0xa15d8
callq 0x1cb90
movq $0x0, 0x8a435(%rip) # 0xa15d8
movl $0x0, -0x4(%rbp)
jmp 0x1742d
cmpl $0x0, 0x8a2fe(%rip)     # 0xa14b4
je 0x171fe
movq 0x8a419(%rip), %rax     # 0xa15d8
cmpl $0x1, (%rax)
jne 0x171e4
callq 0x10080
cmpl $0x68, (%rax)
je 0x171d8
callq 0x10080
cmpl $0x20, (%rax)
jne 0x171e4
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1742d
movq 0x8a3ed(%rip), %rax     # 0xa15d8
cmpl $0x3, (%rax)
jne 0x171fc
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1742d
jmp 0x171fe
callq 0x17440
movl $0x1, %edi
callq 0x10600
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, 0x8a3af(%rip)     # 0xa15d0
cmpl $0x0, 0x8a2b8(%rip)     # 0xa14e0
je 0x1734e
movq -0x18(%rbp), %rax
cmpl $0x6, (%rax)
jne 0x1734e
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x74c7a(%rip), %rsi     # 0x8bec4
movl $0x5, %edx
callq 0x100a0
cmpl $0x0, %eax
je 0x17276
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x74c62(%rip), %rsi     # 0x8beca
callq 0x10330
cmpl $0x0, %eax
jne 0x1734e
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x30(%rbp), %rdi
movl $0x20, %esi
callq 0x101c0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
addq $0x1, %rdi
movl $0x20, %esi
callq 0x101c0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb $0x0, (%rax)
movq -0x38(%rbp), %rdi
addq $0x1, %rdi
callq 0x105c0
movl %eax, -0x3c(%rbp)
movq -0x30(%rbp), %rdi
addq $0x1, %rdi
movl $0x3a, %esi
callq 0x10210
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movb $0x0, (%rax)
movq 0x8a19c(%rip), %rdi     # 0xa1488
callq 0x1ee80
movq -0x30(%rbp), %rdi
addq $0x1, %rdi
callq 0x1ed70
movq %rax, 0x8a183(%rip)     # 0xa1488
movq -0x38(%rbp), %rdi
addq $0x1, %rdi
callq 0x105c0
movl %eax, 0x8a178(%rip)     # 0xa1490
cmpl $0x0, 0x8a195(%rip)     # 0xa14b4
je 0x1733f
movl -0x3c(%rbp), %esi
movq 0x8a15d(%rip), %rdx     # 0xa1488
movl 0x8a15f(%rip), %ecx     # 0xa1490
leaq 0x74b96(%rip), %rdi     # 0x8bece
movb $0x0, %al
callq 0x101d0
movl $0x1, 0x8a19b(%rip)     # 0xa14e4
callq 0x17480
cmpl $0x0, -0x24(%rbp)
je 0x1741d
cmpl $0x0, -0x8(%rbp)
je 0x1736d
movq -0x18(%rbp), %rdi
callq 0x17570
movq %rax, -0x20(%rbp)
jmp 0x173e8
cmpl $0x1, 0x8a1b4(%rip)     # 0xa1528
jne 0x17399
movq -0x18(%rbp), %rdi
callq 0x17570
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
leaq 0x7500d(%rip), %rsi     # 0x8c39b
callq 0x1f930
movq %rax, -0x20(%rbp)
jmp 0x173e6
cmpl $0x0, 0x8a188(%rip)     # 0xa1528
jne 0x173b8
movq -0x18(%rbp), %rdi
leaq 0x76f3b(%rip), %rsi     # 0x8e2e8
callq 0x17780
movq %rax, -0x20(%rbp)
jmp 0x173e4
cmpl $0x2, 0x8a169(%rip)     # 0xa1528
jne 0x173e2
movq -0x18(%rbp), %rdi
callq 0x17a40
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
leaq 0x74fc2(%rip), %rsi     # 0x8c39b
callq 0x1f930
movq %rax, -0x20(%rbp)
jmp 0x173e4
jmp 0x173e6
jmp 0x173e8
movq -0x20(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rdi
callq 0x17c20
movq -0x48(%rbp), %rdi
movq %rax, %rsi
movq 0x87bb9(%rip), %rax     # 0x9efc0
movq (%rax), %rcx
movl $0x1, %edx
callq 0x10620
movq -0x20(%rbp), %rdi
callq 0x1ee80
movq -0x18(%rbp), %rdi
callq 0x1b290
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)