// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: blobSeekToRow
static int blobSeekToRow(Incrblob *p, sqlite3_int64 iRow, char **pzErr){
  int rc;                         /* Error code */
  char *zErr = 0;                 /* Error message */
  Vdbe *v = (Vdbe *)p->pStmt;

  /* Set the value of the SQL statements only variable to integer iRow. 
  ** This is done directly instead of using sqlite3_bind_int64() to avoid 
  ** triggering asserts related to mutexes.
  */
  assert( v->aVar[0].flags&MEM_Int );
  v->aVar[0].u.i = iRow;

  rc = sqlite3_step(p->pStmt);
  if( rc==SQLITE_ROW ){
    u32 type = v->apCsr[0]->aType[p->iCol];
    if( type<12 ){
      zErr = sqlite3MPrintf(p->db, "cannot open value of type %s",
          type==0?"null": type==7?"real": "integer"
      );
      rc = SQLITE_ERROR;
      sqlite3_finalize(p->pStmt);
      p->pStmt = 0;
    }else{
      p->iOffset = v->apCsr[0]->aOffset[p->iCol];
      p->nByte = sqlite3VdbeSerialTypeLen(type);
      p->pCsr =  v->apCsr[0]->pCursor;
      sqlite3BtreeEnterCursor(p->pCsr);
      sqlite3BtreeCacheOverflow(p->pCsr);
      sqlite3BtreeLeaveCursor(p->pCsr);
    }
  }

  if( rc==SQLITE_ROW ){
    rc = SQLITE_OK;
  }else if( p->pStmt ){
    rc = sqlite3_finalize(p->pStmt);
    p->pStmt = 0;
    if( rc==SQLITE_OK ){
      zErr = sqlite3MPrintf(p->db, "no such rowid: %lld", iRow);
      rc = SQLITE_ERROR;
    }else{
      zErr = sqlite3MPrintf(p->db, "%s", sqlite3_errmsg(p->db));
    }
  }

  assert( rc!=SQLITE_OK || zErr==0 );
  assert( rc!=SQLITE_ROW && rc!=SQLITE_DONE );

  *pzErr = zErr;
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r14
movq 0x18(%rdi), %r13
movq 0x78(%r13), %rax
movq %rsi, 0x18(%rax)
movq 0x18(%rdi), %rdi
callq 0xf576
cmpl $0x64, %eax
jne 0x12134
movq 0x70(%r13), %rax
movq (%rax), %rcx
movq 0x70(%rcx), %rax
movslq 0xc(%r14), %rdx
movl (%rax,%rdx,4), %eax
cmpl $0xb, %eax
ja 0x12176
movq 0x20(%r14), %rdi
cmpl $0x7, %eax
leaq 0x688d9(%rip), %rcx     # 0x7a9ce
leaq 0x688d7(%rip), %rsi     # 0x7a9d3
cmoveq %rcx, %rsi
testl %eax, %eax
leaq 0x6c1dc(%rip), %rdx     # 0x7e2e5
cmovneq %rsi, %rdx
leaq 0x6889d(%rip), %rsi     # 0x7a9b1
xorl %eax, %eax
callq 0x11900
movq %rax, %r12
movq 0x18(%r14), %rdi
callq 0xea51
movq $0x0, 0x18(%r14)
jmp 0x121ce
movq 0x18(%r14), %rdi
testq %rdi, %rdi
je 0x121af
callq 0xea51
movq $0x0, 0x18(%r14)
movq 0x20(%r14), %r14
testl %eax, %eax
je 0x121b7
movl %eax, %r15d
movq %r14, %rdi
callq 0x12cc6
leaq 0x67575(%rip), %rsi     # 0x796d9
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x11900
movq %rax, %r12
jmp 0x121d4
movq 0x78(%rcx), %rsi
movl (%rsi,%rdx,4), %edx
movl %edx, 0x8(%r14)
addl $-0xc, %eax
shrl %eax
movl %eax, 0x4(%r14)
movq (%rcx), %r15
movq %r15, 0x10(%r14)
movq 0x28(%r15), %rdi
callq 0xa3c7
movq $0x0, 0x28(%r15)
movb $0x1, 0x78(%r15)
xorl %r12d, %r12d
xorl %r15d, %r15d
jmp 0x121d4
movl %eax, %r15d
xorl %r12d, %r12d
jmp 0x121d4
leaq 0x6881d(%rip), %rsi     # 0x7a9db
movq %r14, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x11900
movq %rax, %r12
movl $0x1, %r15d
movq %r12, (%rbx)
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq