// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/debug.c
// Function: computeDatasetDigest
void computeDatasetDigest(unsigned char *final) {
    unsigned char digest[20];
    char buf[128];
    dictIterator *di = NULL;
    dictEntry *de;
    int j;
    uint32_t aux;

    memset(final,0,20); /* Start with a clean result */

    for (j = 0; j < server.dbnum; j++) {
        redisDb *db = server.db+j;

        if (dictSize(db->dict) == 0) continue;
        di = dictGetIterator(db->dict);

        /* hash the DB id, so the same dataset moved in a different
         * DB will lead to a different digest */
        aux = htonl(j);
        mixDigest(final,&aux,sizeof(aux));

        /* Iterate this DB writing every entry */
        while((de = dictNext(di)) != NULL) {
            sds key;
            robj *keyobj, *o;
            long long expiretime;

            memset(digest,0,20); /* This key-val digest */
            key = dictGetKey(de);
            keyobj = createStringObject(key,sdslen(key));

            mixDigest(digest,key,sdslen(key));

            o = dictGetVal(de);

            aux = htonl(o->type);
            mixDigest(digest,&aux,sizeof(aux));
            expiretime = getExpire(db,keyobj);

            /* Save the key and associated value */
            if (o->type == REDIS_STRING) {
                mixObjectDigest(digest,o);
            } else if (o->type == REDIS_LIST) {
                listTypeIterator *li = listTypeInitIterator(o,0,REDIS_TAIL);
                listTypeEntry entry;
                while(listTypeNext(li,&entry)) {
                    robj *eleobj = listTypeGet(&entry);
                    mixObjectDigest(digest,eleobj);
                    decrRefCount(eleobj);
                }
                listTypeReleaseIterator(li);
            } else if (o->type == REDIS_SET) {
                setTypeIterator *si = setTypeInitIterator(o);
                robj *ele;
                while((ele = setTypeNextObject(si)) != NULL) {
                    xorObjectDigest(digest,ele);
                    decrRefCount(ele);
                }
                setTypeReleaseIterator(si);
            } else if (o->type == REDIS_ZSET) {
                unsigned char eledigest[20];

                if (o->encoding == REDIS_ENCODING_ZIPLIST) {
                    unsigned char *zl = o->ptr;
                    unsigned char *eptr, *sptr;
                    unsigned char *vstr;
                    unsigned int vlen;
                    long long vll;
                    double score;

                    eptr = ziplistIndex(zl,0);
                    redisAssert(eptr != NULL);
                    sptr = ziplistNext(zl,eptr);
                    redisAssert(sptr != NULL);

                    while (eptr != NULL) {
                        redisAssert(ziplistGet(eptr,&vstr,&vlen,&vll));
                        score = zzlGetScore(sptr);

                        memset(eledigest,0,20);
                        if (vstr != NULL) {
                            mixDigest(eledigest,vstr,vlen);
                        } else {
                            ll2string(buf,sizeof(buf),vll);
                            mixDigest(eledigest,buf,strlen(buf));
                        }

                        snprintf(buf,sizeof(buf),"%.17g",score);
                        mixDigest(eledigest,buf,strlen(buf));
                        xorDigest(digest,eledigest,20);
                        zzlNext(zl,&eptr,&sptr);
                    }
                } else if (o->encoding == REDIS_ENCODING_SKIPLIST) {
                    zset *zs = o->ptr;
                    dictIterator *di = dictGetIterator(zs->dict);
                    dictEntry *de;

                    while((de = dictNext(di)) != NULL) {
                        robj *eleobj = dictGetKey(de);
                        double *score = dictGetVal(de);

                        snprintf(buf,sizeof(buf),"%.17g",*score);
                        memset(eledigest,0,20);
                        mixObjectDigest(eledigest,eleobj);
                        mixDigest(eledigest,buf,strlen(buf));
                        xorDigest(digest,eledigest,20);
                    }
                    dictReleaseIterator(di);
                } else {
                    redisPanic("Unknown sorted set encoding");
                }
            } else if (o->type == REDIS_HASH) {
                hashTypeIterator *hi;
                robj *obj;

                hi = hashTypeInitIterator(o);
                while (hashTypeNext(hi) != REDIS_ERR) {
                    unsigned char eledigest[20];

                    memset(eledigest,0,20);
                    obj = hashTypeCurrentObject(hi,REDIS_HASH_KEY);
                    mixObjectDigest(eledigest,obj);
                    decrRefCount(obj);
                    obj = hashTypeCurrentObject(hi,REDIS_HASH_VALUE);
                    mixObjectDigest(eledigest,obj);
                    decrRefCount(obj);
                    xorDigest(digest,eledigest,20);
                }
                hashTypeReleaseIterator(hi);
            } else {
                redisPanic("Unknown object type");
            }
            /* If the key has an expire, add it to the mix */
            if (expiretime != -1) xorDigest(digest,"!!expire!!",10);
            /* We can finally xor the key-val digest to the final digest */
            xorDigest(final,digest,20);
            decrRefCount(keyobj);
        }
        dictReleaseIterator(di);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x210, %rsp            # imm = 0x210
movq %rdi, -0x8(%rbp)
movq $0x0, -0xa8(%rbp)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
movl $0x14, %edx
callq 0x1f110
movl $0x0, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
leaq 0xb0437(%rip), %rcx     # 0x1138f8
cmpl 0x480(%rcx), %eax
jge 0x63c97
leaq 0xb0424(%rip), %rax     # 0x1138f8
movq 0x10(%rax), %rax
movslq -0xb4(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
movq (%rax), %rax
movq 0x28(%rax), %rax
movq -0xc0(%rbp), %rcx
movq (%rcx), %rcx
addq 0x48(%rcx), %rax
cmpq $0x0, %rax
jne 0x63514
jmp 0x63c83
movq -0xc0(%rbp), %rax
movq (%rax), %rdi
callq 0x241d0
movq %rax, -0xa8(%rbp)
movl -0xb4(%rbp), %edi
callq 0x1fab0
movl %eax, -0xb8(%rbp)
movq -0x8(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
movl $0x4, %edx
callq 0x633b0
movq -0xa8(%rbp), %rdi
callq 0x24270
movq %rax, -0xb0(%rbp)
cmpq $0x0, %rax
je 0x63c77
leaq -0x20(%rbp), %rdi
xorl %esi, %esi
movl $0x14, %edx
callq 0x1f110
movq -0xb0(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x1d8(%rbp)
movq -0xc8(%rbp), %rdi
callq 0x63260
movq -0x1d8(%rbp), %rdi
movq %rax, %rsi
callq 0x3a2e0
movq %rax, -0xd0(%rbp)
leaq -0x20(%rbp), %rax
movq %rax, -0x1d0(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x1c8(%rbp)
movq -0xc8(%rbp), %rdi
callq 0x63260
movq -0x1d0(%rbp), %rdi
movq -0x1c8(%rbp), %rsi
movq %rax, %rdx
callq 0x633b0
movq -0xb0(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rax
movl (%rax), %edi
andl $0xf, %edi
callq 0x1fab0
movl %eax, -0xb8(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
movl $0x4, %edx
callq 0x633b0
movq -0xc0(%rbp), %rdi
movq -0xd0(%rbp), %rsi
callq 0x3dce0
movq %rax, -0xe0(%rbp)
movq -0xd8(%rbp), %rax
movl (%rax), %eax
andl $0xf, %eax
cmpl $0x0, %eax
jne 0x63677
leaq -0x20(%rbp), %rdi
movq -0xd8(%rbp), %rsi
callq 0x63420
jmp 0x63c35
movq -0xd8(%rbp), %rax
movl (%rax), %eax
andl $0xf, %eax
cmpl $0x1, %eax
jne 0x636fe
movq -0xd8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %edx
callq 0x48180
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x48280
cmpl $0x0, %eax
je 0x636ed
leaq -0x100(%rbp), %rdi
callq 0x48410
movq %rax, -0x108(%rbp)
leaq -0x20(%rbp), %rdi
movq -0x108(%rbp), %rsi
callq 0x63420
movq -0x108(%rbp), %rdi
callq 0x3aaa0
jmp 0x636a4
movq -0xe8(%rbp), %rdi
callq 0x48260
jmp 0x63c33
movq -0xd8(%rbp), %rax
movl (%rax), %eax
andl $0xf, %eax
cmpl $0x2, %eax
jne 0x6376a
movq -0xd8(%rbp), %rdi
callq 0x4b1d0
movq %rax, -0x110(%rbp)
movq -0x110(%rbp), %rdi
callq 0x4b360
movq %rax, -0x118(%rbp)
cmpq $0x0, %rax
je 0x63759
leaq -0x20(%rbp), %rdi
movq -0x118(%rbp), %rsi
callq 0x63350
movq -0x118(%rbp), %rdi
callq 0x3aaa0
jmp 0x63722
movq -0x110(%rbp), %rdi
callq 0x4b280
jmp 0x63c31
movq -0xd8(%rbp), %rax
movl (%rax), %eax
andl $0xf, %eax
cmpl $0x3, %eax
jne 0x63b25
movq -0xd8(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x5, %eax
jne 0x639cb
movq -0xd8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x138(%rbp)
movq -0x138(%rbp), %rdi
xorl %esi, %esi
callq 0x32e50
movq %rax, -0x140(%rbp)
cmpq $0x0, -0x140(%rbp)
je 0x637ca
jmp 0x637ec
leaq 0x7fb46(%rip), %rdi     # 0xe3317
leaq 0x819e8(%rip), %rsi     # 0xe51c0
movl $0xb2, %edx
callq 0x63ca0
movl $0x1, %edi
callq 0x1f3b0
movq -0x138(%rbp), %rdi
movq -0x140(%rbp), %rsi
callq 0x33330
movq %rax, -0x148(%rbp)
cmpq $0x0, -0x148(%rbp)
je 0x63812
jmp 0x63834
leaq 0x7fdbb(%rip), %rdi     # 0xe35d4
leaq 0x819a0(%rip), %rsi     # 0xe51c0
movl $0xb4, %edx
callq 0x63ca0
movl $0x1, %edi
callq 0x1f3b0
jmp 0x63836
cmpq $0x0, -0x140(%rbp)
je 0x639c6
movq -0x140(%rbp), %rdi
leaq -0x150(%rbp), %rsi
leaq -0x154(%rbp), %rdx
leaq -0x160(%rbp), %rcx
callq 0x33490
cmpl $0x0, %eax
je 0x6386c
jmp 0x6388e
leaq 0x81372(%rip), %rdi     # 0xe4be5
leaq 0x81946(%rip), %rsi     # 0xe51c0
movl $0xb7, %edx
callq 0x63ca0
movl $0x1, %edi
callq 0x1f3b0
movq -0x148(%rbp), %rdi
callq 0x4ee80
movsd %xmm0, -0x168(%rbp)
leaq -0x130(%rbp), %rdi
xorl %esi, %esi
movl $0x14, %edx
callq 0x1f110
cmpq $0x0, -0x150(%rbp)
je 0x638dc
leaq -0x130(%rbp), %rdi
movq -0x150(%rbp), %rsi
movl -0x154(%rbp), %eax
movl %eax, %edx
callq 0x633b0
jmp 0x63932
leaq -0xa0(%rbp), %rdi
movq -0x160(%rbp), %rdx
movl $0x80, %esi
callq 0x39660
leaq -0x130(%rbp), %rax
movq %rax, -0x1e8(%rbp)
leaq -0xa0(%rbp), %rax
movq %rax, -0x1e0(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x1f4d0
movq -0x1e8(%rbp), %rdi
movq -0x1e0(%rbp), %rsi
movq %rax, %rdx
callq 0x633b0
leaq -0xa0(%rbp), %rdi
movsd -0x168(%rbp), %xmm0
movl $0x80, %esi
leaq 0x7d574(%rip), %rdx     # 0xe0ec1
movb $0x1, %al
callq 0x1f120
leaq -0x130(%rbp), %rax
movq %rax, -0x1f8(%rbp)
leaq -0xa0(%rbp), %rax
movq %rax, -0x1f0(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x1f4d0
movq -0x1f8(%rbp), %rdi
movq -0x1f0(%rbp), %rsi
movq %rax, %rdx
callq 0x633b0
leaq -0x20(%rbp), %rdi
leaq -0x130(%rbp), %rsi
movl $0x14, %edx
callq 0x632a0
movq -0x138(%rbp), %rdi
leaq -0x140(%rbp), %rsi
leaq -0x148(%rbp), %rdx
callq 0x4f100
jmp 0x63836
jmp 0x63b20
movq -0xd8(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x7, %eax
jne 0x63afc
movq -0xd8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x170(%rbp)
movq -0x170(%rbp), %rax
movq (%rax), %rdi
callq 0x241d0
movq %rax, -0x178(%rbp)
movq -0x178(%rbp), %rdi
callq 0x24270
movq %rax, -0x180(%rbp)
cmpq $0x0, %rax
je 0x63aee
movq -0x180(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x188(%rbp)
movq -0x180(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x190(%rbp)
leaq -0xa0(%rbp), %rdi
movq -0x190(%rbp), %rax
movsd (%rax), %xmm0
movl $0x80, %esi
leaq 0x7d458(%rip), %rdx     # 0xe0ec1
movb $0x1, %al
callq 0x1f120
leaq -0x130(%rbp), %rdi
xorl %esi, %esi
movl $0x14, %edx
callq 0x1f110
leaq -0x130(%rbp), %rdi
movq -0x188(%rbp), %rsi
callq 0x63420
leaq -0x130(%rbp), %rax
movq %rax, -0x208(%rbp)
leaq -0xa0(%rbp), %rax
movq %rax, -0x200(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x1f4d0
movq -0x208(%rbp), %rdi
movq -0x200(%rbp), %rsi
movq %rax, %rdx
callq 0x633b0
leaq -0x20(%rbp), %rdi
leaq -0x130(%rbp), %rsi
movl $0x14, %edx
callq 0x632a0
jmp 0x63a0b
movq -0x178(%rbp), %rdi
callq 0x243d0
jmp 0x63b1e
leaq 0x7d998(%rip), %rdi     # 0xe149b
leaq 0x816b6(%rip), %rsi     # 0xe51c0
movl $0xd8, %edx
callq 0x63d40
movl $0x1, %edi
callq 0x1f3b0
jmp 0x63b20
jmp 0x63c2f
movq -0xd8(%rbp), %rax
movl (%rax), %eax
andl $0xf, %eax
cmpl $0x4, %eax
jne 0x63c0b
movq -0xd8(%rbp), %rdi
callq 0x559a0
movq %rax, -0x198(%rbp)
movq -0x198(%rbp), %rdi
callq 0x55a90
cmpl $-0x1, %eax
je 0x63bfd
leaq -0x1c0(%rbp), %rdi
xorl %esi, %esi
movl $0x14, %edx
callq 0x1f110
movq -0x198(%rbp), %rdi
movl $0x1, %esi
callq 0x55d90
movq %rax, -0x1a0(%rbp)
leaq -0x1c0(%rbp), %rdi
movq -0x1a0(%rbp), %rsi
callq 0x63420
movq -0x1a0(%rbp), %rdi
callq 0x3aaa0
movq -0x198(%rbp), %rdi
movl $0x2, %esi
callq 0x55d90
movq %rax, -0x1a0(%rbp)
leaq -0x1c0(%rbp), %rdi
movq -0x1a0(%rbp), %rsi
callq 0x63420
movq -0x1a0(%rbp), %rdi
callq 0x3aaa0
leaq -0x20(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
movl $0x14, %edx
callq 0x632a0
jmp 0x63b4d
movq -0x198(%rbp), %rdi
callq 0x55a50
jmp 0x63c2d
leaq 0x7d8e9(%rip), %rdi     # 0xe14fb
leaq 0x815a7(%rip), %rsi     # 0xe51c0
movl $0xed, %edx
callq 0x63d40
movl $0x1, %edi
callq 0x1f3b0
jmp 0x63c2f
jmp 0x63c31
jmp 0x63c33
jmp 0x63c35
cmpq $-0x1, -0xe0(%rbp)
je 0x63c54
leaq -0x20(%rbp), %rdi
leaq 0x8157e(%rip), %rsi     # 0xe51c8
movl $0xa, %edx
callq 0x632a0
movq -0x8(%rbp), %rdi
leaq -0x20(%rbp), %rsi
movl $0x14, %edx
callq 0x632a0
movq -0xd0(%rbp), %rdi
callq 0x3aaa0
jmp 0x63550
movq -0xa8(%rbp), %rdi
callq 0x243d0
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x634b4
addq $0x210, %rsp            # imm = 0x210
popq %rbp
retq