// File: /workspace/github_c_makefile_star2_O2/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 0xc(%rsp), %rdx
callq 0x24aadd
movq 0x10(%rax), %r15
testq %r15, %r15
je 0x24a934
testq %r12, %r12
je 0x24aa36
movq %r12, 0x10(%rax)
movq %r14, 0x18(%rax)
jmp 0x24aacb
testq %r12, %r12
je 0x24aac8
pushq $0x20
popq %rdi
callq 0x21f6df
testq %rax, %rax
je 0x24aa8d
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 0x24aaa7
movl (%rbx), %ecx
leal (%rcx,%rcx), %edx
cmpl %edx, %eax
jbe 0x24aaa7
addl %eax, %eax
cmpl $0x40, %eax
pushq $0x40
popq %r12
cmovbl %eax, %r12d
cmpl %ecx, %r12d
je 0x24aaa7
movq 0x1f3464(%rip), %rax    # 0x43ddf8
testq %rax, %rax
je 0x24a99b
callq *%rax
shll $0x4, %r12d
movq %r12, %rdi
callq 0x21f6df
movq %rax, %r12
movq 0x1f344f(%rip), %rax    # 0x43de00
testq %rax, %rax
je 0x24a9b8
callq *%rax
testq %r12, %r12
je 0x24aaa7
movq %r15, 0x10(%rsp)
movq 0x10(%rbx), %rdi
callq 0x21f7f9
movq %r12, 0x10(%rbx)
movq %r12, %rdi
callq *0x1efc6c(%rip)         # 0x43a648
movl %eax, %r13d
sarl $0x4, %r13d
movl %r13d, (%rbx)
movq %r13, %rdx
shlq $0x4, %rdx
movq %r12, %r15
movq %r12, %rdi
xorl %esi, %esi
callq 0x17380
movq 0x8(%rbx), %rbp
andq $0x0, 0x8(%rbx)
testq %rbp, %rbp
je 0x24aa92
movq 0x18(%rbp), %rdi
callq 0x24ab59
xorl %edx, %edx
divl %r13d
movq (%rbp), %r12
shlq $0x4, %rdx
leaq (%rdx,%r15), %rsi
movq %rbx, %rdi
movq %rbp, %rdx
callq 0x24ab7c
movq %r12, %rbp
jmp 0x24aa03
movl 0xc(%rsp), %edx
movq (%rax), %rcx
movq 0x8(%rax), %rsi
leaq 0x8(%rbx), %rdi
testq %rsi, %rsi
cmovneq %rsi, %rdi
movq %rcx, (%rdi)
testq %rcx, %rcx
je 0x24aa58
movq %rsi, 0x8(%rcx)
movq 0x10(%rbx), %rsi
testq %rsi, %rsi
je 0x24aa76
shlq $0x4, %rdx
leaq (%rsi,%rdx), %rdi
cmpq %rax, 0x8(%rsi,%rdx)
jne 0x24aa74
movq %rcx, 0x8(%rdi)
decl (%rdi)
movq %rax, %rdi
callq 0x21f7f9
decl 0x4(%rbx)
jne 0x24aacb
movq %rbx, %rdi
callq 0x24a72c
jmp 0x24aacb
movq %r12, %r15
jmp 0x24aacb
movq %r14, %rdi
callq 0x24ab59
xorl %edx, %edx
divl (%rbx)
movl %edx, 0xc(%rsp)
movq 0x10(%rsp), %r15
movq 0x10(%rbx), %rax
movl 0xc(%rsp), %esi
shlq $0x4, %rsi
addq %rax, %rsi
testq %rax, %rax
cmoveq %rax, %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x24ab7c
xorl %r15d, %r15d
movq %r15, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq