// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq (%rdi), %rax
xorl %ebx, %ebx
testq %rax, %rax
je 0x3d1ee
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movl 0x8(%rdi), %ecx
cmpl $0x3, %ecx
je 0x3d160
cmpl $0x2, %ecx
jne 0x3d1fc
movl 0xc(%r12), %ecx
cmpl $0x2, %ecx
je 0x3d1c1
cmpl $0x6, %ecx
jne 0x3d226
movq %r15, %rdi
callq 0x3cfa6
testl %eax, %eax
je 0x3d1ee
movq (%r12), %rax
movq 0x8(%rax), %rdi
movq 0x40(%r15), %rsi
callq 0x4b5a5
testb %al, %al
jne 0x3d1de
jmp 0x3d1ee
movq %r15, %rdi
callq 0x3d034
movl 0xc(%r12), %eax
cmpl $0x7, %eax
je 0x3d199
cmpl $0x5, %eax
jne 0x3d211
movq (%r12), %rax
movq 0x8(%rax), %rdi
movq 0x28(%r15), %rsi
movq %r14, %rdx
callq 0x3b828
xorl %ebx, %ebx
testq %rax, %rax
setne %bl
jmp 0x3d1ee
movq (%r12), %rax
movq 0x8(%rax), %rax
movq (%rax), %rdi
movq 0x28(%r15), %rsi
callq 0x21b64
testq %rax, %rax
je 0x3d1ee
movq 0x8(%rax), %rax
movsd (%rax), %xmm0
movsd %xmm0, (%r14)
jmp 0x3d1eb
movq 0x8(%rax), %r12
movq %r15, %rdi
callq 0x3d034
movq 0x28(%r15), %rsi
movq %r12, %rdi
callq 0x21b64
testq %rax, %rax
je 0x3d1ee
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, (%r14)
pushq $0x1
popq %rbx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x52201(%rip), %rdi     # 0x8f404
leaq 0x51fb9(%rip), %rsi     # 0x8f1c3
movl $0xa44, %edx            # imm = 0xA44
jmp 0x3d239
leaq 0x5018f(%rip), %rdi     # 0x8d3a7
leaq 0x51fa4(%rip), %rsi     # 0x8f1c3
movl $0xa41, %edx            # imm = 0xA41
jmp 0x3d239
leaq 0x5188f(%rip), %rdi     # 0x8eabc
leaq 0x51f8f(%rip), %rsi     # 0x8f1c3
movl $0xa20, %edx            # imm = 0xA20
callq 0x490e8
pushq $0x1
popq %rdi
callq 0x1f3b0