// File: /workspace/github_c_makefile_star2_O3/richarddurbin[P]hash10x/hash.c
// Function: hashAdd
int hashAdd (HASH hx, HASHKEY k)
{
  TRUE_HASH *h = (TRUE_HASH*) hx ;
  long int hash, delta = 0 ;
  int test ;

  if (!h->guard)
    hashDouble (h) ;

  HASH_FUNC(k) ;
  while (TRUE)
    if (!h->keys[hash] || h->keys[hash] == REMOVED)	/* free slot to fill */
      { if (!h->keys[hash]) --h->guard ;
	h->keys[hash] = k.i ;
	if (h->nFree)
	  h->values[hash] = arr(h->freeList, h->nFree--, int) ;
	else
	  h->values[hash] = ++h->n  ;
	nAdded++ ;
	return h->values[hash] ;
      }
    else if (h->keys[hash] == k.i)		/* already there */
      { ++nFound ;
	return h->values[hash] ;
      }
    else
      { nBounced++ ;
	if (!delta) DELTA (k) ;
	hash = (hash + delta) & h->mask ;
      }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
cmpl $0x0, 0xc(%rdi)
jne 0x4997
movl (%rbx), %r13d
movl $0x1, %r12d
movl %r13d, %ecx
shll %cl, %r12d
leal 0x1(%r13), %ecx
movl $0x1, %eax
shll %cl, %eax
movl $0x1, %r15d
movl %ecx, (%rbx)
leal -0x1(%rax), %ecx
movl %ecx, 0x4(%rbx)
movl %r12d, 0xc(%rbx)
movq 0x10(%rbx), %rcx
movq %rcx, 0x8(%rsp)
movslq %eax, %rbp
shlq $0x2, %rbp
movq %rbp, %rdi
callq 0x5a3c
movq %rax, 0x10(%rbx)
movb (%rbx), %cl
movl $0x1, %edx
shll %cl, %edx
movslq %edx, %rdx
shlq $0x2, %rdx
movq %rax, %rdi
xorl %esi, %esi
callq 0x10d0
movq 0x18(%rbx), %rax
movq %rax, 0x10(%rsp)
movq %rbp, %rdi
callq 0x5a3c
movq %rax, 0x18(%rbx)
cmpl $0x1f, %r13d
je 0x4983
movq 0x6ab2(%rip), %rcx      # 0xb378
cmpl $0x2, %r12d
cmovgel %r12d, %r15d
movq 0x6a9b(%rip), %rdx      # 0xb370
xorl %esi, %esi
xorl %r8d, %r8d
movq 0x8(%rsp), %rdi
movl (%rdi), %r9d
cmpq $0x2, %r9
jb 0x4973
movl $0xfffffff4, %r11d      # imm = 0xFFFFFFF4
movl %r9d, %r12d
movq %r9, %r10
sarl $0x5, %r12d
xorq %r12, %r10
incl %r11d
jne 0x48f8
movl 0x4(%rbx), %r13d
movq 0x10(%rbx), %r11
andl %r13d, %r10d
cmpl $0x0, (%r11,%r10,4)
je 0x4955
testq %r8, %r8
jne 0x4938
movl $0xfffffff7, %ebp       # imm = 0xFFFFFFF7
movl %r9d, %r12d
movq %r9, %r8
sarl $0x7, %r12d
xorq %r12, %r8
incl %ebp
jne 0x4926
andl %r13d, %r8d
orq $0x1, %r8
incq %rdx
movl %r10d, %ebp
addl %r8d, %ebp
movl %r13d, %r10d
andl %ebp, %r10d
cmpl $0x0, (%r11,%r10,4)
jne 0x4916
movq %rdx, 0x6a1b(%rip)      # 0xb370
movl %r9d, (%r11,%r10,4)
movq 0x10(%rsp), %r9
movl (%r9,%rsi,4), %r9d
movl %r9d, (%rax,%r10,4)
decl 0xc(%rbx)
incq %rcx
movq %rcx, 0x6a05(%rip)      # 0xb378
incq %rsi
addq $0x4, %rdi
cmpq %r15, %rsi
jne 0x48df
movq 0x8(%rsp), %rdi
callq 0x1040
movq 0x10(%rsp), %rdi
callq 0x1040
movslq %r14d, %rax
movl $0xfffffff4, %edx       # imm = 0xFFFFFFF4
movl %r14d, %esi
movq %rax, %rcx
sarl $0x5, %esi
xorq %rsi, %rcx
incl %edx
jne 0x49a5
movl 0x4(%rbx), %esi
movq 0x10(%rbx), %rdx
andl %esi, %ecx
movl (%rdx,%rcx,4), %r10d
cmpl $0x2, %r10d
jae 0x49c7
movq %rcx, %r9
jmp 0x4a21
movq 0x69a2(%rip), %rdi      # 0xb370
xorl %r8d, %r8d
movslq %r10d, %r9
cmpq %r14, %r9
je 0x4a6a
incq %rdi
movq %rdi, 0x6989(%rip)      # 0xb370
testq %r8, %r8
jne 0x4a0b
movl $0xfffffff7, %r9d       # imm = 0xFFFFFFF7
movl %r14d, %r10d
movq %rax, %r8
sarl $0x7, %r10d
xorq %r10, %r8
incl %r9d
jne 0x49f8
andl %esi, %r8d
orq $0x1, %r8
addl %r8d, %ecx
movl %esi, %r9d
andl %ecx, %r9d
movl (%rdx,%r9,4), %r10d
movq %r9, %rcx
cmpl $0x2, %r10d
jae 0x49d1
testl %r10d, %r10d
jne 0x4a29
decl 0xc(%rbx)
movl %r14d, (%rdx,%r9,4)
movslq 0x28(%rbx), %rax
testq %rax, %rax
je 0x4a51
movq 0x20(%rbx), %rcx
movq 0x8(%rcx), %rdx
leal -0x1(%rax), %esi
movl %esi, 0x28(%rbx)
movslq 0x14(%rcx), %rcx
imulq %rax, %rcx
movl (%rdx,%rcx), %ecx
jmp 0x4a59
movl 0x8(%rbx), %ecx
incl %ecx
movl %ecx, 0x8(%rbx)
movq 0x18(%rbx), %rax
movl %ecx, (%rax,%r9,4)
incq 0x6910(%rip)            # 0xb378
jmp 0x4a78
incq 0x68ef(%rip)            # 0xb360
movq 0x18(%rbx), %rax
movq %rcx, %r9
movl (%rax,%r9,4), %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq