// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3BitvecBuiltinTest
SQLITE_PRIVATE int sqlite3BitvecBuiltinTest(int sz, int *aOp){
  Bitvec *pBitvec = 0;
  unsigned char *pV = 0;
  int rc = -1;
  int i, nx, pc, op;
  void *pTmpSpace;

  /* Allocate the Bitvec to be tested and a linear array of
  ** bits to act as the reference */
  pBitvec = sqlite3BitvecCreate( sz );
  pV = sqlite3MallocZero( (sz+7)/8 + 1 );
  pTmpSpace = sqlite3_malloc(BITVEC_SZ);
  if( pBitvec==0 || pV==0 || pTmpSpace==0  ) goto bitvec_end;

  /* NULL pBitvec tests */
  sqlite3BitvecSet(0, 1);
  sqlite3BitvecClear(0, 1, pTmpSpace);

  /* Run the program */
  pc = 0;
  while( (op = aOp[pc])!=0 ){
    switch( op ){
      case 1:
      case 2:
      case 5: {
        nx = 4;
        i = aOp[pc+2] - 1;
        aOp[pc+2] += aOp[pc+3];
        break;
      }
      case 3:
      case 4: 
      default: {
        nx = 2;
        sqlite3_randomness(sizeof(i), &i);
        break;
      }
    }
    if( (--aOp[pc+1]) > 0 ) nx = 0;
    pc += nx;
    i = (i & 0x7fffffff)%sz;
    if( (op & 1)!=0 ){
      SETBIT(pV, (i+1));
      if( op!=5 ){
        if( sqlite3BitvecSet(pBitvec, i+1) ) goto bitvec_end;
      }
    }else{
      CLEARBIT(pV, (i+1));
      sqlite3BitvecClear(pBitvec, i+1, pTmpSpace);
    }
  }

  /* Test to make sure the linear array exactly matches the
  ** Bitvec object.  Start with the assumption that they do
  ** match (rc==0).  Change rc to non-zero if a discrepancy
  ** is found.
  */
  rc = sqlite3BitvecTest(0,0) + sqlite3BitvecTest(pBitvec, sz+1)
          + sqlite3BitvecTest(pBitvec, 0)
          + (sqlite3BitvecSize(pBitvec) - sz);
  for(i=1; i<=sz; i++){
    if(  (TESTBIT(pV,i))!=sqlite3BitvecTest(pBitvec,i) ){
      rc = i;
      break;
    }
  }

  /* Free allocated structure */
bitvec_end:
  sqlite3_free(pTmpSpace);
  sqlite3_free(pV);
  sqlite3BitvecDestroy(pBitvec);
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movl $0xffffffff, -0x24(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %edi
callq 0x22360
movq %rax, -0x18(%rbp)
movl -0x4(%rbp), %eax
addl $0x7, %eax
movl $0x8, %ecx
cltd
idivl %ecx
movl %eax, %edi
addl $0x1, %edi
callq 0xd860
movq %rax, -0x20(%rbp)
movl $0x200, %edi            # imm = 0x200
callq 0xa380
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x1ad91
cmpq $0x0, -0x20(%rbp)
je 0x1ad91
cmpq $0x0, -0x40(%rbp)
jne 0x1ad96
jmp 0x1afe5
xorl %eax, %eax
movl %eax, %edi
movl $0x1, %esi
callq 0x220b0
movq -0x40(%rbp), %rdx
xorl %eax, %eax
movl %eax, %edi
movl $0x1, %esi
callq 0x2e110
movl $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rax
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x34(%rbp)
cmpl $0x0, %eax
je 0x1af28
movl -0x34(%rbp), %eax
movl %eax, -0x44(%rbp)
decl %eax
subl $0x2, %eax
jb 0x1adfa
jmp 0x1ade3
movl -0x44(%rbp), %eax
addl $-0x3, %eax
subl $0x2, %eax
jb 0x1ae3c
jmp 0x1adf0
movl -0x44(%rbp), %eax
subl $0x5, %eax
jne 0x1ae3e
jmp 0x1adfa
movl $0x4, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movl -0x30(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
subl $0x1, %eax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl -0x30(%rbp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0x10(%rbp), %rax
movl -0x30(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
addl (%rax,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
jmp 0x1ae53
jmp 0x1ae3e
movl $0x2, -0x2c(%rbp)
movl $0x4, %edi
leaq -0x28(%rbp), %rsi
callq 0xc740
movq -0x10(%rbp), %rcx
movl -0x30(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
movl (%rcx,%rdx,4), %eax
addl $-0x1, %eax
movl %eax, (%rcx,%rdx,4)
cmpl $0x0, %eax
jle 0x1ae75
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x28(%rbp), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cltd
idivl -0x4(%rbp)
movl %edx, -0x28(%rbp)
movl -0x34(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x1aee4
movl -0x28(%rbp), %ecx
addl $0x1, %ecx
andl $0x7, %ecx
movl $0x1, %esi
shll %cl, %esi
movq -0x20(%rbp), %rax
movl -0x28(%rbp), %ecx
addl $0x1, %ecx
sarl $0x3, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %edx
orl %esi, %edx
movb %dl, (%rax,%rcx)
cmpl $0x5, -0x34(%rbp)
je 0x1aee2
movq -0x18(%rbp), %rdi
movl -0x28(%rbp), %esi
addl $0x1, %esi
callq 0x220b0
cmpl $0x0, %eax
je 0x1aee0
jmp 0x1afe5
jmp 0x1aee2
jmp 0x1af23
movl -0x28(%rbp), %ecx
addl $0x1, %ecx
andl $0x7, %ecx
movl $0x1, %esi
shll %cl, %esi
xorl $-0x1, %esi
movq -0x20(%rbp), %rax
movl -0x28(%rbp), %ecx
addl $0x1, %ecx
sarl $0x3, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %edx
andl %esi, %edx
movb %dl, (%rax,%rcx)
movq -0x18(%rbp), %rdi
movl -0x28(%rbp), %esi
addl $0x1, %esi
movq -0x40(%rbp), %rdx
callq 0x2e110
jmp 0x1adbd
xorl %eax, %eax
movl %eax, %edi
xorl %esi, %esi
callq 0x219a0
movl %eax, -0x50(%rbp)
movq -0x18(%rbp), %rdi
movl -0x4(%rbp), %esi
addl $0x1, %esi
callq 0x219a0
movl %eax, %ecx
movl -0x50(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x4c(%rbp)
movq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0x219a0
movl %eax, %ecx
movl -0x4c(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x48(%rbp)
movq -0x18(%rbp), %rdi
callq 0x2da10
movl %eax, %ecx
movl -0x48(%rbp), %eax
subl -0x4(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x24(%rbp)
movl $0x1, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x4(%rbp), %eax
jg 0x1afe3
movq -0x20(%rbp), %rax
movl -0x28(%rbp), %ecx
sarl $0x3, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl -0x28(%rbp), %ecx
andl $0x7, %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
andl %ecx, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x54(%rbp)
movq -0x18(%rbp), %rdi
movl -0x28(%rbp), %esi
callq 0x219a0
movl %eax, %ecx
movl -0x54(%rbp), %eax
cmpl %ecx, %eax
je 0x1afd6
movl -0x28(%rbp), %eax
movl %eax, -0x24(%rbp)
jmp 0x1afe3
jmp 0x1afd8
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x1af81
jmp 0x1afe5
movq -0x40(%rbp), %rdi
callq 0xa420
movq -0x20(%rbp), %rdi
callq 0xa420
movq -0x18(%rbp), %rdi
callq 0x26630
movl -0x24(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)