// File: /workspace/github_c_makefile_star2_O0/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
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rcx
movq -0x30(%rbp), %rax
movq 0x78(%rax), %rax
movq %rcx, 0x18(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x11160
movl %eax, -0x1c(%rbp)
cmpl $0x64, -0x1c(%rbp)
jne 0x144b3
movq -0x30(%rbp), %rax
movq 0x70(%rax), %rax
movq (%rax), %rax
movq 0x70(%rax), %rax
movq -0x8(%rbp), %rcx
movslq 0xc(%rcx), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x34(%rbp)
cmpl $0xc, -0x34(%rbp)
jae 0x1445c
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x40(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0x14404
leaq 0x9e93a(%rip), %rax     # 0xb2d38
movq %rax, -0x48(%rbp)
jmp 0x14420
movl -0x34(%rbp), %edx
leaq 0x9b0c1(%rip), %rax     # 0xaf4cf
leaq 0x9b0b5(%rip), %rcx     # 0xaf4ca
cmpl $0x7, %edx
cmoveq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rdx
leaq 0x9b07e(%rip), %rsi     # 0xaf4ad
movb $0x0, %al
callq 0x137f0
movq %rax, -0x28(%rbp)
movl $0x1, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0xfcf0
movq -0x8(%rbp), %rax
movq $0x0, 0x18(%rax)
jmp 0x144b1
movq -0x30(%rbp), %rax
movq 0x70(%rax), %rax
movq (%rax), %rax
movq 0x78(%rax), %rax
movq -0x8(%rbp), %rcx
movslq 0xc(%rcx), %rcx
movl (%rax,%rcx,4), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0x34(%rbp), %edi
callq 0x3b8f0
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x30(%rbp), %rax
movq 0x70(%rax), %rax
movq (%rax), %rax
movq (%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x4aaf0
jmp 0x144b3
cmpl $0x64, -0x1c(%rbp)
jne 0x144c5
movl $0x0, -0x1c(%rbp)
jmp 0x1454f
movq -0x8(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x1454d
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0xfcf0
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movq $0x0, 0x18(%rax)
cmpl $0x0, -0x1c(%rbp)
jne 0x14519
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x10(%rbp), %rdx
leaq 0x9afd2(%rip), %rsi     # 0xaf4d7
movb $0x0, %al
callq 0x137f0
movq %rax, -0x28(%rbp)
movl $0x1, -0x1c(%rbp)
jmp 0x1454b
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x154c0
movq -0x50(%rbp), %rdi
movq %rax, %rdx
leaq 0x99c90(%rip), %rsi     # 0xae1d0
movb $0x0, %al
callq 0x137f0
movq %rax, -0x28(%rbp)
jmp 0x1454d
jmp 0x1454f
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movl -0x1c(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)