// File: /workspace/github_c_makefile_star2_O3/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 0x27bc5d
movl $0x4, 0x34(%r12)
movq %r12, %rdi
callq 0x292a18
jmp 0x27bc66
movq 0x18(%r14), %rdi
callq 0x278b63
movl %eax, %ebp
cmpl $0x64, %eax
jne 0x27bcb1
movq 0x78(%r12), %rax
movq (%rax), %rax
movzwl 0x8(%r14), %edx
cmpw %dx, 0x4a(%rax)
jbe 0x27bcf5
movl 0x70(%rax,%rdx,4), %ecx
cmpl $0xb, %ecx
ja 0x27bd29
cmpl $0x7, %ecx
leaq 0x15b189(%rip), %rax    # 0x3d6e20
leaq 0x14c302(%rip), %rsi    # 0x3c7fa0
cmoveq %rax, %rsi
testl %ecx, %ecx
leaq 0x1446f1(%rip), %rdx    # 0x3c039c
cmovneq %rsi, %rdx
jmp 0x27bcfc
movq 0x18(%r14), %rdi
testq %rdi, %rdi
je 0x27bd24
callq 0x277e46
movq $0x0, 0x18(%r14)
movq 0x20(%r14), %r14
testl %eax, %eax
je 0x27bd48
movl %eax, %ebp
movq %r14, %rdi
callq 0x27c968
leaq 0x14cdc9(%rip), %rsi    # 0x3c8aa9
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x27b56a
movq %rax, %r15
jmp 0x27bd8f
leaq 0x1446a0(%rip), %rdx    # 0x3c039c
movq 0x20(%r14), %rdi
leaq 0x15b0fc(%rip), %rsi    # 0x3d6e03
xorl %eax, %eax
callq 0x27b56a
movq %rax, %r15
movq 0x18(%r14), %rdi
callq 0x277e46
movq $0x0, 0x18(%r14)
jmp 0x27bd5f
xorl %r15d, %r15d
jmp 0x27bd8f
movswq 0x48(%rax), %rsi
addq %rdx, %rsi
movl 0x70(%rax,%rsi,4), %edx
movl %edx, 0x4(%r14)
cmpl $0x80, %ecx
jb 0x27bd66
addl $-0xc, %ecx
shrl %ecx
jmp 0x27bd73
leaq 0x15b0d6(%rip), %rsi    # 0x3d6e25
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x27b56a
movq %rax, %r15
movl $0x1, %ebp
jmp 0x27bd8f
movl %ecx, %ecx
leaq 0x156101(%rip), %rdx    # 0x3d1e70
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