// File: /workspace/github_c_makefile_star2_O3/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, %r13
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x4(%rsp), %rdx
callq 0x2a547e
movq 0x10(%rax), %r15
testq %r15, %r15
je 0x2a5255
movq %rax, %r12
testq %r13, %r13
je 0x2a53ed
movq %r13, 0x10(%r12)
movq %r14, 0x18(%r12)
jmp 0x2a546c
testq %r13, %r13
je 0x2a53e8
movl $0x20, %edi
callq 0x272ae6
testq %rax, %rax
je 0x2a5469
movq %rax, %r15
movq %r14, 0x18(%rax)
movq %r13, 0x10(%rax)
movl 0x4(%rbx), %eax
incl %eax
movl %eax, 0x4(%rbx)
cmpl $0xa, %eax
jb 0x2a53c7
movl (%rbx), %ecx
leal (%rcx,%rcx), %edx
cmpl %edx, %eax
jbe 0x2a53c7
addl %eax, %eax
cmpl $0x40, %eax
movl $0x40, %r12d
cmovbl %eax, %r12d
cmpl %ecx, %r12d
je 0x2a53c7
movq 0x219b8f(%rip), %rax    # 0x4bee48
testq %rax, %rax
je 0x2a52c0
callq *%rax
shll $0x4, %r12d
movq %r12, %rdi
callq 0x272ae6
movq %rax, %r12
movq 0x219b7a(%rip), %rax    # 0x4bee50
testq %rax, %rax
je 0x2a52dd
callq *%rax
testq %r12, %r12
je 0x2a53c7
movq 0x10(%rbx), %rdi
callq 0x272c00
movq %r12, 0x10(%rbx)
movq %r12, %rdi
callq *0x21639c(%rip)         # 0x4bb698
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 0x2a5391
leaq 0x12bfaa(%rip), %r12    # 0x3d12e0
movq 0x18(%rcx), %rdx
movb (%rdx), %sil
movl $0x0, %eax
testb %sil, %sil
je 0x2a5368
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 0x2a534c
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 0x2a5537
movq %r13, %rcx
testq %r13, %r13
jne 0x2a5336
movb (%r14), %al
testb %al, %al
je 0x2a53bd
incq %r14
xorl %ebp, %ebp
leaq 0x12bf3c(%rip), %rcx    # 0x3d12e0
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 0x2a53a4
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 0x2a5537
xorl %r15d, %r15d
jmp 0x2a546c
movl 0x4(%rsp), %ecx
movq (%r12), %rax
movq 0x8(%r12), %rdx
leaq 0x8(%rbx), %rsi
testq %rdx, %rdx
cmovneq %rdx, %rsi
movq %rax, (%rsi)
testq %rax, %rax
je 0x2a5411
movq %rdx, 0x8(%rax)
movq 0x10(%rbx), %rdx
testq %rdx, %rdx
je 0x2a542f
shlq $0x4, %rcx
leaq (%rdx,%rcx), %rsi
cmpq %r12, 0x8(%rdx,%rcx)
jne 0x2a542d
movq %rax, 0x8(%rsi)
decl (%rsi)
cmpl $0x0, 0x21622a(%rip)    # 0x4bb660
je 0x2a5451
movq %r12, %rdi
callq *0x216257(%rip)         # 0x4bb698
cltq
subq %rax, 0x2196ae(%rip)    # 0x4beaf8
decq 0x2196ef(%rip)          # 0x4beb40
movq %r12, %rdi
callq *0x21622e(%rip)         # 0x4bb688
decl 0x4(%rbx)
jne 0x2a546c
movq %rbx, %rdi
callq 0x2a5003
jmp 0x2a546c
movq %r13, %r15
movq %r15, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq