// File: /workspace/github_c_makefile_star2_O1/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
pushq %rax
testq %rdi, %rdi
je 0x1b7e2
movl %esi, %r14d
movq %rdi, %rbx
decl %r14d
movl (%rbx), %eax
cmpl $0xf81, %eax            # imm = 0xF81
jb 0x1b6cd
movl 0x8(%rbx), %r13d
testl %r13d, %r13d
je 0x1b6cd
movl %r14d, %eax
xorl %edx, %edx
divl %r13d
movl %eax, %r15d
cmpq $0x0, 0x10(%rbx,%r15,8)
movl %edx, %r14d
jne 0x1b6b4
movl $0x200, %edi            # imm = 0x200
callq 0xa2a2
movq %rax, %r12
testq %rax, %rax
je 0x1b6c4
movl $0x200, %edx            # imm = 0x200
movq %r12, %rdi
xorl %esi, %esi
callq 0x8200
movl %r13d, (%r12)
movq %r12, 0x10(%rbx,%r15,8)
movq 0x10(%rbx,%r15,8), %rbx
movb $0x1, %al
testb %al, %al
jne 0x1b662
jmp 0x1b7cf
movq %r12, 0x10(%rbx,%r15,8)
xorl %eax, %eax
jmp 0x1b6bb
leaq 0x10(%rbx), %r12
cmpl $0xf80, %eax            # imm = 0xF80
ja 0x1b6f2
movl %r14d, %ecx
andb $0x7, %cl
movl $0x1, %eax
shll %cl, %eax
shrl $0x3, %r14d
orb %al, (%r12,%r14)
jmp 0x1b7e2
leal 0x1(%r14), %r15d
movl %r14d, %eax
shrl $0x2, %eax
imulq $0x21084211, %rax, %rax # imm = 0x21084211
shrq $0x22, %rax
imull $0x7c, %eax, %eax
subl %eax, %r14d
cmpl $0x0, (%r12,%r14,4)
je 0x1b738
xorl %r13d, %r13d
movl %r14d, %eax
cmpl %r15d, (%r12,%rax,4)
je 0x1b7e5
incl %r14d
cmpl $0x7c, %r14d
cmovael %r13d, %r14d
cmpl $0x0, (%r12,%r14,4)
jne 0x1b717
jmp 0x1b742
cmpl $0x7b, 0x4(%rbx)
jb 0x1b7d7
cmpl $0x3e, 0x4(%rbx)
jb 0x1b7d7
movl $0x1f0, %edi            # imm = 0x1F0
callq 0xa2a2
testq %rax, %rax
je 0x1b7cf
movl $0x1f0, %edx            # imm = 0x1F0
movq %rax, %rdi
movq %r12, %rsi
movq %rax, -0x30(%rbp)
callq 0x82f0
xorl %r14d, %r14d
movl $0x1f0, %edx            # imm = 0x1F0
movq %r12, %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 %r15d, %esi
callq 0x1b642
movl %eax, %r13d
movq -0x30(%rbp), %r15
movl (%r15,%r14,4), %esi
testl %esi, %esi
je 0x1b7bc
movq %rbx, %rdi
callq 0x1b642
orl %eax, %r13d
incq %r14
cmpq $0x7c, %r14
jne 0x1b7a9
movq %r15, %rdi
callq 0xa2e8
jmp 0x1b7e5
movl $0x7, %r13d
jmp 0x1b7e5
incl 0x4(%rbx)
movl %r14d, %eax
movl %r15d, 0x10(%rbx,%rax,4)
xorl %r13d, %r13d
movl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq