// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/sqlite-3.33.0/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 register r[1] in the SQL statement to integer iRow.
  ** This is done directly as a performance optimization
  */
  v->aMem[1].flags = MEM_Int;
  v->aMem[1].u.i = iRow;

  /* If the statement has been run before (and is paused at the OP_ResultRow)
  ** then back it up to the point where it does the OP_NotExists.  This could
  ** have been down with an extra OP_Goto, but simply setting the program
  ** counter is faster. */
  if( v->pc>4 ){
    v->pc = 4;
    assert( v->aOp[v->pc].opcode==OP_NotExists );
    rc = sqlite3VdbeExec(v);
  }else{
    rc = sqlite3_step(p->pStmt);
  }
  if( rc==SQLITE_ROW ){
    VdbeCursor *pC = v->apCsr[0];
    u32 type = pC->nHdrParsed>p->iCol ? pC->aType[p->iCol] : 0;
    testcase( pC->nHdrParsed==p->iCol );
    testcase( pC->nHdrParsed==p->iCol+1 );
    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->uc.pCursor;
      sqlite3BtreeIncrblobCursor(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 0x68(%r12), %rax
movw $0x4, 0x40(%rax)
movq %rsi, 0x38(%rax)
cmpl $0x5, 0x34(%r12)
jl 0x227546
movl $0x4, 0x34(%r12)
movq %r12, %rdi
callq 0x23af69
jmp 0x22754f
movq 0x18(%r14), %rdi
callq 0x224bf7
movl %eax, %ebp
cmpl $0x64, %eax
jne 0x22759a
movq 0x78(%r12), %rax
movq (%rax), %rax
movzwl 0x8(%r14), %edx
cmpw %dx, 0x4a(%rax)
jbe 0x2275db
movl 0x70(%rax,%rdx,4), %ecx
cmpl $0xb, %ecx
ja 0x22760c
cmpl $0x7, %ecx
leaq 0x14fcc0(%rip), %rax    # 0x377240
leaq 0x140e19(%rip), %rsi    # 0x3683a0
cmoveq %rax, %rsi
testl %ecx, %ecx
leaq 0x13921e(%rip), %rdx    # 0x3607b2
cmovneq %rsi, %rdx
jmp 0x2275e2
movq 0x18(%r14), %rdi
testq %rdi, %rdi
je 0x227607
callq 0x224044
andq $0x0, 0x18(%r14)
movq 0x20(%r14), %r14
testl %eax, %eax
je 0x22762b
movl %eax, %ebp
movq %r14, %rdi
callq 0x2280b1
leaq 0x1418e3(%rip), %rsi    # 0x368ea9
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x226ec3
movq %rax, %r15
jmp 0x227670
leaq 0x1391d0(%rip), %rdx    # 0x3607b2
movq 0x20(%r14), %rdi
leaq 0x14fc36(%rip), %rsi    # 0x377223
xorl %eax, %eax
callq 0x226ec3
movq %rax, %r15
movq 0x18(%r14), %rdi
callq 0x224044
andq $0x0, 0x18(%r14)
jmp 0x227642
xorl %r15d, %r15d
jmp 0x227670
movswq 0x48(%rax), %rsi
addq %rdx, %rsi
movl 0x70(%rax,%rsi,4), %edx
movl %edx, 0x4(%r14)
cmpl $0x80, %ecx
jb 0x227647
addl $-0xc, %ecx
shrl %ecx
jmp 0x227654
leaq 0x14fc13(%rip), %rsi    # 0x377245
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x226ec3
movq %rax, %r15
pushq $0x1
popq %rbp
jmp 0x227670
movl %ecx, %ecx
leaq 0x14ac30(%rip), %rdx    # 0x372280
movzbl (%rcx,%rdx), %ecx
movl %ecx, (%r14)
movq 0x30(%rax), %rax
movq %rax, 0x10(%r14)
orb $0x10, 0x1(%rax)
movq 0x8(%rax), %rax
movb $0x1, 0x13(%rax)
xorl %r15d, %r15d
xorl %ebp, %ebp
movq %r15, (%rbx)
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq