// File: /workspace/github_c_makefile_star2_O0/buf1024[P]mysch/dict.c
// Function: dict_get_randomKey
dict_entry *dict_get_randomKey(dict *d)
{
    dict_entry *he, *orighe;
    unsigned int h;
    int listlen, listele;

    if (dict_size(d) == 0)
        return NULL;
    if (dict_is_rehashing(d))
        _dict_rehash_step(d);
    if (dict_is_rehashing(d))
    {
        do
        {
            h = random() % (d->ht[0].size + d->ht[1].size);
            he = (h >= d->ht[0].size) ? d->ht[1].table[h - d->ht[0].size] :
                d->ht[0].table[h];
        }
        while (he == NULL);
    }
    else
    {
        do
        {
            h = random() & d->ht[0].sizemask;
            he = d->ht[0].table[h];
        }
        while (he == NULL);
    }

    /* Now we found a non empty bucket, but it is a linked
     * list and we need to get a random element from the list.
     * The only sane way to do so is counting the elements and
     * select a random index. */
    listlen = 0;
    orighe = he;
    while (he)
    {
        he = he->next;
        listlen++;
    }
    listele = random() % listlen;
    he = orighe;
    while (listele-- && he)
        he = he->next;
    return he;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x10(%rbp), %rcx
addq 0x40(%rcx), %rax
cmpq $0x0, %rax
jne 0x34df
movq $0x0, -0x8(%rbp)
jmp 0x3620
movq -0x10(%rbp), %rax
cmpl $-0x1, 0x48(%rax)
je 0x34f2
movq -0x10(%rbp), %rdi
callq 0x2bd0
movq -0x10(%rbp), %rax
cmpl $-0x1, 0x48(%rax)
je 0x356b
jmp 0x34fe
callq 0x2280
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x10(%rbp), %rdx
addq 0x30(%rdx), %rcx
xorl %edx, %edx
divq %rcx
movl %edx, %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jb 0x3547
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x24(%rbp), %ecx
movq -0x10(%rbp), %rdx
subq 0x10(%rdx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
jmp 0x355a
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x24(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x34fe
jmp 0x3599
jmp 0x356d
callq 0x2280
movq -0x10(%rbp), %rcx
andq 0x18(%rcx), %rax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x24(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x356d
jmp 0x3599
movl $0x0, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x35c6
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x18(%rbp)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x35a8
callq 0x2280
movslq -0x28(%rbp), %rcx
cqto
idivq %rcx
movl %edx, %eax
movl %eax, -0x2c(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x18(%rbp)
movl -0x2c(%rbp), %ecx
movl %ecx, %eax
addl $-0x1, %eax
movl %eax, -0x2c(%rbp)
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x39(%rbp)
je 0x3601
cmpq $0x0, -0x18(%rbp)
setne %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x360a
jmp 0x3618
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x35e1
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)