// File: /workspace/github_c_makefile_star2_O3/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 0xf9ab
cmpl $0x64, %eax
jne 0x12676
movq 0x70(%r12), %rax
movq (%rax), %rcx
movslq 0xc(%r14), %rdx
movl 0x70(%rcx,%rdx,4), %eax
cmpl $0xb, %eax
ja 0x126c2
movq 0x20(%r14), %rdi
cmpl $0x7, %eax
leaq 0x6020e(%rip), %rcx     # 0x72845
leaq 0x6020c(%rip), %rsi     # 0x7284a
cmoveq %rcx, %rsi
testl %eax, %eax
leaq 0x5ee80(%rip), %rdx     # 0x714cb
cmovneq %rsi, %rdx
leaq 0x601d2(%rip), %rsi     # 0x72828
xorl %eax, %eax
callq 0x11e78
movq %rax, %r15
movq 0x18(%r14), %rdi
callq 0xeed1
movq $0x0, 0x18(%r14)
jmp 0x12755
movq 0x18(%r14), %rdi
testq %rdi, %rdi
je 0x12737
callq 0xeed1
movq $0x0, 0x18(%r14)
movq 0x20(%r14), %r14
testl %eax, %eax
je 0x1273e
movl %eax, %ebp
movq %r14, %rdi
callq 0x1333f
leaq 0x5ee3f(%rip), %rsi     # 0x714ec
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x11e78
movq %rax, %r15
jmp 0x1275a
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), %rax
movq %rax, 0x10(%r14)
movq (%rax), %rdi
callq 0xd3a2
movq 0x10(%r14), %r15
movq 0x28(%r15), %rdi
callq 0xa4bf
movq $0x0, 0x28(%r15)
movb $0x1, 0x78(%r15)
movq 0x10(%r14), %rax
movq (%rax), %r14
cmpb $0x0, 0x11(%r14)
je 0x12730
decl 0x14(%r14)
jne 0x12730
movq 0x8(%r14), %rax
movq 0x50(%rax), %rdi
testq %rdi, %rdi
je 0x1272b
callq *0x77bfd(%rip)          # 0x8a328
movb $0x0, 0x12(%r14)
xorl %r15d, %r15d
xorl %ebp, %ebp
jmp 0x1275a
movl %eax, %ebp
xorl %r15d, %r15d
jmp 0x1275a
leaq 0x6010d(%rip), %rsi     # 0x72852
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x11e78
movq %rax, %r15
movl $0x1, %ebp
movq %r15, (%rbx)
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq