// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/hyperloglog.c
// Function: pfdebugCommand
void pfdebugCommand(client *c) {
    char *cmd = c->argv[1]->ptr;
    struct hllhdr *hdr;
    robj *o;
    int j;

    o = lookupKeyWrite(c->db,c->argv[2]);
    if (o == NULL) {
        addReplyError(c,"The specified key does not exist");
        return;
    }
    if (isHLLObjectOrReply(c,o) != C_OK) return;
    o = dbUnshareStringValue(c->db,c->argv[2],o);
    hdr = o->ptr;

    /* PFDEBUG GETREG <key> */
    if (!strcasecmp(cmd,"getreg")) {
        if (c->argc != 3) goto arityerr;

        if (hdr->encoding == HLL_SPARSE) {
            if (hllSparseToDense(o) == C_ERR) {
                addReplySds(c,sdsnew(invalid_hll_err));
                return;
            }
            server.dirty++; /* Force propagation on encoding change. */
        }

        hdr = o->ptr;
        addReplyMultiBulkLen(c,HLL_REGISTERS);
        for (j = 0; j < HLL_REGISTERS; j++) {
            uint8_t val;

            HLL_DENSE_GET_REGISTER(val,hdr->registers,j);
            addReplyLongLong(c,val);
        }
    }
    /* PFDEBUG DECODE <key> */
    else if (!strcasecmp(cmd,"decode")) {
        if (c->argc != 3) goto arityerr;

        uint8_t *p = o->ptr, *end = p+sdslen(o->ptr);
        sds decoded = sdsempty();

        if (hdr->encoding != HLL_SPARSE) {
            addReplyError(c,"HLL encoding is not sparse");
            return;
        }

        p += HLL_HDR_SIZE;
        while(p < end) {
            int runlen, regval;

            if (HLL_SPARSE_IS_ZERO(p)) {
                runlen = HLL_SPARSE_ZERO_LEN(p);
                p++;
                decoded = sdscatprintf(decoded,"z:%d ",runlen);
            } else if (HLL_SPARSE_IS_XZERO(p)) {
                runlen = HLL_SPARSE_XZERO_LEN(p);
                p += 2;
                decoded = sdscatprintf(decoded,"Z:%d ",runlen);
            } else {
                runlen = HLL_SPARSE_VAL_LEN(p);
                regval = HLL_SPARSE_VAL_VALUE(p);
                p++;
                decoded = sdscatprintf(decoded,"v:%d,%d ",regval,runlen);
            }
        }
        decoded = sdstrim(decoded," ");
        addReplyBulkCBuffer(c,decoded,sdslen(decoded));
        sdsfree(decoded);
    }
    /* PFDEBUG ENCODING <key> */
    else if (!strcasecmp(cmd,"encoding")) {
        char *encodingstr[2] = {"dense","sparse"};
        if (c->argc != 3) goto arityerr;

        addReplyStatus(c,encodingstr[hdr->encoding]);
    }
    /* PFDEBUG TODENSE <key> */
    else if (!strcasecmp(cmd,"todense")) {
        int conv = 0;
        if (c->argc != 3) goto arityerr;

        if (hdr->encoding == HLL_SPARSE) {
            if (hllSparseToDense(o) == C_ERR) {
                addReplySds(c,sdsnew(invalid_hll_err));
                return;
            }
            conv = 1;
            server.dirty++; /* Force propagation on encoding change. */
        }
        addReply(c,conv ? shared.cone : shared.czero);
    } else {
        addReplyErrorFormat(c,"Unknown PFDEBUG subcommand '%s'", cmd);
    }
    return;

arityerr:
    addReplyErrorFormat(c,
        "Wrong number of arguments for the '%s' subcommand",cmd);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rsi
callq 0x4a6f0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xa0b7c
movq -0x8(%rbp), %rdi
leaq 0xa6d8a(%rip), %rsi     # 0x1478fc
callq 0x42f90
jmp 0xa108a
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x9fb30
cmpl $0x0, %eax
je 0xa0b93
jmp 0xa108a
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rsi
movq -0x20(%rbp), %rdx
callq 0x4ad00
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
leaq 0xa6d52(%rip), %rsi     # 0x14791d
callq 0x26300
cmpl $0x0, %eax
jne 0xa0d1c
movq -0x8(%rbp), %rax
cmpl $0x3, 0x38(%rax)
je 0xa0be8
jmp 0xa1074
movq -0x18(%rbp), %rax
movzbl 0x4(%rax), %eax
cmpl $0x1, %eax
jne 0xa0c4e
movq -0x20(%rbp), %rdi
callq 0x9e3b0
cmpl $-0x1, %eax
jne 0xa0c2e
movq -0x8(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq 0xd6afb(%rip), %rdi     # 0x177710
callq 0x38510
movq -0xa0(%rbp), %rdi
movq %rax, %rsi
callq 0x42e50
jmp 0xa108a
leaq 0xd75a3(%rip), %rax     # 0x1781d8
movq 0x720(%rax), %rcx
addq $0x1, %rcx
leaq 0xd7591(%rip), %rax     # 0x1781d8
movq %rcx, 0x720(%rax)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl $0x4000, %esi           # imm = 0x4000
callq 0x437f0
movl $0x0, -0x24(%rbp)
cmpl $0x4000, -0x24(%rbp)    # imm = 0x4000
jge 0xa0d17
jmp 0xa0c7e
movq -0x18(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x30(%rbp)
imull $0x6, -0x24(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
cltq
movq %rax, -0x38(%rbp)
imull $0x6, -0x24(%rbp), %eax
andl $0x7, %eax
cltq
movq %rax, -0x40(%rbp)
movl $0x8, %eax
subq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
movq -0x38(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rax
movq -0x38(%rbp), %rcx
movzbl 0x1(%rax,%rcx), %eax
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rax
movq -0x40(%rbp), %rcx
shrq %cl, %rax
movq -0x58(%rbp), %rdx
movq -0x48(%rbp), %rcx
shlq %cl, %rdx
movq %rdx, %rcx
orq %rcx, %rax
andq $0x3f, %rax
movb %al, -0x25(%rbp)
movq -0x8(%rbp), %rdi
movzbl -0x25(%rbp), %eax
movl %eax, %esi
callq 0x43780
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xa0c6f
jmp 0xa1072
movq -0x10(%rbp), %rdi
leaq 0xa6bfd(%rip), %rsi     # 0x147924
callq 0x26300
cmpl $0x0, %eax
jne 0xa0f07
movq -0x8(%rbp), %rax
cmpl $0x3, 0x38(%rax)
je 0xa0d44
jmp 0xa1074
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x9e660
movq %rax, %rcx
movq -0xa8(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x68(%rbp)
callq 0x384f0
movq %rax, -0x70(%rbp)
movq -0x18(%rbp), %rax
movzbl 0x4(%rax), %eax
cmpl $0x1, %eax
je 0xa0da4
movq -0x8(%rbp), %rdi
leaq 0xa6b91(%rip), %rsi     # 0x14792b
callq 0x42f90
jmp 0xa108a
movq -0x60(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x68(%rbp), %rax
jae 0xa0eb0
movq -0x60(%rbp), %rax
movzbl (%rax), %eax
andl $0xc0, %eax
cmpl $0x0, %eax
jne 0xa0e09
movq -0x60(%rbp), %rax
movzbl (%rax), %eax
andl $0x3f, %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
movq -0x70(%rbp), %rdi
movl -0x74(%rbp), %edx
leaq 0xa6b4d(%rip), %rsi     # 0x147946
movb $0x0, %al
callq 0x395b0
movq %rax, -0x70(%rbp)
jmp 0xa0eab
movq -0x60(%rbp), %rax
movzbl (%rax), %eax
andl $0xc0, %eax
cmpl $0x40, %eax
jne 0xa0e5e
movq -0x60(%rbp), %rax
movzbl (%rax), %eax
andl $0x3f, %eax
shll $0x8, %eax
movq -0x60(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
orl %ecx, %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
movq -0x60(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x60(%rbp)
movq -0x70(%rbp), %rdi
movl -0x74(%rbp), %edx
leaq 0xa6afb(%rip), %rsi     # 0x14794c
movb $0x0, %al
callq 0x395b0
movq %rax, -0x70(%rbp)
jmp 0xa0ea9
movq -0x60(%rbp), %rax
movzbl (%rax), %eax
andl $0x3, %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
movq -0x60(%rbp), %rax
movzbl (%rax), %eax
sarl $0x2, %eax
andl $0x1f, %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
movq -0x70(%rbp), %rdi
movl -0x78(%rbp), %edx
movl -0x74(%rbp), %ecx
leaq 0xa6ab4(%rip), %rsi     # 0x147952
movb $0x0, %al
callq 0x395b0
movq %rax, -0x70(%rbp)
jmp 0xa0eab
jmp 0xa0db0
movq -0x70(%rbp), %rdi
leaq 0x9e28e(%rip), %rsi     # 0x13f149
callq 0x39c80
movq %rax, -0x70(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x70(%rbp), %rdi
callq 0x9e660
movq -0xb8(%rbp), %rdi
movq -0xb0(%rbp), %rsi
movq %rax, %rdx
callq 0x43920
movq -0x70(%rbp), %rdi
callq 0x38620
jmp 0xa1070
movq -0x10(%rbp), %rdi
leaq 0x9cab8(%rip), %rsi     # 0x13d9ca
callq 0x26300
cmpl $0x0, %eax
jne 0xa0f65
movq 0xcf8ad(%rip), %rax     # 0x1707d0
movq %rax, -0x90(%rbp)
movq 0xcf8a7(%rip), %rax     # 0x1707d8
movq %rax, -0x88(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x3, 0x38(%rax)
je 0xa0f47
jmp 0xa1074
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movzbl 0x4(%rax), %eax
movq -0x90(%rbp,%rax,8), %rsi
callq 0x43180
jmp 0xa106e
movq -0x10(%rbp), %rdi
leaq 0xa69eb(%rip), %rsi     # 0x14795b
callq 0x26300
cmpl $0x0, %eax
jne 0xa1056
movl $0x0, -0x94(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x3, 0x38(%rax)
je 0xa0f97
jmp 0xa1074
movq -0x18(%rbp), %rax
movzbl 0x4(%rax), %eax
cmpl $0x1, %eax
jne 0xa1007
movq -0x20(%rbp), %rdi
callq 0x9e3b0
cmpl $-0x1, %eax
jne 0xa0fdd
movq -0x8(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq 0xd674c(%rip), %rdi     # 0x177710
callq 0x38510
movq -0xc0(%rbp), %rdi
movq %rax, %rsi
callq 0x42e50
jmp 0xa108a
movl $0x1, -0x94(%rbp)
leaq 0xd71ea(%rip), %rax     # 0x1781d8
movq 0x720(%rax), %rcx
addq $0x1, %rcx
leaq 0xd71d8(%rip), %rax     # 0x1781d8
movq %rcx, 0x720(%rax)
movq -0x8(%rbp), %rax
movq %rax, -0xc8(%rbp)
cmpl $0x0, -0x94(%rbp)
je 0xa102f
leaq 0xd7c1e(%rip), %rax     # 0x178c40
movq 0x28(%rax), %rax
movq %rax, -0xd0(%rbp)
jmp 0xa1041
leaq 0xd7c0a(%rip), %rax     # 0x178c40
movq 0x20(%rax), %rax
movq %rax, -0xd0(%rbp)
movq -0xc8(%rbp), %rdi
movq -0xd0(%rbp), %rsi
callq 0x42cc0
jmp 0xa106c
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rdx
leaq 0xa68fe(%rip), %rsi     # 0x147963
movb $0x0, %al
callq 0x42fd0
jmp 0xa106e
jmp 0xa1070
jmp 0xa1072
jmp 0xa108a
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rdx
leaq 0xa6900(%rip), %rsi     # 0x147983
movb $0x0, %al
callq 0x42fd0
addq $0xd0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)