// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/src/dict.c
// Function: dictGetRandomKeys
int dictGetRandomKeys(dict *d, dictEntry **des, int count) {
    int j; /* internal hash table id, 0 or 1. */
    int stored = 0;

    if (dictSize(d) < count) count = dictSize(d);
    while(stored < count) {
        for (j = 0; j < 2; j++) {
            /* Pick a random point inside the hash table 0 or 1. */
            unsigned int i = random() & d->ht[j].sizemask;
            int size = d->ht[j].size;

            /* Make sure to visit every bucket by iterating 'size' times. */
            while(size--) {
                dictEntry *he = d->ht[j].table[i];
                while (he) {
                    /* Collect all the elements of the buckets found non
                     * empty while iterating. */
                    *des = he;
                    des++;
                    he = he->next;
                    stored++;
                    if (stored == count) return stored;
                }
                i = (i+1) & d->ht[j].sizemask;
            }
            /* If there is only one table and we iterated it all, we should
             * already have 'count' elements. Assert this condition. */
            assert(dictIsRehashing(d) != 0);
        }
    }
    return stored; /* Never reached. */
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x10(%rbp), %rcx
addq 0x48(%rcx), %rax
movslq -0x1c(%rbp), %rcx
cmpq %rcx, %rax
jae 0x24626
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x10(%rbp), %rcx
addq 0x48(%rcx), %rax
movl %eax, -0x1c(%rbp)
jmp 0x24628
movl -0x24(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x2476d
movl $0x0, -0x20(%rbp)
cmpl $0x2, -0x20(%rbp)
jge 0x24768
callq 0x1f9d0
movq -0x10(%rbp), %rcx
addq $0x10, %rcx
movslq -0x20(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
andq 0x10(%rcx), %rax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
addq $0x10, %rax
movslq -0x20(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x2c(%rbp)
cmpl $0x0, %eax
je 0x2471f
movq -0x10(%rbp), %rax
addq $0x10, %rax
movslq -0x20(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rax
movl -0x28(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x246f8
movq -0x38(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x18(%rbp)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jne 0x246f6
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x24773
jmp 0x246b3
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movq -0x10(%rbp), %rcx
addq $0x10, %rcx
movslq -0x20(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
andq 0x10(%rcx), %rax
movl %eax, -0x28(%rbp)
jmp 0x2467e
movq -0x10(%rbp), %rax
cmpl $-0x1, 0x50(%rax)
setne %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x24736
jmp 0x24758
leaq 0xb9a7a(%rip), %rdi     # 0xde1b7
leaq 0xc5f9c(%rip), %rsi     # 0xea6e0
movl $0x478, %edx            # imm = 0x478
callq 0x63ca0
movl $0x1, %edi
callq 0x1f3b0
jmp 0x2475a
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x2463b
jmp 0x24628
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)