// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/dict.c
// Function: dictGetSomeKeys
unsigned int dictGetSomeKeys(dict *d, dictEntry **des, unsigned int count) {
    unsigned long j; /* internal hash table id, 0 or 1. */
    unsigned long tables; /* 1 or 2 tables? */
    unsigned long stored = 0, maxsizemask;
    unsigned long maxsteps;

    if (dictSize(d) < count) count = dictSize(d);
    maxsteps = count*10;

    /* Try to do a rehashing work proportional to 'count'. */
    for (j = 0; j < count; j++) {
        if (dictIsRehashing(d))
            _dictRehashStep(d);
        else
            break;
    }

    tables = dictIsRehashing(d) ? 2 : 1;
    maxsizemask = d->ht[0].sizemask;
    if (tables > 1 && maxsizemask < d->ht[1].sizemask)
        maxsizemask = d->ht[1].sizemask;

    /* Pick a random point inside the larger table. */
    unsigned long i = random() & maxsizemask;
    unsigned long emptylen = 0; /* Continuous empty entries so far. */
    while(stored < count && maxsteps--) {
        for (j = 0; j < tables; j++) {
            /* Invariant of the dict.c rehashing: up to the indexes already
             * visited in ht[0] during the rehashing, there are no populated
             * buckets, so we can skip ht[0] for indexes between 0 and idx-1. */
            if (tables == 2 && j == 0 && i < (unsigned long) d->rehashidx) {
                /* Moreover, if we are currently out of range in the second
                 * table, there will be no elements in both tables up to
                 * the current rehashing index, so we jump if possible.
                 * (this happens when going from big to small table). */
                if (i >= d->ht[1].size) i = d->rehashidx;
                continue;
            }
            if (i >= d->ht[j].size) continue; /* Out of range for this table. */
            dictEntry *he = d->ht[j].table[i];

            /* Count contiguous empty buckets, and jump to other
             * locations if they reach 'count' (with a minimum of 5). */
            if (he == NULL) {
                emptylen++;
                if (emptylen >= 5 && emptylen > count) {
                    i = random() & maxsizemask;
                    emptylen = 0;
                }
            } else {
                emptylen = 0;
                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) & maxsizemask;
    }
    return stored;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x10(%rbp), %rcx
addq 0x48(%rcx), %rax
movl -0x1c(%rbp), %ecx
cmpq %rcx, %rax
jae 0x2e876
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x10(%rbp), %rcx
addq 0x48(%rcx), %rax
movl %eax, -0x1c(%rbp)
imull $0xa, -0x1c(%rbp), %eax
movl %eax, %eax
movq %rax, -0x48(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl -0x1c(%rbp), %ecx
cmpq %rcx, %rax
jae 0x2e8bc
movq -0x10(%rbp), %rax
cmpq $-0x1, 0x50(%rax)
je 0x2e8aa
movq -0x10(%rbp), %rdi
callq 0x2da70
jmp 0x2e8ac
jmp 0x2e8bc
jmp 0x2e8ae
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x2e888
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdx
movl $0x1, %eax
movl $0x2, %ecx
cmpq $-0x1, %rdx
cmovnel %ecx, %eax
cltq
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x1, -0x30(%rbp)
jbe 0x2e908
movq -0x40(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x40(%rcx), %rax
jae 0x2e908
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x40(%rbp)
callq 0x26a30
andq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x38(%rbp), %rcx
movl -0x1c(%rbp), %eax
movl %eax, %edx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x61(%rbp)
jae 0x2e949
movq -0x48(%rbp), %rax
movq %rax, %rcx
addq $-0x1, %rcx
movq %rcx, -0x48(%rbp)
cmpq $0x0, %rax
setne %al
movb %al, -0x61(%rbp)
movb -0x61(%rbp), %al
testb $0x1, %al
jne 0x2e955
jmp 0x2eaa6
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x2ea91
cmpq $0x2, -0x30(%rbp)
jne 0x2e9a6
cmpq $0x0, -0x28(%rbp)
jne 0x2e9a6
movq -0x50(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x50(%rcx), %rax
jae 0x2e9a6
movq -0x50(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x38(%rcx), %rax
jb 0x2e9a1
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x50(%rbp)
jmp 0x2ea80
movq -0x50(%rbp), %rax
movq -0x10(%rbp), %rcx
addq $0x10, %rcx
movq -0x28(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
cmpq 0x8(%rcx), %rax
jb 0x2e9c8
jmp 0x2ea80
movq -0x10(%rbp), %rax
addq $0x10, %rax
movq -0x28(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
jne 0x2ea27
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
cmpq $0x5, -0x58(%rbp)
jb 0x2ea25
movq -0x58(%rbp), %rax
movl -0x1c(%rbp), %ecx
cmpq %rcx, %rax
jbe 0x2ea25
callq 0x26a30
andq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
jmp 0x2ea7e
movq $0x0, -0x58(%rbp)
cmpq $0x0, -0x60(%rbp)
je 0x2ea7c
movq -0x60(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x18(%rbp)
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movl -0x1c(%rbp), %ecx
cmpq %rcx, %rax
jne 0x2ea7a
movq -0x38(%rbp), %rax
movl %eax, -0x4(%rbp)
jmp 0x2eaad
jmp 0x2ea2f
jmp 0x2ea7e
jmp 0x2ea80
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x2e95d
movq -0x50(%rbp), %rax
addq $0x1, %rax
andq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x2e91d
movq -0x38(%rbp), %rax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)