// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/redis-cli.c
// Function: cliFormatReplyTTY
static sds cliFormatReplyTTY(redisReply *r, char *prefix) {
    sds out = sdsempty();
    switch (r->type) {
    case REDIS_REPLY_ERROR:
        out = sdscatprintf(out,"(error) %s\n", r->str);
    break;
    case REDIS_REPLY_STATUS:
        out = sdscat(out,r->str);
        out = sdscat(out,"\n");
    break;
    case REDIS_REPLY_INTEGER:
        out = sdscatprintf(out,"(integer) %lld\n",r->integer);
    break;
    case REDIS_REPLY_STRING:
        /* If you are producing output for the standard output we want
        * a more interesting output with quoted characters and so forth */
        out = sdscatrepr(out,r->str,r->len);
        out = sdscat(out,"\n");
    break;
    case REDIS_REPLY_NIL:
        out = sdscat(out,"(nil)\n");
    break;
    case REDIS_REPLY_ARRAY:
        if (r->elements == 0) {
            out = sdscat(out,"(empty list or set)\n");
        } else {
            unsigned int i, idxlen = 0;
            char _prefixlen[16];
            char _prefixfmt[16];
            sds _prefix;
            sds tmp;

            /* Calculate chars needed to represent the largest index */
            i = r->elements;
            do {
                idxlen++;
                i /= 10;
            } while(i);

            /* Prefix for nested multi bulks should grow with idxlen+2 spaces */
            memset(_prefixlen,' ',idxlen+2);
            _prefixlen[idxlen+2] = '\0';
            _prefix = sdscat(sdsnew(prefix),_prefixlen);

            /* Setup prefix format for every entry */
            snprintf(_prefixfmt,sizeof(_prefixfmt),"%%s%%%ud) ",idxlen);

            for (i = 0; i < r->elements; i++) {
                /* Don't use the prefix for the first element, as the parent
                 * caller already prepended the index number. */
                out = sdscatprintf(out,_prefixfmt,i == 0 ? "" : prefix,i+1);

                /* Format the multi bulk entry */
                tmp = cliFormatReplyTTY(r->element[i],_prefix);
                out = sdscatlen(out,tmp,sdslen(tmp));
                sdsfree(tmp);
            }
            sdsfree(_prefix);
        }
    break;
    default:
        fprintf(stderr,"Unknown reply type: %d\n", r->type);
        exit(1);
    }
    return out;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
callq 0x1ed50
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x58(%rbp)
subl $0x5, %eax
ja 0x17a01
movq -0x58(%rbp), %rax
leaq 0x6fa7e(%rip), %rcx     # 0x8723c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdx
leaq 0x74759(%rip), %rsi     # 0x8bf33
movb $0x0, %al
callq 0x1fe10
movq %rax, -0x18(%rbp)
jmp 0x17a29
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x1f930
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x74b91(%rip), %rsi     # 0x8c39b
callq 0x1f930
movq %rax, -0x18(%rbp)
jmp 0x17a29
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x74714(%rip), %rsi     # 0x8bf3f
movb $0x0, %al
callq 0x1fe10
movq %rax, -0x18(%rbp)
jmp 0x17a29
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x8(%rbp), %rax
movslq 0x10(%rax), %rdx
callq 0x20b20
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x74b38(%rip), %rsi     # 0x8c39b
callq 0x1f930
movq %rax, -0x18(%rbp)
jmp 0x17a29
movq -0x18(%rbp), %rdi
leaq 0x746d3(%rip), %rsi     # 0x8bf4f
callq 0x1f930
movq %rax, -0x18(%rbp)
jmp 0x17a29
movq -0x8(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x178ae
movq -0x18(%rbp), %rdi
leaq 0x746b6(%rip), %rsi     # 0x8bf56
callq 0x1f930
movq %rax, -0x18(%rbp)
jmp 0x179ff
movl $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movl %eax, -0x1c(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
movl $0xa, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x178c0
leaq -0x30(%rbp), %rdi
movl -0x20(%rbp), %eax
addl $0x2, %eax
movl %eax, %eax
movl %eax, %edx
movl $0x20, %esi
callq 0x10250
movl -0x20(%rbp), %eax
addl $0x2, %eax
movl %eax, %eax
movb $0x0, -0x30(%rbp,%rax)
movq -0x10(%rbp), %rdi
callq 0x1ed70
movq %rax, %rdi
leaq -0x30(%rbp), %rsi
callq 0x1f930
movq %rax, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
movl -0x20(%rbp), %ecx
movl $0x10, %esi
leaq 0x7463c(%rip), %rdx     # 0x8bf6b
movb $0x0, %al
callq 0x101e0
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jae 0x179f6
movq -0x18(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq -0x40(%rbp), %rax
movq %rax, -0x60(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x17971
leaq 0x7697d(%rip), %rax     # 0x8e2e8
movq %rax, -0x70(%rbp)
jmp 0x17979
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x60(%rbp), %rsi
movq -0x68(%rbp), %rdi
movq -0x70(%rbp), %rdx
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movb $0x0, %al
callq 0x1fe10
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rdi
movq -0x48(%rbp), %rsi
callq 0x17780
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x50(%rbp), %rdi
callq 0x17c20
movq -0x80(%rbp), %rdi
movq -0x78(%rbp), %rsi
movq %rax, %rdx
callq 0x1f8a0
movq %rax, -0x18(%rbp)
movq -0x50(%rbp), %rdi
callq 0x1ee80
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1793d
movq -0x48(%rbp), %rdi
callq 0x1ee80
jmp 0x17a29
movq 0x875e8(%rip), %rax     # 0x9eff0
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movl (%rax), %edx
leaq 0x74503(%rip), %rsi     # 0x8bf1b
movb $0x0, %al
callq 0x10360
movl $0x1, %edi
callq 0x10600
movq -0x18(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)