// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3BitvecSet
SQLITE_PRIVATE int sqlite3BitvecSet(Bitvec *p, u32 i){
  u32 h;
  if( p==0 ) return SQLITE_OK;
  assert( i>0 );
  assert( i<=p->iSize );
  i--;
  while((p->iSize > BITVEC_NBIT) && p->iDivisor) {
    u32 bin = i/p->iDivisor;
    i = i%p->iDivisor;
    if( p->u.apSub[bin]==0 ){
      p->u.apSub[bin] = sqlite3BitvecCreate( p->iDivisor );
      if( p->u.apSub[bin]==0 ) return SQLITE_NOMEM;
    }
    p = p->u.apSub[bin];
  }
  if( p->iSize<=BITVEC_NBIT ){
    p->u.aBitmap[i/BITVEC_SZELEM] |= 1 << (i&(BITVEC_SZELEM-1));
    return SQLITE_OK;
  }
  h = BITVEC_HASH(i++);
  /* if there wasn't a hash collision, and this doesn't */
  /* completely fill the hash, then just add it without */
  /* worring about sub-dividing and re-hashing. */
  if( !p->u.aHash[h] ){
    if (p->nSet<(BITVEC_NINT-1)) {
      goto bitvec_set_end;
    } else {
      goto bitvec_set_rehash;
    }
  }
  /* there was a collision, check to see if it's already */
  /* in hash, if not, try to find a spot for it */
  do {
    if( p->u.aHash[h]==i ) return SQLITE_OK;
    h++;
    if( h>=BITVEC_NINT ) h = 0;
  } while( p->u.aHash[h] );
  /* we didn't find it in the hash.  h points to the first */
  /* available free spot. check to see if this is going to */
  /* make our hash too "full".  */
bitvec_set_rehash:
  if( p->nSet>=BITVEC_MXHASH ){
    unsigned int j;
    int rc;
    u32 *aiValues = sqlite3StackAllocRaw(0, sizeof(p->u.aHash));
    if( aiValues==0 ){
      return SQLITE_NOMEM;
    }else{
      memcpy(aiValues, p->u.aHash, sizeof(p->u.aHash));
      memset(p->u.apSub, 0, sizeof(p->u.apSub));
      p->iDivisor = (p->iSize + BITVEC_NPTR - 1)/BITVEC_NPTR;
      rc = sqlite3BitvecSet(p, i);
      for(j=0; j<BITVEC_NINT; j++){
        if( aiValues[j] ) rc |= sqlite3BitvecSet(p, aiValues[j]);
      }
      sqlite3StackFree(0, aiValues);
      return rc;
    }
  }
bitvec_set_end:
  p->nSet++;
  p->u.aHash[h] = i;
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
xorl %r14d, %r14d
testq %rdi, %rdi
je 0x1b4f3
movl %esi, %r15d
movq %rdi, %rbx
decl %r15d
cmpl $0xf81, (%rdi)          # imm = 0xF81
jb 0x1b4da
movl 0x8(%rbx), %edi
testl %edi, %edi
je 0x1b505
movl %r15d, %eax
xorl %edx, %edx
divl %edi
movl %eax, %r12d
movq 0x10(%rbx,%r12,8), %rax
movl %edx, %r15d
testq %rax, %rax
jne 0x1b4cd
callq 0x1b61e
movq %rax, 0x10(%rbx,%r12,8)
testq %rax, %rax
je 0x1b613
cmpl $0xf80, (%rax)          # imm = 0xF80
movq %rax, %rbx
ja 0x1b49c
jmp 0x1b4dd
movq %rbx, %rax
movl %r15d, %ecx
andb $0x7, %cl
movl $0x1, %edx
shll %cl, %edx
shrl $0x3, %r15d
orb %dl, 0x10(%rax,%r15)
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leal 0x1(%r15), %r12d
movl %r15d, %eax
shrl $0x2, %eax
imulq $0x21084211, %rax, %rax # imm = 0x21084211
shrq $0x22, %rax
imull $0x7c, %eax, %eax
subl %eax, %r15d
leaq 0x10(%rbx), %r13
movl 0x10(%rbx,%r15,4), %eax
testl %eax, %eax
je 0x1b556
xorl %r14d, %r14d
cmpl %r12d, %eax
je 0x1b4f3
incl %r15d
cmpl $0x7c, %r15d
cmovael %r14d, %r15d
movl (%r13,%r15,4), %eax
testl %eax, %eax
jne 0x1b530
movl 0x4(%rbx), %eax
cmpl $0x3d, %eax
ja 0x1b56d
movl %r15d, %r15d
jmp 0x1b55e
movl 0x4(%rbx), %eax
cmpl $0x7b, %eax
jae 0x1b56d
incl %eax
movl %eax, 0x4(%rbx)
movl %r12d, 0x10(%rbx,%r15,4)
xorl %r14d, %r14d
jmp 0x1b4f3
cmpl $0x0, 0x78e8c(%rip)     # 0x94400
je 0x1b58c
leaq -0x38(%rbp), %r14
movl $0x1f0, %edi            # imm = 0x1F0
movq %r14, %rsi
callq 0x171f8
movq (%r14), %rax
jmp 0x1b597
movl $0x1f0, %edi            # imm = 0x1F0
callq *0x78e89(%rip)          # 0x94420
testq %rax, %rax
je 0x1b613
movl $0x1f0, %edx            # imm = 0x1F0
movq %rax, %rdi
movq %rax, -0x30(%rbp)
movq %r13, %rsi
callq 0x82f0
xorl %r15d, %r15d
movl $0x1f0, %edx            # imm = 0x1F0
movq %r13, %rdi
xorl %esi, %esi
callq 0x8200
movl (%rbx), %eax
addq $0x3d, %rax
movabsq $0x421084210842109, %rcx # imm = 0x421084210842109
mulq %rcx
movl %edx, 0x8(%rbx)
movq %rbx, %rdi
movl %r12d, %esi
callq 0x1b472
movl %eax, %r14d
movq -0x30(%rbp), %r12
movl (%r12,%r15,4), %esi
testl %esi, %esi
je 0x1b5fd
movq %rbx, %rdi
callq 0x1b472
orl %eax, %r14d
incq %r15
cmpq $0x7c, %r15
jne 0x1b5ea
movq %r12, %rdi
callq 0xa3c7
jmp 0x1b4f3
movl $0x7, %r14d
jmp 0x1b4f3