// File: /workspace/github_c_makefile_star2_O2/haxlang[P]hax/haxHash.c
// Function: ArrayCreate
static Hax_HashEntry *
ArrayCreate(
    Hax_Interp *interp,
    Hax_HashTable *tablePtr,	/* Table in which to lookup entry. */
    char *key,			/* Key to use to find or create matching
				 * entry. */
    int *newPtr			/* Store info here telling whether a new
				 * entry was created. */)
{
    Interp *iPtr = (Interp *) interp;
    Hax_Memoryp *memoryp = iPtr->memoryp;
    Hax_HashEntry *hPtr;
    int *arrayPtr = (int *) key;
    int *iPtr1, *iPtr2;
    int index, count;

    for (index = 0, count = tablePtr->keyType, iPtr1 = arrayPtr;
	    count > 0; count--, iPtr1++) {
	index += *iPtr1;
    }
    index = RANDOM_INDEX(tablePtr, index);

    /*
     * Search all of the entries in the appropriate bucket.
     */

    for (hPtr = tablePtr->buckets[index]; hPtr != NULL;
	    hPtr = hPtr->nextPtr) {
	for (iPtr1 = arrayPtr, iPtr2 = hPtr->key.words,
		count = tablePtr->keyType; ; count--, iPtr1++, iPtr2++) {
	    if (count == 0) {
		*newPtr = 0;
		return hPtr;
	    }
	    if (*iPtr1 != *iPtr2) {
		break;
	    }
	}
    }

    /*
     * Entry not found.  Add a new one to the bucket.
     */

    *newPtr = 1;
    hPtr = (Hax_HashEntry *) ckalloc(memoryp, (unsigned) (sizeof(Hax_HashEntry)
	    + (tablePtr->keyType*sizeof(int)) - 4));
    hPtr->tablePtr = tablePtr;
    hPtr->bucketPtr = &(tablePtr->buckets[index]);
    hPtr->nextPtr = *hPtr->bucketPtr;
    hPtr->clientData = 0;
    for (iPtr1 = arrayPtr, iPtr2 = hPtr->key.words, count = tablePtr->keyType;
	    count > 0; count--, iPtr1++, iPtr2++) {
	*iPtr2 = *iPtr1;
    }
    *hPtr->bucketPtr = hPtr;
    tablePtr->numEntries++;

    /*
     * If the table has exceeded a decent size, rebuild it with many
     * more buckets.
     */

    if (tablePtr->numEntries >= tablePtr->rebuildSize) {
	RebuildTable(interp, tablePtr);
    }
    return hPtr;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %rax
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movq 0x280(%rdi), %rdi
movl 0x3c(%rsi), %edx
xorl %ecx, %ecx
movq %r15, %rsi
movl %edx, %r8d
testl %r8d, %r8d
jle 0xca67
addl (%rsi), %ecx
decl %r8d
addq $0x4, %rsi
jmp 0xca57
movslq %ecx, %rcx
imulq $0x41c64e6d, %rcx, %rsi # imm = 0x41C64E6D
movb 0x34(%rbx), %cl
sarq %cl, %rsi
andl 0x38(%rbx), %esi
movslq %esi, %r13
leaq (,%r13,8), %r12
addq (%rbx), %r12
movq (%r12), %r12
testq %r12, %r12
je 0xcab7
xorl %ecx, %ecx
cmpl %ecx, %edx
je 0xcaa7
movl (%r15,%rcx,4), %esi
cmpl 0x20(%r12,%rcx,4), %esi
jne 0xca88
incq %rcx
jmp 0xca93
andl $0x0, (%rax)
movq %r12, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movl $0x1, (%rax)
movl 0x3c(%rbx), %eax
leal 0x24(,%rax,4), %esi
leaq 0x6990(%rip), %rdx      # 0x1345e
movl $0x312, %ecx            # imm = 0x312
callq 0x44e0
movq %rax, %r12
movq %rbx, 0x8(%rax)
movq (%rbx), %rax
leaq (%rax,%r13,8), %rax
movq %rax, 0x10(%r12)
movq (%rax), %rcx
movq %rcx, (%r12)
andq $0x0, 0x18(%r12)
movl 0x3c(%rbx), %ecx
pushq $0x20
popq %rdx
testl %ecx, %ecx
jle 0xcb13
movl -0x20(%r15,%rdx), %esi
movl %esi, (%r12,%rdx)
decl %ecx
addq $0x4, %rdx
jmp 0xcafe
movq %r12, (%rax)
movl 0x2c(%rbx), %eax
incl %eax
movl %eax, 0x2c(%rbx)
cmpl 0x30(%rbx), %eax
jl 0xcaaa
movq %r14, %rdi
movq %rbx, %rsi
callq 0xce07
jmp 0xcaaa