// File: /workspace/github_c_makefile_star2_O0/haxlang[P]hax/haxHash.c
// Function: RebuildTable
static void
RebuildTable(
    Hax_Interp *interp,
    Hax_HashTable *tablePtr	/* Table to enlarge. */)
{
    Interp *iPtr = (Interp *) interp;
    Hax_Memoryp *memoryp = iPtr->memoryp;
    int oldSize, count, index;
    Hax_HashEntry **oldBuckets;
    Hax_HashEntry **oldChainPtr, **newChainPtr;
    Hax_HashEntry *hPtr;

    oldSize = tablePtr->numBuckets;
    oldBuckets = tablePtr->buckets;

    /*
     * Allocate and initialize the new bucket array, and set up
     * hashing constants for new array size.
     */

    tablePtr->numBuckets *= 4;
    tablePtr->buckets = (Hax_HashEntry **) ckalloc(memoryp, (unsigned)
	    (tablePtr->numBuckets * sizeof(Hax_HashEntry *)));
    for (count = tablePtr->numBuckets, newChainPtr = tablePtr->buckets;
	    count > 0; count--, newChainPtr++) {
	*newChainPtr = NULL;
    }
    tablePtr->rebuildSize *= 4;
    tablePtr->downShift -= 2;
    tablePtr->mask = (tablePtr->mask << 2) + 3;

    /*
     * Rehash all of the existing entries into the new bucket array.
     */

    for (oldChainPtr = oldBuckets; oldSize > 0; oldSize--, oldChainPtr++) {
	for (hPtr = *oldChainPtr; hPtr != NULL; hPtr = *oldChainPtr) {
	    *oldChainPtr = hPtr->nextPtr;
	    if (tablePtr->keyType == HAX_STRING_KEYS) {
		index = HashString(hPtr->key.string) & tablePtr->mask;
	    } else if (tablePtr->keyType == HAX_ONE_WORD_KEYS) {
		index = RANDOM_INDEX(tablePtr, hPtr->key.oneWordValue);
	    } else {
		int *iPtr;
		int count;

		for (index = 0, count = tablePtr->keyType,
			iPtr = hPtr->key.words; count > 0; count--, iPtr++) {
		    index += *iPtr;
		}
		index = RANDOM_INDEX(tablePtr, index);
	    }
	    hPtr->bucketPtr = &(tablePtr->buckets[index]);
	    hPtr->nextPtr = *hPtr->bucketPtr;
	    *hPtr->bucketPtr = hPtr;
	}
    }

    /*
     * Free up the old bucket array, if it was dynamically allocated.
     */

    if (oldBuckets != tablePtr->staticBuckets) {
	ckfree(memoryp, (char *) oldBuckets);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x280(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl 0x28(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movl 0x28(%rax), %ecx
shll $0x2, %ecx
movl %ecx, 0x28(%rax)
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq 0x28(%rax), %rax
shlq $0x3, %rax
movl %eax, %eax
movl %eax, %esi
leaq 0xa4bb(%rip), %rdx      # 0x1d41f
movl $0x38f, %ecx            # imm = 0x38F
callq 0x44c0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movl 0x28(%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
cmpl $0x0, -0x28(%rbp)
jle 0x12fb5
movq -0x48(%rbp), %rax
movq $0x0, (%rax)
movl -0x28(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x28(%rbp)
movq -0x48(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x48(%rbp)
jmp 0x12f8d
movq -0x10(%rbp), %rax
movl 0x30(%rax), %ecx
shll $0x2, %ecx
movl %ecx, 0x30(%rax)
movq -0x10(%rbp), %rax
movl 0x34(%rax), %ecx
subl $0x2, %ecx
movl %ecx, 0x34(%rax)
movq -0x10(%rbp), %rax
movl 0x38(%rax), %ecx
shll $0x2, %ecx
addl $0x3, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x38(%rax)
movq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpl $0x0, -0x24(%rbp)
jle 0x13144
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0x13128
movq -0x50(%rbp), %rax
movq (%rax), %rcx
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x3c(%rax)
jne 0x1303f
movq -0x50(%rbp), %rdi
addq $0x20, %rdi
callq 0x12eb0
movq -0x10(%rbp), %rcx
andl 0x38(%rcx), %eax
movl %eax, -0x2c(%rbp)
jmp 0x130dd
movq -0x10(%rbp), %rax
cmpl $0x1, 0x3c(%rax)
jne 0x13072
movq -0x50(%rbp), %rax
movq 0x20(%rax), %rax
imulq $0x41c64e6d, %rax, %rax # imm = 0x41C64E6D
movq -0x10(%rbp), %rcx
movl 0x34(%rcx), %ecx
sarq %cl, %rax
movq -0x10(%rbp), %rcx
movslq 0x38(%rcx), %rcx
andq %rcx, %rax
movl %eax, -0x2c(%rbp)
jmp 0x130db
movl $0x0, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movl 0x3c(%rax), %eax
movl %eax, -0x5c(%rbp)
movq -0x50(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x58(%rbp)
cmpl $0x0, -0x5c(%rbp)
jle 0x130b8
movq -0x58(%rbp), %rax
movl (%rax), %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x5c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x5c(%rbp)
movq -0x58(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x58(%rbp)
jmp 0x1308f
movslq -0x2c(%rbp), %rax
imulq $0x41c64e6d, %rax, %rax # imm = 0x41C64E6D
movq -0x10(%rbp), %rcx
movl 0x34(%rcx), %ecx
sarq %cl, %rax
movq -0x10(%rbp), %rcx
movslq 0x38(%rcx), %rcx
andq %rcx, %rax
movl %eax, -0x2c(%rbp)
jmp 0x130dd
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movslq -0x2c(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rcx
movq -0x50(%rbp), %rax
movq %rcx, (%rax)
movq -0x50(%rbp), %rcx
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
jmp 0x13000
jmp 0x1312a
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
movq -0x40(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x40(%rbp)
jmp 0x12feb
movq -0x38(%rbp), %rax
movq -0x10(%rbp), %rcx
addq $0x8, %rcx
cmpq %rcx, %rax
je 0x1316e
movq -0x20(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq 0xa2bb(%rip), %rdx      # 0x1d41f
movl $0x3b8, %ecx            # imm = 0x3B8
callq 0x4260
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop