// File: /workspace/github_cpp_makefile_star2_O2/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, %rbx
movq %rdi, %r14
movq %rsi, 0x10(%rsp)
testq %rsi, %rsi
jne 0x9d18
leaq 0x2a35(%rip), %rdi      # 0xc746
xorl %eax, %eax
callq 0x25ca
movl 0x14(%r14), %eax
cmpl 0x10(%r14), %eax
jl 0x9d3a
leaq 0x2a40(%rip), %rdi      # 0xc769
leaq 0x2a4a(%rip), %rsi      # 0xc77a
movl $0x103, %edx            # imm = 0x103
callq 0x258c
movq 0x10(%rsp), %rdi
callq 0x3a8c
movl %eax, %esi
testl %eax, %eax
movl %eax, 0x4(%rsp)
jns 0x9d6a
leaq 0x2a30(%rip), %rdi      # 0xc785
leaq 0x2a1e(%rip), %rsi      # 0xc77a
movl $0x105, %edx            # imm = 0x105
callq 0x258c
movl 0x4(%rsp), %esi
imull $0xd, %esi, %eax
movl 0x10(%r14), %edi
xorl %edx, %edx
divl %edi
movl %edx, %r12d
testl %edx, %edx
setns %al
cmpl %edi, %edx
setl %cl
testb %cl, %al
jne 0x9da6
leaq 0x29fd(%rip), %rdi      # 0xc78a
leaq 0x29e6(%rip), %rsi      # 0xc77a
movl $0x107, %edx            # imm = 0x107
callq 0x258c
movl 0x4(%rsp), %esi
movl 0x10(%r14), %edi
movq %rbx, 0x8(%rsp)
imull $0x11, %esi, %eax
leal -0x1(%rdi), %ecx
xorl %edx, %edx
divl %ecx
movl %edx, %r15d
orl $0x1, %r15d
testl %edx, %edx
setns %al
cmpl %edi, %r15d
setl %cl
testb %cl, %al
jne 0x9deb
leaq 0x29cc(%rip), %rdi      # 0xc79e
leaq 0x29a1(%rip), %rsi      # 0xc77a
movl $0x109, %edx            # imm = 0x109
callq 0x258c
movl 0x4(%rsp), %esi
movl 0x10(%r14), %edi
movq %r14, 0x20(%rsp)
movq 0x8(%r14), %r8
pushq $-0x1
popq %r9
movl %r9d, %ebp
movl %edi, %ebx
movq %rdi, 0x30(%rsp)
movl %r15d, 0x1c(%rsp)
movq %r8, 0x28(%rsp)
subl $0x1, %ebx
jb 0x9e76
movslq %r12d, %rax
imulq $0x18, %rax, %r14
movl 0xc(%r8,%r14), %eax
cmpl $-0x1, %eax
je 0x9e76
cmpl $-0x2, %eax
movl %r9d, %ecx
cmovel %r12d, %ecx
cmpl $-0x1, %ebp
cmovel %ecx, %ebp
cmpl %esi, %eax
jne 0x9e68
movq (%r8,%r14), %r13
movq %r13, %rdi
movq 0x10(%rsp), %rsi
movl %r9d, %r15d
callq 0x2350
movl %r15d, %r9d
movq 0x28(%rsp), %r8
movl 0x1c(%rsp), %r15d
movq 0x30(%rsp), %rdi
movl 0x4(%rsp), %esi
testl %eax, %eax
je 0x9f50
addl %r15d, %r12d
movl %r12d, %eax
cltd
idivl %edi
movl %edx, %r12d
jmp 0x9e0c
cmpl $-0x1, %ebp
cmovnel %ebp, %r12d
testl %r12d, %r12d
movq 0x20(%rsp), %r14
js 0x9e8c
cmpl %edi, %r12d
jl 0x9eac
leaq 0x291f(%rip), %rdi      # 0xc7b2
leaq 0x28e0(%rip), %rsi      # 0xc77a
movl $0x12b, %edx            # imm = 0x12B
callq 0x258c
movl 0x4(%rsp), %esi
movq 0x8(%r14), %r8
movslq %r12d, %rax
imulq $0x18, %rax, %rbx
cmpl $0x0, 0xc(%r8,%rbx)
js 0x9edb
leaq 0x2904(%rip), %rdi      # 0xc7c6
leaq 0x28b1(%rip), %rsi      # 0xc77a
movl $0x12c, %edx            # imm = 0x12C
callq 0x258c
movl 0x4(%rsp), %esi
movq 0x8(%r14), %r8
movl %esi, 0xc(%r8,%rbx)
movq 0x10(%rsp), %rdi
xorl %esi, %esi
callq 0x2704
movq 0x8(%r14), %rcx
movq %rax, (%rcx,%rbx)
movb $0x1, 0x8(%rcx,%rbx)
movq %rax, 0x20(%r14)
movq 0x8(%rsp), %rax
movq %rax, 0x10(%rcx,%rbx)
movq %rax, %rbx
movl 0x10(%r14), %eax
movl 0x14(%r14), %esi
incl %esi
movl %esi, 0x14(%r14)
imull $0x64, %esi, %ecx
imull $0x50, %eax, %edx
cmpl %edx, %ecx
jl 0x9f32
movq %r14, %rdi
callq 0xa6fc
movl 0x10(%r14), %eax
movl 0x14(%r14), %esi
cmpl %eax, %esi
jl 0x9f77
leaq 0x282c(%rip), %rdi      # 0xc769
leaq 0x2836(%rip), %rsi      # 0xc77a
movl $0x134, %edx            # imm = 0x134
callq 0x258c
jmp 0x9f77
movq 0x20(%rsp), %rbx
movq %r13, 0x20(%rbx)
movq 0x28(%rbx), %rax
testq %rax, %rax
je 0x9f6d
movq 0x10(%r8,%r14), %rdi
callq *%rax
movq 0x8(%rbx), %r8
movq 0x8(%rsp), %rbx
movq %rbx, 0x10(%r8,%r14)
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop