// File: /workspace/github_c_makefile_star2_O1/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 0x45115(%rip), %rax     # 0x6f088
movq 0x618(%rax), %rdi
callq 0x19242
movq %rax, %r14
movq %rax, %rdi
callq 0x1929d
testq %rax, %rax
je 0x2a0cc
movq %rax, %r13
movq %rsp, %r15
leaq 0x18(%rsp), %r12
leaq 0x2bfbf(%rip), %rbp     # 0x55f64
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 0x29fec
movslq (%rbp,%rax,4), %rax
addq %rbp, %rax
jmpq *%rax
shrl $0x3, %edx
jmp 0x29fee
movq -0x11(%rsi), %rdx
jmp 0x29fee
movzwl -0x5(%rsi), %edx
jmp 0x29fee
movl -0x9(%rsi), %edx
jmp 0x29fee
movzbl -0x3(%rsi), %edx
jmp 0x29fee
xorl %edx, %edx
movq %r15, %rdi
callq 0x29f0f
movq 0x8(%r13), %r13
movq (%r13), %rsi
movzbl -0x1(%rsi), %edx
movl %edx, %eax
andl $0x7, %eax
cmpl $0x4, %eax
ja 0x2a038
leaq 0x2bf65(%rip), %rcx     # 0x55f78
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
shrl $0x3, %edx
jmp 0x2a03a
movq -0x11(%rsi), %rdx
jmp 0x2a03a
movzwl -0x5(%rsi), %edx
jmp 0x2a03a
movl -0x9(%rsi), %edx
jmp 0x2a03a
movzbl -0x3(%rsi), %edx
jmp 0x2a03a
xorl %edx, %edx
movq %r15, %rdi
callq 0x29f0f
leaq 0x50(%r13), %rsi
movl $0x8, %edx
movq %r15, %rdi
callq 0x29f0f
movq 0x8(%r13), %rdi
movq %r12, %rsi
callq 0x16c72
movq %r12, %rdi
callq 0x16c8f
testq %rax, %rax
je 0x2a0a8
movq 0x10(%rax), %r13
leaq 0x40(%r13), %rsi
movl $0x8, %edx
movq %r15, %rdi
callq 0x29f0f
leaq 0x50(%r13), %rsi
movl $0x10, %edx
movq %r15, %rdi
callq 0x29f0f
addq $0x60, %r13
movl $0x10, %edx
movq %r15, %rdi
movq %r13, %rsi
callq 0x29f0f
jmp 0x2a05f
movl $0x14, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x29eb8
movq %r14, %rdi
callq 0x1929d
movq %rax, %r13
testq %rax, %rax
jne 0x29fa5
movq %r14, %rdi
callq 0x1935a
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq