// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3RowSetTest
SQLITE_PRIVATE int sqlite3RowSetTest(RowSet *pRowSet, u8 iBatch, sqlite3_int64 iRowid){
  struct RowSetEntry *p, *pTree;

  /* This routine is never called after sqlite3RowSetNext() */
  assert( pRowSet!=0 && (pRowSet->rsFlags & ROWSET_NEXT)==0 );

  /* Sort entries into the forest on the first test of a new batch 
  */
  if( iBatch!=pRowSet->iBatch ){
    p = pRowSet->pEntry;
    if( p ){
      struct RowSetEntry **ppPrevTree = &pRowSet->pForest;
      if( (pRowSet->rsFlags & ROWSET_SORTED)==0 ){
        p = rowSetEntrySort(p);
      }
      for(pTree = pRowSet->pForest; pTree; pTree=pTree->pRight){
        ppPrevTree = &pTree->pRight;
        if( pTree->pLeft==0 ){
          pTree->pLeft = rowSetListToTree(p);
          break;
        }else{
          struct RowSetEntry *pAux, *pTail;
          rowSetTreeToList(pTree->pLeft, &pAux, &pTail);
          pTree->pLeft = 0;
          p = rowSetEntryMerge(pAux, p);
        }
      }
      if( pTree==0 ){
        *ppPrevTree = pTree = rowSetEntryAlloc(pRowSet);
        if( pTree ){
          pTree->v = 0;
          pTree->pRight = 0;
          pTree->pLeft = rowSetListToTree(p);
        }
      }
      pRowSet->pEntry = 0;
      pRowSet->pLast = 0;
      pRowSet->rsFlags |= ROWSET_SORTED;
    }
    pRowSet->iBatch = iBatch;
  }

  /* Test to see if the iRowid value appears anywhere in the forest.
  ** Return 1 if it does and 0 if not.
  */
  for(pTree = pRowSet->pForest; pTree; pTree=pTree->pRight){
    p = pTree->pLeft;
    while( p ){
      if( p->v<iRowid ){
        p = p->pRight;
      }else if( p->v>iRowid ){
        p = p->pLeft;
      }else{
        return 1;
      }
    }
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movb %sil, %al
movq %rdi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movq %rdx, -0x20(%rbp)
movzbl -0x11(%rbp), %eax
movq -0x10(%rbp), %rcx
movzbl 0x33(%rcx), %ecx
cmpl %ecx, %eax
je 0x3f29e
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x3f294
movq -0x10(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x32(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x3f19a
movq -0x28(%rbp), %rdi
callq 0x488c0
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x3f21c
movq -0x30(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x3f1da
movq -0x28(%rbp), %rdi
callq 0x48a90
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x3f21c
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x48(%rbp), %rdx
callq 0x48b30
movq -0x30(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x40(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x489b0
movq %rax, -0x28(%rbp)
jmp 0x3f20e
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x3f1a6
cmpq $0x0, -0x30(%rbp)
jne 0x3f26e
movq -0x10(%rbp), %rdi
callq 0x487c0
movq %rax, %rcx
movq %rcx, -0x30(%rbp)
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
cmpq $0x0, -0x30(%rbp)
je 0x3f26c
movq -0x30(%rbp), %rax
movq $0x0, (%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x28(%rbp), %rdi
callq 0x48a90
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x3f26e
movq -0x10(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x10(%rbp), %rax
movzbl 0x32(%rax), %ecx
orl $0x1, %ecx
movb %cl, 0x32(%rax)
movb -0x11(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x33(%rax)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x3f317
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x3f307
movq -0x28(%rbp), %rax
movq (%rax), %rax
cmpq -0x20(%rbp), %rax
jge 0x3f2df
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x3f305
movq -0x28(%rbp), %rax
movq (%rax), %rax
cmpq -0x20(%rbp), %rax
jle 0x3f2fa
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x3f303
movl $0x1, -0x4(%rbp)
jmp 0x3f31e
jmp 0x3f305
jmp 0x3f2bd
jmp 0x3f309
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x3f2aa
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)