// File: /workspace/github_c_makefile_star2_O3/erikdubbelboer[P]discnt/src/debug.c
// Function: computeDatasetDigest
void computeDatasetDigest(unsigned char *final) {
    unsigned char digest[20];
    dictIterator *di = NULL;
    dictEntry *de;

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

    di = dictGetIterator(server.counters);

    /* Iterate this DB writing every entry */
    while((de = dictNext(di)) != NULL) {
        counter* cntr;
        sds key;
        listNode *ln;
        listIter li;
        shard *shrd;

        memset(digest,0,20); /* This key-val digest */

        key = dictGetKey(de);
        mixDigest(digest,key,sdslen(key));

        cntr = dictGetVal(de);

        mixDigest(digest,cntr->name,sdslen(cntr->name));
        mixDigest(digest,&cntr->precision,sizeof(cntr->precision));

        listRewind(cntr->shards,&li);
        while ((ln = listNext(&li)) != NULL) {
            shrd = listNodeValue(ln);
            mixDigest(digest,&shrd->predict_time,sizeof(shrd->predict_time));
            mixDigest(digest,&shrd->predict_value,sizeof(shrd->predict_value));
            mixDigest(digest,&shrd->predict_change,sizeof(shrd->predict_change));
        }

        /* We can finally xor the key-val digest to the final digest */
        xorDigest(final,digest,20);
    }
    dictReleaseIterator(di);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movl $0x0, 0x10(%rdi)
leaq 0x456ad(%rip), %rax     # 0x6f088
movq 0x618(%rax), %rdi
callq 0x18e9d
movq %rax, %r14
movq %rax, %rdi
callq 0x18ef7
testq %rax, %rax
je 0x29b34
movq %rax, %r13
movq %rsp, %r15
leaq 0x18(%rsp), %r12
leaq 0x2c553(%rip), %rbp     # 0x55f60
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movl $0x0, 0x10(%rsp)
movq (%r13), %rsi
movzbl -0x1(%rsi), %edx
movl %edx, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x29a54
movslq (%rbp,%rax,4), %rax
addq %rbp, %rax
jmpq *%rax
shrl $0x3, %edx
jmp 0x29a56
movq -0x11(%rsi), %rdx
jmp 0x29a56
movzwl -0x5(%rsi), %edx
jmp 0x29a56
movl -0x9(%rsi), %edx
jmp 0x29a56
movzbl -0x3(%rsi), %edx
jmp 0x29a56
xorl %edx, %edx
movq %r15, %rdi
callq 0x29977
movq 0x8(%r13), %r13
movq (%r13), %rsi
movzbl -0x1(%rsi), %edx
movl %edx, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x29aa0
leaq 0x2c4f9(%rip), %rcx     # 0x55f74
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
shrl $0x3, %edx
jmp 0x29aa2
movq -0x11(%rsi), %rdx
jmp 0x29aa2
movzwl -0x5(%rsi), %edx
jmp 0x29aa2
movl -0x9(%rsi), %edx
jmp 0x29aa2
movzbl -0x3(%rsi), %edx
jmp 0x29aa2
xorl %edx, %edx
movq %r15, %rdi
callq 0x29977
leaq 0x50(%r13), %rsi
movl $0x8, %edx
movq %r15, %rdi
callq 0x29977
movq 0x8(%r13), %rdi
movq %r12, %rsi
callq 0x16717
movq %r12, %rdi
callq 0x16734
testq %rax, %rax
je 0x29b10
movq 0x10(%rax), %r13
leaq 0x40(%r13), %rsi
movl $0x8, %edx
movq %r15, %rdi
callq 0x29977
leaq 0x50(%r13), %rsi
movl $0x10, %edx
movq %r15, %rdi
callq 0x29977
addq $0x60, %r13
movl $0x10, %edx
movq %r15, %rdi
movq %r13, %rsi
callq 0x29977
jmp 0x29ac7
movl $0x14, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x29920
movq %r14, %rdi
callq 0x18ef7
movq %rax, %r13
testq %rax, %rax
jne 0x29a0d
movq %r14, %rdi
callq 0x18fbf
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq