// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3HashInsert
SQLITE_PRIVATE void *sqlite3HashInsert(Hash *pH, const char *pKey, int nKey, 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 );
  assert( nKey>=0 );
  if( pH->htsize ){
    h = strHash(pKey, nKey) % pH->htsize;
  }else{
    h = 0;
  }
  elem = findElementGivenHash(pH,pKey,nKey,h);
  if( elem ){
    void *old_data = elem->data;
    if( data==0 ){
      removeElementGivenHash(pH,elem,h);
    }else{
      elem->data = data;
      elem->pKey = pKey;
      assert(nKey==elem->nKey);
    }
    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->nKey = nKey;
  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, nKey) % pH->htsize;
    }
  }
  if( pH->ht ){
    insertElement(pH, &pH->ht[h], new_elem);
  }else{
    insertElement(pH, 0, new_elem);
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x46e39
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x46930
movq -0x10(%rbp), %rcx
xorl %edx, %edx
divl (%rcx)
movl %edx, -0x2c(%rbp)
jmp 0x46e40
movl $0x0, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
movl -0x2c(%rbp), %ecx
callq 0x46990
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x46ea8
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x46e83
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl -0x2c(%rbp), %edx
callq 0x46fb0
jmp 0x46e9b
movq -0x28(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x48(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x46f9f
cmpq $0x0, -0x28(%rbp)
jne 0x46ebc
movq $0x0, -0x8(%rbp)
jmp 0x46f9f
movl $0x28, %edi
callq 0xa3c0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x46ede
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x46f9f
movq -0x18(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x18(%rax)
movl -0x1c(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x28(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rax
cmpl $0xa, 0x4(%rax)
jb 0x46f5a
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x10(%rbp), %rcx
movl (%rcx), %ecx
shll %ecx
cmpl %ecx, %eax
jbe 0x46f5a
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x4(%rax), %esi
shll %esi
callq 0x47090
cmpl $0x0, %eax
je 0x46f58
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x46930
movq -0x10(%rbp), %rcx
xorl %edx, %edx
divl (%rcx)
movl %edx, -0x2c(%rbp)
jmp 0x46f5a
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x46f86
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
movl -0x2c(%rbp), %eax
shlq $0x4, %rax
addq %rax, %rsi
movq -0x40(%rbp), %rdx
callq 0x471c0
jmp 0x46f97
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rdx
xorl %eax, %eax
movl %eax, %esi
callq 0x471c0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)