// File: /workspace/github_c_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x18(%rdi), %r13
movq 0x78(%r13), %rax
movq %rsi, 0x18(%rax)
movq 0x18(%rdi), %rdi
callq 0xf8a2
xorl %r12d, %r12d
cmpl $0x64, %eax
jne 0x124e8
movq 0x70(%r13), %rax
movq (%rax), %rcx
movslq 0xc(%r15), %rdx
movl 0x70(%rcx,%rdx,4), %eax
cmpl $0xb, %eax
ja 0x124ec
movq 0x20(%r15), %rdi
cmpl $0x7, %eax
leaq 0x5f2fe(%rip), %rcx     # 0x717a5
leaq 0x5f2fc(%rip), %rsi     # 0x717aa
cmoveq %rcx, %rsi
testl %eax, %eax
leaq 0x5df70(%rip), %rdx     # 0x7042b
cmovneq %rsi, %rdx
leaq 0x5f2c2(%rip), %rsi     # 0x71788
xorl %eax, %eax
callq 0x11ce7
movq %rax, %r12
movq 0x18(%r15), %rdi
callq 0xed8f
movq $0x0, 0x18(%r15)
movl $0x1, %ebp
jmp 0x12542
movl %eax, %ebp
jmp 0x12542
movswq 0x20(%rcx), %rsi
addq %rsi, %rdx
movl 0x70(%rcx,%rdx,4), %edx
movl %edx, 0x8(%r15)
addl $-0xc, %eax
shrl %eax
movl %eax, 0x4(%r15)
movq (%rcx), %rax
movq %rax, 0x10(%r15)
movq (%rax), %rdi
callq 0xd284
movq 0x10(%r15), %r12
movq 0x28(%r12), %rdi
callq 0xa3cf
movq $0x0, 0x28(%r12)
movb $0x1, 0x78(%r12)
movq 0x10(%r15), %rdi
callq 0x37828
movl $0x64, %ebp
xorl %r12d, %r12d
cmpl $0x64, %ebp
jne 0x1254b
xorl %ebp, %ebp
jmp 0x125a8
movq 0x18(%r15), %rdi
testq %rdi, %rdi
je 0x125a8
callq 0xed8f
movq $0x0, 0x18(%r15)
movq 0x20(%r15), %r15
testl %eax, %eax
je 0x1258c
movl %eax, %ebp
movq %r15, %rdi
callq 0x131b8
leaq 0x5ded2(%rip), %rsi     # 0x7044c
movq %r15, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x11ce7
movq %rax, %r12
jmp 0x125a8
leaq 0x5f21f(%rip), %rsi     # 0x717b2
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x11ce7
movq %rax, %r12
movl $0x1, %ebp
movq %r12, (%rbx)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq