// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3HashInsert
SQLITE_PRIVATE void *sqlite3HashInsert(Hash *pH, const char *pKey, void *data){
  unsigned int h;       /* the hash of the key modulo hash table size */
  HashElem *elem;       /* Used to loop thru the element list */
  HashElem *new_elem;   /* New element added to the pH */

  assert( pH!=0 );
  assert( pKey!=0 );
  elem = findElementWithHash(pH,pKey,&h);
  if( elem->data ){
    void *old_data = elem->data;
    if( data==0 ){
      removeElementGivenHash(pH,elem,h);
    }else{
      elem->data = data;
      elem->pKey = pKey;
    }
    return old_data;
  }
  if( data==0 ) return 0;
  new_elem = (HashElem*)sqlite3Malloc( sizeof(HashElem) );
  if( new_elem==0 ) return data;
  new_elem->pKey = pKey;
  new_elem->data = data;
  pH->count++;
  if( pH->count>=10 && pH->count > 2*pH->htsize ){
    if( rehash(pH, pH->count*2) ){
      assert( pH->htsize>0 );
      h = strHash(pKey) % pH->htsize;
    }
  }
  insertElement(pH, pH->ht ? &pH->ht[h] : 0, new_elem);
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x4(%rsp), %rdx
callq 0x2aefdf
movq 0x10(%rax), %r15
testq %r15, %r15
je 0x2aedd8
testq %r12, %r12
je 0x2aef70
movq %r12, 0x10(%rax)
movq %r14, 0x18(%rax)
jmp 0x2aefcd
testq %r12, %r12
je 0x2aef6b
movl $0x20, %edi
callq 0x27c381
testq %rax, %rax
je 0x2aefca
movq %rax, %r15
movq %r14, 0x18(%rax)
movq %r12, 0x10(%rax)
movl 0x4(%rbx), %eax
incl %eax
movl %eax, 0x4(%rbx)
cmpl $0xa, %eax
jb 0x2aef4a
movl (%rbx), %ecx
leal (%rcx,%rcx), %edx
cmpl %edx, %eax
jbe 0x2aef4a
addl %eax, %eax
cmpl $0x40, %eax
movl $0x40, %r12d
cmovbl %eax, %r12d
cmpl %ecx, %r12d
je 0x2aef4a
movq 0x21b00c(%rip), %rax    # 0x4c9e48
testq %rax, %rax
je 0x2aee43
callq *%rax
shll $0x4, %r12d
movq %r12, %rdi
callq 0x27c381
movq %rax, %r12
movq 0x21aff7(%rip), %rax    # 0x4c9e50
testq %rax, %rax
je 0x2aee60
callq *%rax
testq %r12, %r12
je 0x2aef4a
movq 0x10(%rbx), %rdi
callq 0x27c490
movq %r12, 0x10(%rbx)
movq %r12, %rdi
callq *0x217819(%rip)         # 0x4c6698
sarl $0x4, %eax
movl %eax, (%rbx)
movq %rax, 0x8(%rsp)
movq %rax, %rdx
shlq $0x4, %rdx
xorl %ebp, %ebp
movq %r12, 0x10(%rsp)
movq %r12, %rdi
xorl %esi, %esi
callq 0x173a0
movq 0x8(%rbx), %rcx
movq $0x0, 0x8(%rbx)
testq %rcx, %rcx
je 0x2aef14
leaq 0x12bba7(%rip), %r12    # 0x3daa60
movq 0x18(%rcx), %rdx
movb (%rdx), %sil
movl $0x0, %eax
testb %sil, %sil
je 0x2aeeeb
incq %rdx
xorl %eax, %eax
movzbl %sil, %esi
movzbl (%rsi,%r12), %esi
addl %eax, %esi
imull $0x9e3779b1, %esi, %eax # imm = 0x9E3779B1
movb (%rdx), %sil
incq %rdx
testb %sil, %sil
jne 0x2aeecf
xorl %edx, %edx
divl 0x8(%rsp)
movq (%rcx), %r13
shlq $0x4, %rdx
movq 0x10(%rsp), %rax
leaq (%rdx,%rax), %rsi
movq %rbx, %rdi
movq %rcx, %rdx
callq 0x2af0a0
movq %r13, %rcx
testq %r13, %r13
jne 0x2aeeb9
movb (%r14), %al
testb %al, %al
je 0x2aef40
incq %r14
xorl %ebp, %ebp
leaq 0x12bb39(%rip), %rcx    # 0x3daa60
movzbl %al, %eax
movzbl (%rax,%rcx), %eax
addl %ebp, %eax
imull $0x9e3779b1, %eax, %ebp # imm = 0x9E3779B1
movb (%r14), %al
incq %r14
testb %al, %al
jne 0x2aef27
movl %ebp, %eax
xorl %edx, %edx
divl (%rbx)
movl %edx, 0x4(%rsp)
movq 0x10(%rbx), %rax
movl 0x4(%rsp), %esi
shlq $0x4, %rsi
addq %rax, %rsi
testq %rax, %rax
cmoveq %rax, %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x2af0a0
xorl %r15d, %r15d
jmp 0x2aefcd
movl 0x4(%rsp), %ecx
movq 0x8(%rax), %rsi
leaq 0x8(%rbx), %rdx
testq %rsi, %rsi
cmovneq %rsi, %rdx
movq (%rax), %rdi
movq %rdi, (%rdx)
movq (%rax), %rdx
testq %rdx, %rdx
je 0x2aef95
movq %rsi, 0x8(%rdx)
movq 0x10(%rbx), %rsi
testq %rsi, %rsi
je 0x2aefb3
shlq $0x4, %rcx
leaq (%rsi,%rcx), %rdi
cmpq %rax, 0x8(%rsi,%rcx)
jne 0x2aefb1
movq %rdx, 0x8(%rdi)
decl (%rdi)
movq %rax, %rdi
callq 0x27c490
decl 0x4(%rbx)
jne 0x2aefcd
movq %rbx, %rdi
callq 0x2aebab
jmp 0x2aefcd
movq %r12, %r15
movq %r15, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq