// File: /workspace/github_c_makefile_star2_O1/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
movl 0x3c(%rsi), %edx
xorl %esi, %esi
testl %edx, %edx
jle 0xdb4a
leal 0x1(%rdx), %ecx
movq %r15, %rdi
movslq (%rdi), %r8
movslq %esi, %rsi
addq %r8, %rsi
addq $0x4, %rdi
decl %ecx
cmpl $0x1, %ecx
jg 0xdb2f
imulq $0x41c64e6d, %rsi, %rsi # imm = 0x41C64E6D
movb 0x34(%rbx), %cl
sarq %cl, %rsi
movq 0x280(%r14), %rdi
andl 0x38(%rbx), %esi
movslq %esi, %r13
movq (%rbx), %rcx
movq (%rcx,%r13,8), %r12
testq %r12, %r12
je 0xdb96
movq %r12, %rcx
testq %rdx, %rdx
je 0xdc19
xorl %esi, %esi
movl (%r15,%rsi,4), %r8d
cmpl 0x20(%rcx,%rsi,4), %r8d
jne 0xdb8e
incq %rsi
cmpl %esi, %edx
jne 0xdb77
jmp 0xdc16
movq (%rcx), %rcx
testq %rcx, %rcx
jne 0xdb6c
movl $0x1, (%rax)
movl 0x3c(%rbx), %eax
leal 0x24(,%rax,4), %esi
leaq 0x78b1(%rip), %rdx      # 0x1545e
movl $0x312, %ecx            # imm = 0x312
callq 0x44c0
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)
movq $0x0, 0x18(%r12)
movl 0x3c(%rbx), %ecx
testl %ecx, %ecx
jle 0xdbf9
incl %ecx
xorl %edx, %edx
movl (%r15,%rdx), %esi
movl %esi, 0x20(%r12,%rdx)
decl %ecx
addq $0x4, %rdx
cmpl $0x1, %ecx
jg 0xdbe5
movq %r12, (%rax)
movl 0x2c(%rbx), %eax
incl %eax
movl %eax, 0x2c(%rbx)
cmpl 0x30(%rbx), %eax
jl 0xdc1f
movq %r14, %rdi
movq %rbx, %rsi
callq 0xdf32
jmp 0xdc1f
movq %rcx, %r12
movl $0x0, (%rax)
movq %r12, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq