// File: /workspace/github_cpp_makefile_star2_O1/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 0xb11e
leaq 0x35af(%rip), %rdi      # 0xe6c6
xorl %eax, %eax
callq 0x289c
movl 0x14(%r14), %eax
cmpl 0x10(%r14), %eax
jl 0xb140
leaq 0x35ba(%rip), %rdi      # 0xe6e9
leaq 0x35c4(%rip), %rsi      # 0xe6fa
movl $0x103, %edx            # imm = 0x103
callq 0x285c
movq 0x10(%rsp), %rdi
callq 0x3e1e
movl %eax, %edi
testl %eax, %eax
movq %rdi, 0x8(%rsp)
jns 0xb172
leaq 0x35a9(%rip), %rdi      # 0xe705
leaq 0x3597(%rip), %rsi      # 0xe6fa
movl $0x105, %edx            # imm = 0x105
callq 0x285c
movq 0x8(%rsp), %rdi
leal (%rdi,%rdi,2), %eax
leal (%rdi,%rax,4), %eax
movl 0x10(%r14), %ecx
xorl %edx, %edx
divl %ecx
movl %edx, %ebp
testl %edx, %edx
setns %al
cmpl %ecx, %edx
setl %cl
testb %cl, %al
jne 0xb1ad
leaq 0x3573(%rip), %rdi      # 0xe70a
leaq 0x355c(%rip), %rsi      # 0xe6fa
movl $0x107, %edx            # imm = 0x107
callq 0x285c
movq 0x8(%rsp), %rdi
movl %edi, %eax
shll $0x4, %eax
addl %edi, %eax
movl 0x10(%r14), %ecx
leal -0x1(%rcx), %esi
xorl %edx, %edx
divl %esi
movl %edx, %esi
orl $0x1, %esi
testl %edx, %edx
setns %al
movl %esi, 0x1c(%rsp)
cmpl %ecx, %esi
setl %cl
testb %cl, %al
jne 0xb1f3
leaq 0x3541(%rip), %rdi      # 0xe71e
leaq 0x3516(%rip), %rsi      # 0xe6fa
movl $0x109, %edx            # imm = 0x109
callq 0x285c
movq 0x8(%rsp), %rdi
movq %rbx, 0x28(%rsp)
movl 0x10(%r14), %r12d
testl %r12d, %r12d
movq %r14, 0x20(%rsp)
je 0xb27a
movq 0x8(%r14), %rsi
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl %r12d, %r15d
movq %rsi, 0x30(%rsp)
movslq %ebp, %rax
leaq (%rax,%rax,2), %rbx
movl 0xc(%rsi,%rbx,8), %eax
cmpl $-0x1, %eax
je 0xb280
cmpl $-0x2, %eax
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovel %ebp, %eax
cmpl $-0x1, %r14d
cmovel %eax, %r14d
cmpl %edi, 0xc(%rsi,%rbx,8)
jne 0xb267
leaq (%rsi,%rbx,8), %rax
movq (%rax), %r13
movq %r13, %rdi
movq 0x10(%rsp), %rsi
callq 0x2350
movq 0x30(%rsp), %rsi
movq 0x8(%rsp), %rdi
testl %eax, %eax
je 0xb369
addl 0x1c(%rsp), %ebp
movl %ebp, %eax
cltd
idivl %r12d
movl %edx, %ebp
decl %r15d
jne 0xb218
jmp 0xb280
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpl $-0x1, %r14d
cmovnel %r14d, %ebp
testl %ebp, %ebp
setns %al
cmpl %r12d, %ebp
setl %cl
testb %cl, %al
jne 0xb2b4
leaq 0x3494(%rip), %rdi      # 0xe732
leaq 0x3455(%rip), %rsi      # 0xe6fa
movl $0x12b, %edx            # imm = 0x12B
callq 0x285c
movq 0x8(%rsp), %rdi
movq 0x20(%rsp), %r14
movq 0x8(%r14), %rax
movslq %ebp, %rbx
leaq (%rbx,%rbx,2), %rcx
cmpl $0x0, 0xc(%rax,%rcx,8)
js 0xb2e8
leaq 0x3474(%rip), %rdi      # 0xe746
leaq 0x3421(%rip), %rsi      # 0xe6fa
movl $0x12c, %edx            # imm = 0x12C
callq 0x285c
movq 0x8(%rsp), %rdi
movq 0x8(%r14), %rax
shlq $0x3, %rbx
leaq (%rbx,%rbx,2), %rbx
movl %edi, 0xc(%rax,%rbx)
movq 0x10(%rsp), %rdi
xorl %esi, %esi
callq 0x2936
movq 0x8(%r14), %rcx
movq %rax, (%rcx,%rbx)
movb $0x1, 0x8(%rcx,%rbx)
movq %rax, 0x20(%r14)
movq 0x28(%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
shll $0x4, %eax
leal (%rax,%rax,4), %eax
cmpl %eax, %ecx
jl 0xb345
movq %r14, %rdi
callq 0xbba6
movl 0x14(%r14), %eax
cmpl 0x10(%r14), %eax
jl 0xb393
leaq 0x3393(%rip), %rdi      # 0xe6e9
leaq 0x339d(%rip), %rsi      # 0xe6fa
movl $0x134, %edx            # imm = 0x134
callq 0x285c
jmp 0xb393
movq 0x20(%rsp), %r14
movq %r13, 0x20(%r14)
movq 0x28(%r14), %rax
testq %rax, %rax
je 0xb382
movq 0x10(%rsi,%rbx,8), %rdi
callq *%rax
movq 0x8(%r14), %rax
movq 0x28(%rsp), %rcx
movq %rcx, 0x10(%rax,%rbx,8)
movq %rcx, %rbx
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop