// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/src/t_zset.c
// Function: zremCommand
void zremCommand(client *c) {
    robj *key = c->argv[1];
    robj *zobj;
    int deleted = 0, keyremoved = 0, j;

    if ((zobj = lookupKeyWriteOrReply(c,key,shared.czero)) == NULL ||
        checkType(c,zobj,OBJ_ZSET)) return;

    if (zobj->encoding == OBJ_ENCODING_ZIPLIST) {
        unsigned char *eptr;

        for (j = 2; j < c->argc; j++) {
            if ((eptr = zzlFind(zobj->ptr,c->argv[j],NULL)) != NULL) {
                deleted++;
                zobj->ptr = zzlDelete(zobj->ptr,eptr);
                if (zzlLength(zobj->ptr) == 0) {
                    dbDelete(c->db,key);
                    keyremoved = 1;
                    break;
                }
            }
        }
    } else if (zobj->encoding == OBJ_ENCODING_SKIPLIST) {
        zset *zs = zobj->ptr;
        dictEntry *de;
        double score;

        for (j = 2; j < c->argc; j++) {
            de = dictFind(zs->dict,c->argv[j]);
            if (de != NULL) {
                deleted++;

                /* Delete from the skiplist */
                score = *(double*)dictGetVal(de);
                serverAssertWithInfo(c,c->argv[j],zslDelete(zs->zsl,score,c->argv[j]));

                /* Delete from the hash table */
                dictDelete(zs->dict,c->argv[j]);
                if (htNeedsResize(zs->dict)) dictResize(zs->dict);
                if (dictSize(zs->dict) == 0) {
                    dbDelete(c->db,key);
                    keyremoved = 1;
                    break;
                }
            }
        }
    } else {
        serverPanic("Unknown sorted set encoding");
    }

    if (deleted) {
        notifyKeyspaceEvent(NOTIFY_ZSET,"zrem",key,c->db->id);
        if (keyremoved)
            notifyKeyspaceEvent(NOTIFY_GENERIC,"del",key,c->db->id);
        signalModifiedKey(c->db,key);
        server.dirty += deleted;
    }
    addReplyLongLong(c,deleted);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x40(%rdi), %rax
movq 0x8(%rax), %r14
leaq 0xb07bd(%rip), %rax     # 0xfa310
movq 0x20(%rax), %rdx
movq %r14, %rsi
callq 0x3af15
testq %rax, %rax
je 0x49b79
movq %rax, %r15
pushq $0x3
popq %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3a311
testl %eax, %eax
je 0x49b88
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl (%r15), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x7, %eax
je 0x49bf3
cmpl $0x5, %eax
jne 0x49d2f
xorl %r12d, %r12d
pushq $0x2
popq %r13
movslq 0x38(%rbx), %rax
cmpq %rax, %r13
jge 0x49c7b
movq 0x8(%r15), %rdi
movq 0x40(%rbx), %rax
movq (%rax,%r13,8), %rsi
xorl %edx, %edx
callq 0x48cbf
testq %rax, %rax
je 0x49bee
incl %r12d
movq 0x8(%r15), %rdi
movq %rax, %rsi
callq 0x48d7e
movq %rax, 0x8(%r15)
movq %rax, %rdi
callq 0x486e9
testl %eax, %eax
je 0x49c80
incq %r13
jmp 0x49ba6
movq 0x8(%r15), %r13
xorl %r12d, %r12d
pushq $0x2
popq %r15
movslq 0x38(%rbx), %rax
cmpq %rax, %r15
jge 0x49c7b
movq (%r13), %rdi
movq 0x40(%rbx), %rax
movq (%rax,%r15,8), %rsi
callq 0x2a5f9
testq %rax, %rax
je 0x49c76
movq 0x8(%rax), %rax
movsd (%rax), %xmm0
movq 0x8(%r13), %rdi
movq 0x40(%rbx), %rax
movq (%rax,%r15,8), %rsi
callq 0x47c17
testl %eax, %eax
je 0x49d03
movq (%r13), %rdi
movq 0x40(%rbx), %rax
movq (%rax,%r15,8), %rsi
callq 0x2a6dc
movq (%r13), %rdi
callq 0x2bac1
testl %eax, %eax
je 0x49c65
movq (%r13), %rdi
callq 0x2a192
incl %r12d
movq (%r13), %rax
movq 0x28(%rax), %rcx
addq 0x48(%rax), %rcx
je 0x49c80
incq %r15
jmp 0x49bfe
movb $0x1, %bpl
jmp 0x49c8e
movq 0x10(%rbx), %rdi
movq %r14, %rsi
callq 0x3b1df
xorl %ebp, %ebp
testl %r12d, %r12d
je 0x49ceb
movq 0x10(%rbx), %rax
movl 0x30(%rax), %ecx
leaq 0x648ec(%rip), %rsi     # 0xae58d
movl $0x80, %edi
movq %r14, %rdx
callq 0x6fb58
testb %bpl, %bpl
jne 0x49ccc
movq 0x10(%rbx), %rax
movl 0x30(%rax), %ecx
leaq 0x66757(%rip), %rsi     # 0xb0418
pushq $0x4
popq %rdi
movq %r14, %rdx
callq 0x6fb58
movq 0x10(%rbx), %rdi
movq %r14, %rsi
callq 0x3b125
movslq %r12d, %rsi
leaq 0xafbc6(%rip), %rax     # 0xf98a8
addq %rsi, 0x720(%rax)
jmp 0x49ced
xorl %esi, %esi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x370a6
movq 0x40(%rbx), %rax
movq (%rax,%r15,8), %rsi
leaq 0x6b076(%rip), %rdx     # 0xb4d88
leaq 0x6ae39(%rip), %rcx     # 0xb4b52
movq %rbx, %rdi
movl $0x5a5, %r8d            # imm = 0x5A5
callq 0x588a4
pushq $0x1
popq %rdi
callq 0x263c0
leaq 0x68868(%rip), %rdi     # 0xb259e
leaq 0x6ae15(%rip), %rsi     # 0xb4b52
movl $0x5b2, %edx            # imm = 0x5B2
callq 0x57b45
jmp 0x49d27