// File: 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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x10301
leaq 0x443c(%rip), %rdi      # 0x14736
movb $0x0, %al
callq 0x2640
movq -0x40(%rbp), %rcx
movl 0x14(%rcx), %eax
cmpl 0x10(%rcx), %eax
jge 0x1030f
jmp 0x10327
leaq 0x4443(%rip), %rdi      # 0x14759
leaq 0x444d(%rip), %rsi      # 0x1476a
movl $0x103, %edx            # imm = 0x103
callq 0x25e0
movq -0x18(%rbp), %rdi
callq 0x4a80
movl %eax, -0x30(%rbp)
xorl %eax, %eax
cmpl -0x30(%rbp), %eax
jg 0x1033c
jmp 0x10354
leaq 0x4432(%rip), %rdi      # 0x14775
leaq 0x4420(%rip), %rsi      # 0x1476a
movl $0x105, %edx            # imm = 0x105
callq 0x25e0
movq -0x40(%rbp), %rcx
imull $0xd, -0x30(%rbp), %eax
xorl %edx, %edx
divl 0x10(%rcx)
movl %edx, -0x24(%rbp)
xorl %eax, %eax
cmpl -0x24(%rbp), %eax
jg 0x10379
movq -0x40(%rbp), %rcx
movl -0x24(%rbp), %eax
cmpl 0x10(%rcx), %eax
jge 0x10379
jmp 0x10391
leaq 0x43fa(%rip), %rdi      # 0x1477a
leaq 0x43e3(%rip), %rsi      # 0x1476a
movl $0x107, %edx            # imm = 0x107
callq 0x25e0
movq -0x40(%rbp), %rcx
imull $0x11, -0x30(%rbp), %eax
movl 0x10(%rcx), %ecx
subl $0x1, %ecx
xorl %edx, %edx
divl %ecx
orl $0x1, %edx
movl %edx, -0x2c(%rbp)
movl $0x1, %eax
cmpl -0x2c(%rbp), %eax
jg 0x103c1
movq -0x40(%rbp), %rcx
movl -0x2c(%rbp), %eax
cmpl 0x10(%rcx), %eax
jge 0x103c1
jmp 0x103d9
leaq 0x43c6(%rip), %rdi      # 0x1478e
leaq 0x439b(%rip), %rsi      # 0x1476a
movl $0x109, %edx            # imm = 0x109
callq 0x25e0
movq -0x40(%rbp), %rax
movl $0xffffffff, -0x28(%rbp) # imm = 0xFFFFFFFF
movl 0x10(%rax), %eax
movl %eax, -0x34(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x34(%rbp)
movb %al, -0x41(%rbp)
je 0x10412
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpl $-0x1, 0xc(%rax)
setne %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0x1041e
jmp 0x1050b
cmpl $-0x1, -0x28(%rbp)
jne 0x10443
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpl $-0x2, 0xc(%rax)
jne 0x10443
movl -0x24(%rbp), %eax
movl %eax, -0x28(%rbp)
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
cmpl -0x30(%rbp), %eax
jne 0x104ec
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x2350
cmpl $0x0, %eax
jne 0x104ec
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rcx
movslq -0x24(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
movq %rcx, 0x20(%rax)
cmpq $0x0, 0x28(%rax)
je 0x104c4
movq -0x40(%rbp), %rcx
movq 0x28(%rcx), %rax
movq 0x8(%rcx), %rcx
movslq -0x24(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movq 0x10(%rcx), %rdi
callq *%rax
movq -0x40(%rbp), %rax
movq -0x20(%rbp), %rcx
movq 0x8(%rax), %rax
movslq -0x24(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x10643
movq -0x40(%rbp), %rcx
movl -0x24(%rbp), %eax
addl -0x2c(%rbp), %eax
cltd
idivl 0x10(%rcx)
movl %edx, -0x24(%rbp)
movl -0x34(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x103ea
cmpl $-0x1, -0x28(%rbp)
jne 0x10517
movl -0x24(%rbp), %eax
movl %eax, -0x28(%rbp)
xorl %eax, %eax
cmpl -0x28(%rbp), %eax
jg 0x1052c
movq -0x40(%rbp), %rcx
movl -0x28(%rbp), %eax
cmpl 0x10(%rcx), %eax
jge 0x1052c
jmp 0x10544
leaq 0x426f(%rip), %rdi      # 0x147a2
leaq 0x4230(%rip), %rsi      # 0x1476a
movl $0x12b, %edx            # imm = 0x12B
callq 0x25e0
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x28(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0xc(%rax)
jge 0x1055f
jmp 0x10577
leaq 0x4250(%rip), %rdi      # 0x147b6
leaq 0x41fd(%rip), %rsi      # 0x1476a
movl $0x12c, %edx            # imm = 0x12C
callq 0x25e0
movq -0x40(%rbp), %rax
movl -0x30(%rbp), %ecx
movq 0x8(%rax), %rax
movslq -0x28(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0xc(%rax)
movq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0x27b0
movq -0x40(%rbp), %rcx
movq %rax, %rdx
movq 0x8(%rcx), %rax
movslq -0x28(%rbp), %rsi
imulq $0x18, %rsi, %rsi
addq %rsi, %rax
movq %rdx, (%rax)
movq 0x8(%rcx), %rax
movslq -0x28(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movb $0x1, 0x8(%rax)
movq 0x8(%rcx), %rax
movslq -0x28(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq (%rax), %rax
movq %rax, 0x20(%rcx)
movq -0x20(%rbp), %rdx
movq 0x8(%rcx), %rax
movslq -0x28(%rbp), %rsi
imulq $0x18, %rsi, %rsi
addq %rsi, %rax
movq %rdx, 0x10(%rax)
movl 0x14(%rcx), %eax
addl $0x1, %eax
movl %eax, 0x14(%rcx)
imull $0x64, 0x14(%rcx), %eax
imull $0x50, 0x10(%rcx), %ecx
cmpl %ecx, %eax
jl 0x10615
movq -0x40(%rbp), %rdi
movl 0x14(%rdi), %esi
callq 0x116b0
movq -0x40(%rbp), %rcx
movl 0x14(%rcx), %eax
cmpl 0x10(%rcx), %eax
jge 0x10623
jmp 0x1063b
leaq 0x412f(%rip), %rdi      # 0x14759
leaq 0x4139(%rip), %rsi      # 0x1476a
movl $0x134, %edx            # imm = 0x134
callq 0x25e0
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)