// File: /workspace/github_c_makefile_star2_O0/skeeto[P]flappy/sqlite3.c
// Function: sqlite3VdbeMemFromBtree
SQLITE_PRIVATE int sqlite3VdbeMemFromBtree(
  BtCursor *pCur,   /* Cursor pointing at record to retrieve. */
  u32 offset,       /* Offset from the start of data to return bytes from. */
  u32 amt,          /* Number of bytes to return. */
  int key,          /* If true, retrieve from the btree key, not data. */
  Mem *pMem         /* OUT: Return data in this Mem structure. */
){
  char *zData;        /* Data from the btree layer */
  u32 available = 0;  /* Number of bytes available on the local btree page */
  int rc = SQLITE_OK; /* Return code */

  assert( sqlite3BtreeCursorIsValid(pCur) );

  /* Note: the calls to BtreeKeyFetch() and DataFetch() below assert() 
  ** that both the BtShared and database handle mutexes are held. */
  assert( (pMem->flags & MEM_RowSet)==0 );
  if( key ){
    zData = (char *)sqlite3BtreeKeyFetch(pCur, &available);
  }else{
    zData = (char *)sqlite3BtreeDataFetch(pCur, &available);
  }
  assert( zData!=0 );

  if( offset+amt<=available ){
    sqlite3VdbeMemRelease(pMem);
    pMem->z = &zData[offset];
    pMem->flags = MEM_Blob|MEM_Ephem;
  }else if( SQLITE_OK==(rc = sqlite3VdbeMemGrow(pMem, amt+2, 0)) ){
    pMem->flags = MEM_Blob|MEM_Dyn|MEM_Term;
    pMem->enc = 0;
    pMem->type = SQLITE_BLOB;
    if( key ){
      rc = sqlite3BtreeKey(pCur, offset, amt, pMem->z);
    }else{
      rc = sqlite3BtreeData(pCur, offset, amt, pMem->z);
    }
    pMem->z[amt] = 0;
    pMem->z[amt+1] = 0;
    if( rc!=SQLITE_OK ){
      sqlite3VdbeMemRelease(pMem);
    }
  }
  pMem->n = (int)amt;

  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movq %r8, -0x20(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x3fad0
movq -0x8(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x3f970
movq %rax, -0x28(%rbp)
jmp 0x3fae1
movq -0x8(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x3fa40
movq %rax, -0x28(%rbp)
movl -0xc(%rbp), %eax
addl -0x10(%rbp), %eax
cmpl -0x2c(%rbp), %eax
ja 0x3fb16
movq -0x20(%rbp), %rdi
callq 0x13210
movq -0x28(%rbp), %rcx
movl -0xc(%rbp), %eax
addq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movw $0x1010, 0x24(%rax)     # imm = 0x1010
jmp 0x3fbc2
movq -0x20(%rbp), %rdi
movl -0x10(%rbp), %esi
addl $0x2, %esi
xorl %edx, %edx
callq 0x149d0
movl %eax, %ecx
movl %ecx, -0x30(%rbp)
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x3fbc0
movq -0x20(%rbp), %rax
movw $0x610, 0x24(%rax)      # imm = 0x610
movq -0x20(%rbp), %rax
movb $0x0, 0x27(%rax)
movq -0x20(%rbp), %rax
movb $0x4, 0x26(%rax)
cmpl $0x0, -0x14(%rbp)
je 0x3fb72
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rcx
callq 0x301d0
movl %eax, -0x30(%rbp)
jmp 0x3fb8c
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rcx
callq 0x17940
movl %eax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x10(%rbp), %ecx
movb $0x0, (%rax,%rcx)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x10(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movb $0x0, (%rax,%rcx)
cmpl $0x0, -0x30(%rbp)
je 0x3fbbe
movq -0x20(%rbp), %rdi
callq 0x13210
jmp 0x3fbc0
jmp 0x3fbc2
movl -0x10(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x20(%rax)
movl -0x30(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)