// File: /workspace/github_c_makefile_star2_O0/srned[P]baselib/dict.c
// Function: dictRehash
int dictRehash(dict *d, int n) {
    if (!dictIsRehashing(d)) return 0;

    while(n--) {
        dictEntry *de, *nextde;

        /* 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;
        }

        /* 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)d->rehashidx);
        while(d->ht[0].table[d->rehashidx] == NULL) d->rehashidx++;
        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++;
    }
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
cmpl $-0x1, 0x50(%rax)
jne 0x7035
movl $0x0, -0x4(%rbp)
jmp 0x71e7
jmp 0x7037
movl -0x14(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x14(%rbp)
cmpl $0x0, %eax
je 0x71e0
movq -0x10(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jne 0x70b3
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x10fe0
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 0x71f0
movq -0x10(%rbp), %rax
movl $0xffffffff, 0x50(%rax) # imm = 0xFFFFFFFF
movl $0x0, -0x4(%rbp)
jmp 0x71e7
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rcx
movl 0x50(%rcx), %ecx
cmpq %rcx, %rax
jbe 0x70c9
jmp 0x70e8
leaq 0xb840(%rip), %rdi      # 0x12910
leaq 0xb860(%rip), %rsi      # 0x12937
movl $0xd8, %edx
leaq 0xb85b(%rip), %rcx      # 0x1293e
callq 0x4180
jmp 0x70ea
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x50(%rcx), %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0x7110
movq -0x10(%rbp), %rax
movl 0x50(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x50(%rax)
jmp 0x70ea
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x50(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x71b6
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 0x7128
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x50(%rcx), %rcx
movq $0x0, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movl 0x50(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x50(%rax)
jmp 0x7037
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq