// File: /workspace/github_c_makefile_star2_O2/skeeto[P]flappy/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 ){
    VdbeCursor *pC = v->apCsr[0];
    u32 type = pC->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 = pC->aType[p->iCol + pC->nField];
      p->nByte = sqlite3VdbeSerialTypeLen(type);
      p->pCsr =  pC->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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq 0x18(%rdi), %r12
movq 0x78(%r12), %rax
movq %rsi, 0x18(%rax)
movq 0x18(%rdi), %rdi
callq 0xecb0
cmpl $0x64, %eax
jne 0x11367
movq 0x70(%r12), %rax
movq (%rax), %rcx
movslq 0xc(%r14), %rdx
movl 0x70(%rcx,%rdx,4), %eax
cmpl $0xb, %eax
ja 0x113a5
movq 0x20(%r14), %rdi
cmpl $0x7, %eax
leaq 0x5349a(%rip), %rcx     # 0x647c5
leaq 0x53498(%rip), %rsi     # 0x647ca
cmoveq %rcx, %rsi
testl %eax, %eax
leaq 0x5210c(%rip), %rdx     # 0x6344b
cmovneq %rsi, %rdx
leaq 0x5345e(%rip), %rsi     # 0x647a8
xorl %eax, %eax
callq 0x10c1b
movq %rax, %r15
movq 0x18(%r14), %rdi
callq 0xe2a4
andq $0x0, 0x18(%r14)
jmp 0x11409
movq 0x18(%r14), %rdi
testq %rdi, %rdi
je 0x113eb
callq 0xe2a4
andq $0x0, 0x18(%r14)
movq 0x20(%r14), %r14
testl %eax, %eax
je 0x113f2
movl %eax, %ebp
movq %r14, %rdi
callq 0x11e6f
leaq 0x520d9(%rip), %rsi     # 0x6346c
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x10c1b
movq %rax, %r15
jmp 0x1140c
movswq 0x20(%rcx), %rsi
addq %rsi, %rdx
movl 0x70(%rcx,%rdx,4), %edx
movl %edx, 0x8(%r14)
addl $-0xc, %eax
shrl %eax
movl %eax, 0x4(%r14)
movq (%rcx), %rdi
movq %rdi, 0x10(%r14)
callq 0x32177
movq 0x10(%r14), %r15
movq %r15, %rdi
callq 0x1f5a2
movb $0x1, 0x78(%r15)
movq 0x10(%r14), %rdi
callq 0x3217f
xorl %r15d, %r15d
xorl %ebp, %ebp
jmp 0x1140c
movl %eax, %ebp
xorl %r15d, %r15d
jmp 0x1140c
leaq 0x533d9(%rip), %rsi     # 0x647d2
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x10c1b
movq %rax, %r15
pushq $0x1
popq %rbp
movq %r15, (%rbx)
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq