// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/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 0xb1511(%rip), %rax     # 0x1072b0
movq 0x20(%rax), %rdx
movq %r14, %rsi
callq 0x44fbb
testq %rax, %rax
je 0x55f70
movq %rax, %r15
movq %rbx, %rdi
movq %rax, %rsi
movl $0x3, %edx
callq 0x441ab
testl %eax, %eax
jne 0x55f70
movl (%r15), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x7, %eax
je 0x55e5a
cmpl $0x5, %eax
jne 0x55fad
movb $0x1, %bpl
cmpl $0x3, 0x38(%rbx)
jl 0x55ef5
xorl %r13d, %r13d
movl $0x2, %ebp
movq %rsp, %r12
movq 0x8(%r15), %rdi
movq 0x40(%rbx), %rax
movq (%rax,%rbp,8), %rsi
xorl %edx, %edx
callq 0x54c26
testq %rax, %rax
je 0x55e49
incl %r13d
movq 0x8(%r15), %rdi
movq %rax, (%rsp)
movq %r12, %rsi
callq 0x3ebf5
movq %rax, %rdi
movq %r12, %rsi
callq 0x3ebf5
movq %rax, 0x8(%r15)
movq %rax, %rdi
callq 0x3ef20
cmpl $0x2, %eax
jb 0x55efa
incq %rbp
movslq 0x38(%rbx), %rax
cmpq %rax, %rbp
jl 0x55dfe
jmp 0x55ef0
movb $0x1, %bpl
cmpl $0x3, 0x38(%rbx)
jl 0x55ef5
movq 0x8(%r15), %r12
xorl %r13d, %r13d
movl $0x2, %r15d
movq (%r12), %rdi
movq 0x40(%rbx), %rax
movq (%rax,%r15,8), %rsi
callq 0x31cca
testq %rax, %rax
je 0x55ee4
movq 0x8(%rax), %rax
movsd (%rax), %xmm0
movq 0x8(%r12), %rdi
movq 0x40(%rbx), %rax
movq (%rax,%r15,8), %rsi
callq 0x5390c
testl %eax, %eax
je 0x55f7f
movq (%r12), %rdi
movq 0x40(%rbx), %rax
movq (%rax,%r15,8), %rsi
callq 0x31dba
movq (%r12), %rdi
callq 0x3343a
testl %eax, %eax
je 0x55ed3
movq (%r12), %rdi
callq 0x317b9
incl %r13d
movq (%r12), %rax
movq 0x28(%rax), %rcx
addq 0x48(%rax), %rcx
je 0x55efa
incq %r15
movslq 0x38(%rbx), %rax
cmpq %rax, %r15
jl 0x55e74
movb $0x1, %bpl
jmp 0x55f08
xorl %r13d, %r13d
jmp 0x55f08
movq 0x10(%rbx), %rdi
movq %r14, %rsi
callq 0x452f3
xorl %ebp, %ebp
movslq %r13d, %r15
testl %r13d, %r13d
je 0x55f65
movq 0x10(%rbx), %rax
movl 0x30(%rax), %ecx
leaq 0x6972f(%rip), %rsi     # 0xbf64d
movl $0x80, %edi
movq %r14, %rdx
callq 0x800c9
testb %bpl, %bpl
jne 0x55f4b
movq 0x10(%rbx), %rax
movl 0x30(%rax), %ecx
leaq 0x6b578(%rip), %rsi     # 0xc14b6
movl $0x4, %edi
movq %r14, %rdx
callq 0x800c9
movq 0x10(%rbx), %rdi
movq %r14, %rsi
callq 0x45220
leaq 0xb08fa(%rip), %rax     # 0x106858
addq %r15, 0x710(%rax)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x40606
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x40(%rbx), %rax
movq (%rax,%r15,8), %rsi
leaq 0x708fe(%rip), %rdx     # 0xc688c
leaq 0x706c1(%rip), %rcx     # 0xc6656
movq %rbx, %rdi
movl $0x5a5, %r8d            # imm = 0x5A5
callq 0x66380
movl $0x1, %edi
callq 0x263d0
leaq 0x6dcc2(%rip), %rdi     # 0xc3c76
leaq 0x7069b(%rip), %rsi     # 0xc6656
movl $0x5b2, %edx            # imm = 0x5B2
callq 0x6558d
jmp 0x55fa3