// File: /workspace/github_cpp_makefile_star2_O3/gpertea[P]gclib/./GHash.hh
// Function: old::GHash<int>::fAdd(char const*, int*)
OBJ* GHash<OBJ>::fAdd(const char* ky, OBJ* pdata) {
	int p,i,x,h,n;
	if(!ky) GError("GHash::insert: NULL key argument.\n");
	GASSERT(fCount<fCapacity);
	h=GSTR_HASH(ky);
	GASSERT(0<=h);
	p=HASH1(h,fCapacity);
	GASSERT(0<=p && p<fCapacity);
	x=HASH2(h,fCapacity);
	GASSERT(1<=x && x<fCapacity);
	i=-1;
	n=fCapacity;
#ifdef HASH_DBG_PRINT
	int iterations=0;
	int init_p=p;
	int init_x=x;
#endif
	while(n && hash[p].hash!=-1) {
		if ((i==-1)&&(hash[p].hash==-2)) i=p;
		if (hash[p].hash==h && strcmp(hash[p].key,ky)==0) {
			//replace hash data for this key!
			lastkeyptr=hash[p].key;
			if (FREEDATA) (*fFreeProc)(hash[p].data);
			hash[p].data = (void*) pdata;
#ifdef HASH_DBG_PRINT
			GMessage("Add.R\t%s\t%d,%d,%d\t%d\t%d\t%d\n",
					ky, h,init_p,init_x, iterations,  fCount, fCapacity);
#endif
			return pdata;
		}
		p=(p+x)%fCapacity;
#ifdef HASH_DBG_PRINT
		++iterations;
#endif
		n--;
	}
	if(i==-1) i=p;
#ifdef HASH_DBG_PRINT
	GMessage("Add.N\t%s\t%d,%d,%d\t%d\t%d\t%d\n",
			ky, h,init_p,init_x, iterations,  fCount, fCapacity);
#endif
	GTRACE(("GHash::insert: key=\"%s\"\n",ky));
	//GMessage("GHash::insert: key=\"%s\"\n",ky);
	GASSERT(0<=i && i<fCapacity);
	GASSERT(hash[i].hash<0);
	hash[i].hash=h;
	hash[i].key=Gstrdup(ky);
	hash[i].keyalloc=true;
	lastkeyptr=hash[i].key;
	hash[i].data= (void*) pdata;
	fCount++;
	if((100*fCount)>=(MAX_LOAD*fCapacity)) Resize(fCount);
	GASSERT(fCount<fCapacity);
	return pdata;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r14
movq %rdi, %r15
movq %rsi, 0x10(%rsp)
testq %rsi, %rsi
jne 0xae9e
leaq 0x38ff(%rip), %rdi      # 0xe796
xorl %eax, %eax
callq 0x286c
movl 0x14(%r15), %eax
cmpl 0x10(%r15), %eax
jl 0xaec0
leaq 0x390a(%rip), %rdi      # 0xe7b9
leaq 0x3914(%rip), %rsi      # 0xe7ca
movl $0x103, %edx            # imm = 0x103
callq 0x282c
movq 0x10(%rsp), %rdi
callq 0x3d9c
movl %eax, %esi
testl %eax, %eax
movq %rsi, 0x8(%rsp)
jns 0xaef2
leaq 0x38f9(%rip), %rdi      # 0xe7d5
leaq 0x38e7(%rip), %rsi      # 0xe7ca
movl $0x105, %edx            # imm = 0x105
callq 0x282c
movq 0x8(%rsp), %rsi
leal (%rsi,%rsi,2), %eax
leal (%rsi,%rax,4), %eax
movl 0x10(%r15), %edi
xorl %edx, %edx
divl %edi
movl %edx, %ebp
testl %edx, %edx
setns %al
cmpl %edi, %edx
setl %cl
testb %cl, %al
jne 0xaf31
leaq 0x38c3(%rip), %rdi      # 0xe7da
leaq 0x38ac(%rip), %rsi      # 0xe7ca
movl $0x107, %edx            # imm = 0x107
callq 0x282c
movq 0x8(%rsp), %rsi
movl 0x10(%r15), %edi
movl %esi, %eax
shll $0x4, %eax
addl %esi, %eax
leal -0x1(%rdi), %ecx
xorl %edx, %edx
divl %ecx
movl %edx, %ecx
orl $0x1, %ecx
testl %edx, %edx
setns %al
movl %ecx, 0x1c(%rsp)
cmpl %edi, %ecx
setl %cl
testb %cl, %al
jne 0xaf77
leaq 0x3891(%rip), %rdi      # 0xe7ee
leaq 0x3866(%rip), %rsi      # 0xe7ca
movl $0x109, %edx            # imm = 0x109
callq 0x282c
movq 0x8(%rsp), %rsi
movl 0x10(%r15), %edi
testl %edi, %edi
je 0xb00e
movq %r14, 0x28(%rsp)
movq %r15, 0x20(%rsp)
movq 0x8(%r15), %r8
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movl %edi, %r15d
movq %rdi, 0x30(%rsp)
movslq %ebp, %rax
leaq (%rax,%rax,2), %rbx
movl 0xc(%r8,%rbx,8), %eax
cmpl $-0x1, %eax
je 0xaffc
cmpl $-0x2, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmovel %ebp, %ecx
cmpl $-0x1, %r12d
cmovel %ecx, %r12d
cmpl %esi, %eax
jne 0xafec
movq (%r8,%rbx,8), %r13
movq %r13, %rdi
movq 0x10(%rsp), %rsi
movq %r8, %r14
callq 0x2350
movq %r14, %r8
movq 0x30(%rsp), %rdi
movq 0x8(%rsp), %rsi
testl %eax, %eax
je 0xb0e5
addl 0x1c(%rsp), %ebp
movl %ebp, %eax
cltd
idivl %edi
movl %edx, %ebp
decl %r15d
jne 0xaf9b
cmpl $-0x1, %r12d
cmovnel %r12d, %ebp
movq 0x28(%rsp), %r14
movq 0x20(%rsp), %r15
testl %ebp, %ebp
setns %al
cmpl %edi, %ebp
setl %cl
testb %cl, %al
jne 0xb039
leaq 0x37df(%rip), %rdi      # 0xe802
leaq 0x37a0(%rip), %rsi      # 0xe7ca
movl $0x12b, %edx            # imm = 0x12B
callq 0x282c
movq 0x8(%rsp), %rsi
movq 0x8(%r15), %rax
movslq %ebp, %rbx
leaq (%rbx,%rbx,2), %rcx
cmpl $0x0, 0xc(%rax,%rcx,8)
js 0xb06c
leaq 0x37c4(%rip), %rdi      # 0xe816
leaq 0x3771(%rip), %rsi      # 0xe7ca
movl $0x12c, %edx            # imm = 0x12C
callq 0x282c
movq 0x8(%rsp), %rsi
movq 0x8(%r15), %rax
shlq $0x3, %rbx
leaq (%rbx,%rbx,2), %rbx
movl %esi, 0xc(%rax,%rbx)
movq 0x10(%rsp), %rdi
xorl %esi, %esi
callq 0x2906
movq 0x8(%r15), %rcx
movq %rax, (%rcx,%rbx)
movb $0x1, 0x8(%rcx,%rbx)
movq %rax, 0x20(%r15)
movq %r14, 0x10(%rcx,%rbx)
movl 0x10(%r15), %eax
movl 0x14(%r15), %esi
incl %esi
movl %esi, 0x14(%r15)
imull $0x64, %esi, %ecx
movl %eax, %edx
shll $0x4, %edx
leal (%rdx,%rdx,4), %edx
cmpl %edx, %ecx
jl 0xb0c7
movq %r15, %rdi
callq 0xb98a
movl 0x10(%r15), %eax
movl 0x14(%r15), %esi
cmpl %eax, %esi
jl 0xb10c
leaq 0x36e7(%rip), %rdi      # 0xe7b9
leaq 0x36f1(%rip), %rsi      # 0xe7ca
movl $0x134, %edx            # imm = 0x134
callq 0x282c
jmp 0xb10c
movq 0x20(%rsp), %r15
movq %r13, 0x20(%r15)
movq 0x28(%r15), %rax
testq %rax, %rax
je 0xb102
movq 0x10(%r8,%rbx,8), %rdi
callq *%rax
movq 0x8(%r15), %r8
movq 0x28(%rsp), %r14
movq %r14, 0x10(%r8,%rbx,8)
movq %r14, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq