// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/hyperloglog.c
// Function: pfmergeCommand
void pfmergeCommand(client *c) {
    uint8_t max[HLL_REGISTERS];
    struct hllhdr *hdr;
    int j;

    /* Compute an HLL with M[i] = MAX(M[i]_j).
     * We we the maximum into the max array of registers. We'll write
     * it to the target variable later. */
    memset(max,0,sizeof(max));
    for (j = 1; j < c->argc; j++) {
        /* Check type and size. */
        robj *o = lookupKeyRead(c->db,c->argv[j]);
        if (o == NULL) continue; /* Assume empty HLL for non existing var. */
        if (isHLLObjectOrReply(c,o) != C_OK) return;

        /* Merge with this HLL with our 'max' HHL by setting max[i]
         * to MAX(max[i],hll[i]). */
        if (hllMerge(max,o) == C_ERR) {
            addReplySds(c,sdsnew(invalid_hll_err));
            return;
        }
    }

    /* Create / unshare the destination key's value if needed. */
    robj *o = lookupKeyWrite(c->db,c->argv[1]);
    if (o == NULL) {
        /* Create the key with a string value of the exact length to
         * hold our HLL data structure. sdsnewlen() when NULL is passed
         * is guaranteed to return bytes initialized to zero. */
        o = createHLLObject();
        dbAdd(c->db,c->argv[1],o);
    } else {
        /* If key exists we are sure it's of the right type/size
         * since we checked when merging the different HLLs, so we
         * don't check again. */
        o = dbUnshareStringValue(c->db,c->argv[1],o);
    }

    /* Only support dense objects as destination. */
    if (hllSparseToDense(o) == C_ERR) {
        addReplySds(c,sdsnew(invalid_hll_err));
        return;
    }

    /* Write the resulting HLL to the destination HLL registers and
     * invalidate the cached value. */
    hdr = o->ptr;
    for (j = 0; j < HLL_REGISTERS; j++) {
        HLL_DENSE_SET_REGISTER(hdr->registers,j,max[j]);
    }
    HLL_INVALIDATE_CACHE(hdr);

    signalModifiedKey(c->db,c->argv[1]);
    /* We generate an PFADD event for PFMERGE for semantical simplicity
     * since in theory this is a mass-add of elements. */
    notifyKeyspaceEvent(NOTIFY_STRING,"pfadd",c->argv[1],c->db->id);
    server.dirty++;
    addReply(c,shared.ok);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4070, %rsp           # imm = 0x4070
movq %rdi, -0x8(%rbp)
leaq -0x4010(%rbp), %rdi
xorl %esi, %esi
movl $0x4000, %edx           # imm = 0x4000
callq 0x26110
movl $0x1, -0x401c(%rbp)
movl -0x401c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x38(%rcx), %eax
jge 0xa0315
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x401c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x4a6c0
movq %rax, -0x4028(%rbp)
cmpq $0x0, -0x4028(%rbp)
jne 0xa02a2
jmp 0xa0301
movq -0x8(%rbp), %rdi
movq -0x4028(%rbp), %rsi
callq 0x9fb30
cmpl $0x0, %eax
je 0xa02bc
jmp 0xa05ad
leaq -0x4010(%rbp), %rdi
movq -0x4028(%rbp), %rsi
callq 0x9f790
cmpl $-0x1, %eax
jne 0xa02ff
movq -0x8(%rbp), %rax
movq %rax, -0x4060(%rbp)
movq 0xd742a(%rip), %rdi     # 0x177710
callq 0x38510
movq -0x4060(%rbp), %rdi
movq %rax, %rsi
callq 0x42e50
jmp 0xa05ad
jmp 0xa0301
movl -0x401c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x401c(%rbp)
jmp 0xa025c
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x4a6f0
movq %rax, -0x4030(%rbp)
cmpq $0x0, -0x4030(%rbp)
jne 0xa036d
callq 0x9fa20
movq %rax, -0x4030(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rsi
movq -0x4030(%rbp), %rdx
callq 0x4a7d0
jmp 0xa0394
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rsi
movq -0x4030(%rbp), %rdx
callq 0x4ad00
movq %rax, -0x4030(%rbp)
movq -0x4030(%rbp), %rdi
callq 0x9e3b0
cmpl $-0x1, %eax
jne 0xa03d0
movq -0x8(%rbp), %rax
movq %rax, -0x4068(%rbp)
movq 0xd7359(%rip), %rdi     # 0x177710
callq 0x38510
movq -0x4068(%rbp), %rdi
movq %rax, %rsi
callq 0x42e50
jmp 0xa05ad
movq -0x4030(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x4018(%rbp)
movl $0x0, -0x401c(%rbp)
cmpl $0x4000, -0x401c(%rbp)  # imm = 0x4000
jge 0xa0524
jmp 0xa03fe
movq -0x4018(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x4038(%rbp)
imull $0x6, -0x401c(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
cltq
movq %rax, -0x4040(%rbp)
imull $0x6, -0x401c(%rbp), %eax
andl $0x7, %eax
cltq
movq %rax, -0x4048(%rbp)
movl $0x8, %eax
subq -0x4048(%rbp), %rax
movq %rax, -0x4050(%rbp)
movslq -0x401c(%rbp), %rax
movzbl -0x4010(%rbp,%rax), %eax
movq %rax, -0x4058(%rbp)
movq -0x4048(%rbp), %rax
movl %eax, %ecx
movl $0x3f, %esi
shll %cl, %esi
xorl $-0x1, %esi
movq -0x4038(%rbp), %rax
movq -0x4040(%rbp), %rcx
movzbl (%rax,%rcx), %edx
andl %esi, %edx
movb %dl, (%rax,%rcx)
movq -0x4058(%rbp), %rsi
movq -0x4048(%rbp), %rcx
shlq %cl, %rsi
movq -0x4038(%rbp), %rax
movq -0x4040(%rbp), %rcx
movzbl (%rax,%rcx), %edx
orq %rsi, %rdx
movb %dl, (%rax,%rcx)
movq -0x4050(%rbp), %rax
movl %eax, %ecx
movl $0x3f, %esi
sarl %cl, %esi
xorl $-0x1, %esi
movq -0x4038(%rbp), %rax
movq -0x4040(%rbp), %rcx
movzbl 0x1(%rax,%rcx), %edx
andl %esi, %edx
movb %dl, 0x1(%rax,%rcx)
movq -0x4058(%rbp), %rsi
movq -0x4050(%rbp), %rcx
shrq %cl, %rsi
movq -0x4038(%rbp), %rax
movq -0x4040(%rbp), %rcx
movzbl 0x1(%rax,%rcx), %edx
orq %rsi, %rdx
movb %dl, 0x1(%rax,%rcx)
jmp 0xa0510
movl -0x401c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x401c(%rbp)
jmp 0xa03ec
movq -0x4018(%rbp), %rax
movzbl 0xf(%rax), %ecx
orl $0x80, %ecx
movb %cl, 0xf(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x4aa60
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rdx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x30(%rax), %ecx
movl $0x8, %edi
leaq 0x973c0(%rip), %rsi     # 0x137934
callq 0x9ce20
leaq 0xd7c58(%rip), %rax     # 0x1781d8
movq 0x720(%rax), %rcx
addq $0x1, %rcx
leaq 0xd7c46(%rip), %rax     # 0x1781d8
movq %rcx, 0x720(%rax)
movq -0x8(%rbp), %rdi
leaq 0xd869c(%rip), %rax     # 0x178c40
movq 0x8(%rax), %rsi
callq 0x42cc0
addq $0x4070, %rsp           # imm = 0x4070
popq %rbp
retq
nopw %cs:(%rax,%rax)