// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/t_zset.c
// Function: zuiFind
int zuiFind(zsetopsrc *op, zsetopval *val, double *score) {

    if (op->subject == NULL)
        return 0;

    // 集合
    if (op->type == REDIS_SET) {
        // 成员为整数，分值为 1.0
        if (op->encoding == REDIS_ENCODING_INTSET) {
            if (zuiLongLongFromValue(val) &&
                intsetFind(op->subject->ptr,val->ell))
            {
                *score = 1.0;
                return 1;
            } else {
                return 0;
            }

        // 成为为对象，分值为 1.0
        } else if (op->encoding == REDIS_ENCODING_HT) {
            dict *ht = op->subject->ptr;
            zuiObjectFromValue(val);
            if (dictFind(ht,val->ele) != NULL) {
                *score = 1.0;
                return 1;
            } else {
                return 0;
            }
        } else {
            redisPanic("Unknown set encoding");
        }

    // 有序集合
    } else if (op->type == REDIS_ZSET) {
        // 取出对象
        zuiObjectFromValue(val);

        // ziplist
        if (op->encoding == REDIS_ENCODING_ZIPLIST) {

            // 取出成员和分值
            if (zzlFind(op->subject->ptr,val->ele,score) != NULL) {
                /* Score is already set by zzlFind. */
                return 1;
            } else {
                return 0;
            }

        // SKIPLIST 编码
        } else if (op->encoding == REDIS_ENCODING_SKIPLIST) {
            zset *zs = op->subject->ptr;
            dictEntry *de;

            // 从字典中查找成员对象
            if ((de = dictFind(zs->dict,val->ele)) != NULL) {
                // 取出分值
                *score = *(double*)dictGetVal(de);
                return 1;
            } else {
                return 0;
            }
        } else {
            redisPanic("Unknown sorted set encoding");
        }
    } else {
        redisPanic("Unsupported type");
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x5213a
movl $0x0, -0x4(%rbp)
jmp 0x52327
movq -0x10(%rbp), %rax
cmpl $0x2, 0x8(%rax)
jne 0x5222b
movq -0x10(%rbp), %rax
cmpl $0x6, 0xc(%rax)
jne 0x521a8
movq -0x18(%rbp), %rdi
callq 0x51de0
cmpl $0x0, %eax
je 0x5219c
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rsi
callq 0x67990
movzbl %al, %eax
cmpl $0x0, %eax
je 0x5219c
movq -0x20(%rbp), %rax
movsd 0x8c04c(%rip), %xmm0    # 0xde1d8
movsd %xmm0, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x52327
movl $0x0, -0x4(%rbp)
jmp 0x52327
movq -0x10(%rbp), %rax
cmpl $0x2, 0xc(%rax)
jne 0x52209
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
callq 0x51f50
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rsi
callq 0x23aa0
cmpq $0x0, %rax
je 0x521fd
movq -0x20(%rbp), %rax
movsd 0x8bfeb(%rip), %xmm0    # 0xde1d8
movsd %xmm0, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x52327
movl $0x0, -0x4(%rbp)
jmp 0x52327
leaq 0x90954(%rip), %rdi     # 0xe2b64
leaq 0x91077(%rip), %rsi     # 0xe328e
movl $0xa20, %edx            # imm = 0xA20
callq 0x63d40
movl $0x1, %edi
callq 0x1f3b0
movq -0x10(%rbp), %rax
cmpl $0x3, 0x8(%rax)
jne 0x52305
movq -0x18(%rbp), %rdi
callq 0x51f50
movq -0x10(%rbp), %rax
cmpl $0x5, 0xc(%rax)
jne 0x52286
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rsi
movq -0x20(%rbp), %rdx
callq 0x4f990
cmpq $0x0, %rax
je 0x5227a
movl $0x1, -0x4(%rbp)
jmp 0x52327
movl $0x0, -0x4(%rbp)
jmp 0x52327
movq -0x10(%rbp), %rax
cmpl $0x7, 0xc(%rax)
jne 0x522e3
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rsi
callq 0x23aa0
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x522da
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movsd (%rax), %xmm0
movq -0x20(%rbp), %rax
movsd %xmm0, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x52327
movl $0x0, -0x4(%rbp)
jmp 0x52327
leaq 0x8f1b1(%rip), %rdi     # 0xe149b
leaq 0x90f9d(%rip), %rsi     # 0xe328e
movl $0xa41, %edx            # imm = 0xA41
callq 0x63d40
movl $0x1, %edi
callq 0x1f3b0
leaq 0x911c3(%rip), %rdi     # 0xe34cf
leaq 0x90f7b(%rip), %rsi     # 0xe328e
movl $0xa44, %edx            # imm = 0xA44
callq 0x63d40
movl $0x1, %edi
callq 0x1f3b0
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq