// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/dict.c
// Function: dictRehash
int dictRehash(dict *d, int n) {
    int empty_visits = n*10; /* Max number of empty buckets to visit. */
    if (!dictIsRehashing(d)) return 0;

    while(n-- && d->ht[0].used != 0) {
        dictEntry *de, *nextde;

        /* Note that rehashidx can't overflow as we are sure there are more
         * elements because ht[0].used != 0 */
        assert(d->ht[0].size > (unsigned long)d->rehashidx);
        while(d->ht[0].table[d->rehashidx] == NULL) {
            d->rehashidx++;
            if (--empty_visits == 0) return 1;
        }
        de = d->ht[0].table[d->rehashidx];
        /* Move all the keys in this bucket from the old to the new hash HT */
        while(de) {
            unsigned int h;

            nextde = de->next;
            /* Get the index in the new hash table */
            h = dictHashKey(d, de->key) & d->ht[1].sizemask;
            de->next = d->ht[1].table[h];
            d->ht[1].table[h] = de;
            d->ht[0].used--;
            d->ht[1].used++;
            de = nextde;
        }
        d->ht[0].table[d->rehashidx] = NULL;
        d->rehashidx++;
    }

    /* Check if we already rehashed the whole table... */
    if (d->ht[0].used == 0) {
        zfree(d->ht[0].table);
        d->ht[0] = d->ht[1];
        _dictReset(&d->ht[1]);
        d->rehashidx = -1;
        return 0;
    }

    /* More to rehash... */
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
imull $0xa, -0x14(%rbp), %eax
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpq $-0x1, 0x50(%rax)
jne 0x2d5dd
movl $0x0, -0x4(%rbp)
jmp 0x2d7ca
jmp 0x2d5df
movl -0x14(%rbp), %ecx
movl %ecx, %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x2d(%rbp)
je 0x2d603
movq -0x10(%rbp), %rax
cmpq $0x0, 0x28(%rax)
setne %al
movb %al, -0x2d(%rbp)
movb -0x2d(%rbp), %al
testb $0x1, %al
jne 0x2d60f
jmp 0x2d75d
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x50(%rcx), %rax
jbe 0x2d623
jmp 0x2d645
leaq 0x109baa(%rip), %rdi    # 0x1371d4
leaq 0x11c286(%rip), %rsi    # 0x1498b7
movl $0xfe, %edx
callq 0x76ce0
movl $0x1, %edi
callq 0x263c0
jmp 0x2d647
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x50(%rcx), %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0x2d68a
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x50(%rax)
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, %eax
jne 0x2d688
movl $0x1, -0x4(%rbp)
jmp 0x2d7ca
jmp 0x2d647
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x50(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x2d730
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rdi
callq *%rax
movl %eax, %eax
movq -0x10(%rbp), %rcx
andq 0x40(%rcx), %rax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x2c(%rbp), %ecx
movq (%rax,%rcx,8), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x2c(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x28(%rax)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x48(%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x2d6a2
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x50(%rcx), %rcx
movq $0x0, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x50(%rax)
jmp 0x2d5df
movq -0x10(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jne 0x2d7c3
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x3afa0
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x30(%rcx), %rdx
movq %rdx, 0x10(%rax)
movq 0x38(%rcx), %rdx
movq %rdx, 0x18(%rax)
movq 0x40(%rcx), %rdx
movq %rdx, 0x20(%rax)
movq 0x48(%rcx), %rcx
movq %rcx, 0x28(%rax)
movq -0x10(%rbp), %rdi
addq $0x10, %rdi
addq $0x20, %rdi
callq 0x2d7e0
movq -0x10(%rbp), %rax
movq $-0x1, 0x50(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x2d7ca
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)