// File: /workspace/github_c_makefile_star2_O0/erikdubbelboer[P]discnt/src/counter.c
// Function: countersCleanupCron
void countersCleanupCron(void) {
    dictIterator *it;
    dictEntry *de;
    mstime_t notafter = mstime() - 2000; /* Don't delete counters that changed in the last N milliseconds. */

    it = dictGetSafeIterator(server.counters);
    while ((de = dictNext(it)) != NULL) {
        counter *cntr;
        listIter li;
        listNode *ln;

        cntr = dictGetVal(de);

        // Don't delete counters that might haven't synced yet.
        if (cntr->want_acks != NULL && dictSize(cntr->want_acks) > 0) {
            continue;
        }

        listRewind(cntr->shards, &li);
        while ((ln = listNext(&li)) != NULL) {
            shard *shrd = listNodeValue(ln);
            if (shrd->predict_time == 0 || shrd->predict_time > notafter) {
                continue;
            }
            if (shrd->value == 0 && shrd->predict_value == 0 && shrd->predict_change == 0) {
                if (shrd == cntr->myshard) {
                    cntr->myshard = NULL;
                }
                listDelNode(cntr->shards, ln);
            }
        }

        if (listLength(cntr->shards) == 0) {
            /* Don't delete counters that have subscribers as they keep
             * a pointer to the counter.
             */
            if (cntr->subscribers == NULL) {
                dictDelete(server.counters, cntr->name);
            }
        }
    }
    dictReleaseIterator(it);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
callq 0x18e20
subq $0x7d0, %rax            # imm = 0x7D0
movq %rax, -0x18(%rbp)
leaq 0x843ba(%rip), %rax     # 0xbf0e8
movq 0x618(%rax), %rdi
callq 0x17370
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x173a0
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x3ae85
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x3ad8c
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x28(%rax), %rax
movq -0x20(%rbp), %rcx
movq 0x40(%rcx), %rcx
addq 0x48(%rcx), %rax
cmpq $0x0, %rax
jbe 0x3ad8c
jmp 0x3ad3e
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x13000
leaq -0x30(%rbp), %rdi
callq 0x13060
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x3ae4a
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x3add9
movq -0x40(%rbp), %rax
movq 0x40(%rax), %rax
cmpq -0x18(%rbp), %rax
jle 0x3addb
jmp 0x3ad9d
movq -0x40(%rbp), %rax
fldt 0x30(%rax)
fldz
fxch %st(1)
fucompi %st(1), %st
fstp %st(0)
jne 0x3ae45
jp 0x3ae45
jmp 0x3adf0
movq -0x40(%rbp), %rax
fldt 0x50(%rax)
fldz
fxch %st(1)
fucompi %st(1), %st
fstp %st(0)
jne 0x3ae45
jp 0x3ae45
jmp 0x3ae05
movq -0x40(%rbp), %rax
fldt 0x60(%rax)
fldz
fxch %st(1)
fucompi %st(1), %st
fstp %st(0)
jne 0x3ae45
jp 0x3ae45
jmp 0x3ae1a
movq -0x40(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jne 0x3ae34
movq -0x20(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0x12ec0
jmp 0x3ad9d
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
cmpq $0x0, 0x28(%rax)
jne 0x3ae80
movq -0x20(%rbp), %rax
cmpq $0x0, 0x60(%rax)
jne 0x3ae7e
leaq 0x8427d(%rip), %rax     # 0xbf0e8
movq 0x618(%rax), %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rsi
callq 0x16b60
jmp 0x3ae80
jmp 0x3ad3e
movq -0x8(%rbp), %rdi
callq 0x17510
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop