// File: /workspace/github_c_makefile_star2_O2/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 %rdi, %rbx
cmpl $0x0, 0xc(%rdi)
jne 0x4240
movq %rsi, 0x10(%rsp)
movl (%rbx), %ecx
pushq $0x1
popq %r15
movl %r15d, %r14d
shll %cl, %r14d
incl %ecx
movl %r15d, %eax
shll %cl, %eax
movl %ecx, (%rbx)
leal -0x1(%rax), %ecx
movl %ecx, 0x4(%rbx)
movl %r14d, 0xc(%rbx)
movq 0x10(%rbx), %rbp
movslq %eax, %r13
shlq $0x2, %r13
movq %r13, %rdi
callq 0x5258
movq %rax, 0x10(%rbx)
movb (%rbx), %cl
shll %cl, %r15d
movslq %r15d, %rdx
shlq $0x2, %rdx
xorl %r15d, %r15d
movq %rax, %rdi
xorl %esi, %esi
callq 0x10d0
movq 0x18(%rbx), %rax
movq %rax, (%rsp)
movq %r13, %rdi
callq 0x5258
movq %rax, 0x18(%rbx)
movq 0x71fb(%rip), %rcx      # 0xb370
movq 0x71fc(%rip), %rdx      # 0xb378
testl %r14d, %r14d
cmovlel %r15d, %r14d
pushq $-0x9
popq %r12
movq %rbp, 0x8(%rsp)
movq %rbp, %r8
xorl %r9d, %r9d
cmpq %r14, %r15
je 0x4228
movl (%r8), %ebp
cmpq $0x2, %rbp
jb 0x421c
pushq $-0xc
popq %rsi
movq %rbp, %r11
movl %ebp, %edi
testl %esi, %esi
je 0x41ba
sarl $0x5, %edi
xorq %rdi, %r11
incl %esi
jmp 0x41ac
movl 0x4(%rbx), %r13d
movq 0x10(%rbx), %rsi
andl %r13d, %r11d
cmpl $0x0, (%rsi,%r11,4)
je 0x41ff
incq %rcx
movq %rcx, 0x719a(%rip)      # 0xb370
testq %r9, %r9
jne 0x41fa
movl %r12d, %edi
movq %rbp, %r9
movl %ebp, %r10d
testl %edi, %edi
je 0x41f3
sarl $0x7, %r10d
xorq %r10, %r9
incl %edi
jmp 0x41e4
andl %r13d, %r9d
orq $0x1, %r9
addq %r9, %r11
jmp 0x41c2
movl %ebp, (%rsi,%r11,4)
movq (%rsp), %rsi
movl (%rsi,%r15,4), %esi
movl %esi, (%rax,%r11,4)
decl 0xc(%rbx)
incq %rdx
movq %rdx, 0x715c(%rip)      # 0xb378
incq %r15
addq $0x4, %r8
jmp 0x4192
movq 0x8(%rsp), %rdi
callq 0x1040
movq (%rsp), %rdi
callq 0x1040
movq 0x10(%rsp), %rsi
pushq $-0xc
popq %r8
pushq $-0x9
popq %rcx
movslq %esi, %rdx
movq %rdx, %rax
movl %esi, %edi
testl %r8d, %r8d
je 0x425f
sarl $0x5, %edi
xorq %rdi, %rax
incl %r8d
jmp 0x424f
movl 0x4(%rbx), %edi
movq 0x10(%rbx), %r14
movq 0x7103(%rip), %r8       # 0xb370
xorl %r9d, %r9d
andl %edi, %eax
movslq (%r14,%rax,4), %r10
cmpq $0x1, %r10
jbe 0x42b6
cmpq %rsi, %r10
je 0x42e6
incq %r8
movq %r8, 0x70e5(%rip)       # 0xb370
testq %r9, %r9
jne 0x42b1
movl %ecx, %r10d
movq %rdx, %r9
movl %esi, %r11d
testl %r10d, %r10d
je 0x42aa
sarl $0x7, %r11d
xorq %r11, %r9
incl %r10d
jmp 0x4299
andl %edi, %r9d
orq $0x1, %r9
addq %r9, %rax
jmp 0x4270
testl %r10d, %r10d
jne 0x42be
decl 0xc(%rbx)
movl %esi, (%r14,%rax,4)
movslq 0x28(%rbx), %rcx
testq %rcx, %rcx
je 0x42f3
movq 0x20(%rbx), %rdx
movq 0x8(%rdx), %rsi
leal -0x1(%rcx), %edi
movl %edi, 0x28(%rbx)
movslq 0x14(%rdx), %rdx
imulq %rcx, %rdx
movl (%rsi,%rdx), %ecx
jmp 0x42fb
incq 0x7073(%rip)            # 0xb360
movq 0x18(%rbx), %rdx
jmp 0x4309
movl 0x8(%rbx), %ecx
incl %ecx
movl %ecx, 0x8(%rbx)
movq 0x18(%rbx), %rdx
movl %ecx, (%rdx,%rax,4)
incq 0x706f(%rip)            # 0xb378
movl (%rdx,%rax,4), %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq