LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: vdbeMemClearExternAndSetNull
static SQLITE_NOINLINE void vdbeMemClearExternAndSetNull(Mem *p){
  assert( p->db==0 || sqlite3_mutex_held(p->db->mutex) );
  assert( VdbeMemDynamic(p) );
  if( p->flags&MEM_Agg ){
    sqlite3VdbeMemFinalize(p, p->u.pDef);
    assert( (p->flags & MEM_Agg)==0 );
    testcase( p->flags & MEM_Dyn );
  }
  if( p->flags&MEM_Dyn ){
    assert( (p->flags&MEM_RowSet)==0 );
    assert( p->xDel!=SQLITE_DYNAMIC && p->xDel!=0 );
    p->xDel((void *)p->z);
  }else if( p->flags&MEM_RowSet ){
    sqlite3RowSetClear(p->u.pRowSet);
  }else if( p->flags&MEM_Frame ){
    VdbeFrame *pFrame = p->u.pFrame;
    pFrame->pParent = pFrame->v->pDelFrame;
    pFrame->v->pDelFrame = pFrame;
  }
  p->flags = MEM_Null;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x8(%rdi), %eax
btl $0xd, %eax
jae 0x26632
movq (%rbx), %rsi
movq %rbx, %rdi
callq 0x2667b
movzwl 0x8(%rbx), %eax
movzwl %ax, %eax
btl $0xa, %eax
jb 0x2665d
testb $0x20, %al
jne 0x26666
testb $0x40, %al
je 0x2666e
movq (%rbx), %rax
movq (%rax), %rcx
movq 0xf8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq %rax, 0xf8(%rcx)
jmp 0x2666e
movq 0x10(%rbx), %rdi
callq *0x30(%rbx)
jmp 0x2666e
movq (%rbx), %rdi
callq 0x26719
movw $0x1, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: sqlite3VdbeMemFinalize
SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem *pMem, FuncDef *pFunc){
  int rc = SQLITE_OK;
  if( ALWAYS(pFunc && pFunc->xFinalize) ){
    sqlite3_context ctx;
    Mem t;
    assert( (pMem->flags & MEM_Null)!=0 || pFunc==pMem->u.pDef );
    assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
    memset(&ctx, 0, sizeof(ctx));
    memset(&t, 0, sizeof(t));
    t.flags = MEM_Null;
    t.db = pMem->db;
    ctx.pOut = &t;
    ctx.pMem = pMem;
    ctx.pFunc = pFunc;
    pFunc->xFinalize(&ctx); /* IMP: R-24505-23230 */
    assert( (pMem->flags & MEM_Dyn)==0 );
    if( pMem->szMalloc>0 ) sqlite3DbFree(pMem->db, pMem->zMalloc);
    memcpy(pMem, &t, sizeof(t));
    rc = ctx.isError;
  }
  return rc;
}

// Assembly:
xorl %eax, %eax
testq %rsi, %rsi
je 0x26718
movq 0x28(%rsi), %rcx
testq %rcx, %rcx
je 0x26718
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq -0x78(%rbp), %rdi
movups %xmm0, 0x18(%rdi)
movups %xmm0, 0x28(%rdi)
leaq -0x40(%rbp), %rax
movaps %xmm0, (%rax)
andq $0x0, 0x30(%rax)
movaps %xmm0, 0x10(%rax)
movaps %xmm0, 0x20(%rax)
movw $0x1, 0x8(%rax)
movq 0x28(%rbx), %rdx
movq %rdx, 0x28(%rax)
movq %rax, (%rdi)
movq %rbx, 0x10(%rdi)
movq %rsi, 0x8(%rdi)
callq *%rcx
cmpl $0x0, 0x20(%rbx)
jle 0x266f0
movq 0x18(%rbx), %rsi
movq 0x28(%rbx), %rdi
callq 0xb856
movq -0x10(%rbp), %rax
movq %rax, 0x30(%rbx)
movaps -0x40(%rbp), %xmm0
movaps -0x30(%rbp), %xmm1
movaps -0x20(%rbp), %xmm2
movups %xmm2, 0x20(%rbx)
movups %xmm1, 0x10(%rbx)
movups %xmm0, (%rbx)
movl -0x54(%rbp), %eax
addq $0x78, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: sqlite3VdbeMemGrow
int sqlite3VdbeMemGrow(Mem *pMem, int n, int bPreserve){
  assert( sqlite3VdbeCheckMemInvariants(pMem) );
  assert( (pMem->flags&MEM_RowSet)==0 );

  /* If the bPreserve flag is set to true, then the memory cell must already
  ** contain a valid string or blob value.  */
  assert( bPreserve==0 || pMem->flags&(MEM_Blob|MEM_Str) );
  testcase( bPreserve && pMem->z==0 );

  assert( pMem->szMalloc==0
       || pMem->szMalloc==sqlite3DbMallocSize(pMem->db, pMem->zMalloc) );
  if( pMem->szMalloc<n ){
    if( n<32 ) n = 32;
    if( bPreserve && pMem->szMalloc>0 && pMem->z==pMem->zMalloc ){
      pMem->z = pMem->zMalloc = sqlite3DbReallocOrFree(pMem->db, pMem->z, n);
      bPreserve = 0;
    }else{
      if( pMem->szMalloc>0 ) sqlite3DbFree(pMem->db, pMem->zMalloc);
      pMem->zMalloc = sqlite3DbMallocRaw(pMem->db, n);
    }
    if( pMem->zMalloc==0 ){
      sqlite3VdbeMemSetNull(pMem);
      pMem->z = 0;
      pMem->szMalloc = 0;
      return SQLITE_NOMEM;
    }else{
      pMem->szMalloc = sqlite3DbMallocSize(pMem->db, pMem->zMalloc);
    }
  }

  if( bPreserve && pMem->z && pMem->z!=pMem->zMalloc ){
    memcpy(pMem->zMalloc, pMem->z, pMem->n);
  }
  if( (pMem->flags&MEM_Dyn)!=0 ){
    assert( pMem->xDel!=0 && pMem->xDel!=SQLITE_DYNAMIC );
    pMem->xDel((void *)(pMem->z));
  }

  pMem->z = pMem->zMalloc;
  pMem->flags &= ~(MEM_Dyn|MEM_Ephem|MEM_Static);
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r14d
movq %rdi, %rbx
movl 0x20(%rdi), %eax
cmpl %esi, %eax
jge 0x267e7
cmpl $0x21, %esi
pushq $0x20
popq %r15
cmovgel %esi, %r15d
testl %r14d, %r14d
sete %cl
testl %eax, %eax
setle %dl
orb %cl, %dl
jne 0x267af
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rax
cmpq %rax, %rsi
jne 0x267b7
movq 0x28(%rbx), %rdi
movl %r15d, %edx
callq 0x2684f
movq %rax, 0x18(%rbx)
movq %rax, 0x10(%rbx)
xorl %r14d, %r14d
jmp 0x267d3
testl %eax, %eax
jle 0x267c3
movq 0x18(%rbx), %rax
movq 0x28(%rbx), %rdi
movq %rax, %rsi
callq 0xb856
movq 0x28(%rbx), %rdi
movl %r15d, %esi
callq 0x132c5
movq %rax, 0x18(%rbx)
testq %rax, %rax
je 0x26839
movq 0x28(%rbx), %rdi
movq %rax, %rsi
callq 0x19b07
movl %eax, 0x20(%rbx)
testl %r14d, %r14d
je 0x26807
movq 0x10(%rbx), %rsi
testq %rsi, %rsi
je 0x26807
movq 0x18(%rbx), %rdi
cmpq %rdi, %rsi
je 0x26807
movslq 0xc(%rbx), %rdx
callq 0xa3b0
movl 0x8(%rbx), %eax
btl $0xa, %eax
jae 0x2681b
movq 0x10(%rbx), %rdi
callq *0x30(%rbx)
movzwl 0x8(%rbx), %eax
movq 0x18(%rbx), %rcx
movq %rcx, 0x10(%rbx)
andl $0xe3ff, %eax           # imm = 0xE3FF
movw %ax, 0x8(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x111fb
andq $0x0, 0x10(%rbx)
andl $0x0, 0x20(%rbx)
pushq $0x7
popq %rax
jmp 0x2682e
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: valueToText
static SQLITE_NOINLINE const void *valueToText(sqlite3_value* pVal, u8 enc){
  assert( pVal!=0 );
  assert( pVal->db==0 || sqlite3_mutex_held(pVal->db->mutex) );
  assert( (enc&3)==(enc&~SQLITE_UTF16_ALIGNED) );
  assert( (pVal->flags & MEM_RowSet)==0 );
  assert( (pVal->flags & (MEM_Null))==0 );
  if( pVal->flags & (MEM_Blob|MEM_Str) ){
    pVal->flags |= MEM_Str;
    if( pVal->flags & MEM_Zero ){
      sqlite3VdbeMemExpandBlob(pVal);
    }
    if( pVal->enc != (enc & ~SQLITE_UTF16_ALIGNED) ){
      sqlite3VdbeChangeEncoding(pVal, enc & ~SQLITE_UTF16_ALIGNED);
    }
    if( (enc & SQLITE_UTF16_ALIGNED)!=0 && 1==(1&SQLITE_PTR_TO_INT(pVal->z)) ){
      assert( (pVal->flags & (MEM_Ephem|MEM_Static))!=0 );
      if( sqlite3VdbeMemMakeWriteable(pVal)!=SQLITE_OK ){
        return 0;
      }
    }
    sqlite3VdbeMemNulTerminate(pVal); /* IMP: R-31275-44060 */
  }else{
    sqlite3VdbeMemStringify(pVal, enc, 0);
    assert( 0==(1&SQLITE_PTR_TO_INT(pVal->z)) );
  }
  assert(pVal->enc==(enc & ~SQLITE_UTF16_ALIGNED) || pVal->db==0
              || pVal->db->mallocFailed );
  if( pVal->enc==(enc & ~SQLITE_UTF16_ALIGNED) ){
    return pVal->z;
  }else{
    return 0;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
movzwl 0x8(%rdi), %eax
testb $0x12, %al
je 0x2690b
movl %eax, %ecx
orl $0x2, %ecx
movw %cx, 0x8(%rbx)
btl $0xe, %eax
jae 0x268d2
movq %rbx, %rdi
callq 0x10b59
movzbl 0xa(%rbx), %eax
movzbl %r14b, %esi
andl $-0x9, %esi
cmpl %eax, %esi
je 0x268e9
movq %rbx, %rdi
callq 0x26930
testb $0x8, %r14b
je 0x26901
testb $0x1, 0x10(%rbx)
je 0x26901
movq %rbx, %rdi
callq 0x10dea
testl %eax, %eax
jne 0x26929
movq %rbx, %rdi
callq 0x26950
jmp 0x26919
movzbl %r14b, %esi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x2696b
andb $-0x9, %r14b
cmpb %r14b, 0xa(%rbx)
jne 0x26929
movq 0x10(%rbx), %rax
jmp 0x2692b
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: sqlite3VdbeMemStringify
SQLITE_PRIVATE int sqlite3VdbeMemStringify(Mem *pMem, u8 enc, u8 bForce){
  int fg = pMem->flags;
  const int nByte = 32;

  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
  assert( !(fg&MEM_Zero) );
  assert( !(fg&(MEM_Str|MEM_Blob)) );
  assert( fg&(MEM_Int|MEM_Real) );
  assert( (pMem->flags&MEM_RowSet)==0 );
  assert( EIGHT_BYTE_ALIGNMENT(pMem) );


  if( sqlite3VdbeMemClearAndResize(pMem, nByte) ){
    return SQLITE_NOMEM;
  }

  /* For a Real or Integer, use sqlite3_snprintf() to produce the UTF-8
  ** string representation of the value. Then, if the required encoding
  ** is UTF-16le or UTF-16be do a translation.
  ** 
  ** FIX ME: It would be better if sqlite3_snprintf() could do UTF-16.
  */
  if( fg & MEM_Int ){
    sqlite3_snprintf(nByte, pMem->z, "%lld", pMem->u.i);
  }else{
    assert( fg & MEM_Real );
    sqlite3_snprintf(nByte, pMem->z, "%!.15g", pMem->u.r);
  }
  pMem->n = sqlite3Strlen30(pMem->z);
  pMem->enc = SQLITE_UTF8;
  pMem->flags |= MEM_Str|MEM_Term;
  if( bForce ) pMem->flags &= ~(MEM_Int|MEM_Real);
  sqlite3VdbeChangeEncoding(pMem, enc);
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %r15d
movl %esi, %r14d
movq %rdi, %rbx
movzwl 0x8(%rdi), %r12d
pushq $0x20
popq %rsi
callq 0x26f9a
testl %eax, %eax
je 0x26995
pushq $0x7
popq %rax
jmp 0x269ff
movq 0x10(%rbx), %rsi
testb $0x4, %r12b
jne 0x269b6
movsd (%rbx), %xmm0
leaq 0x45c1b(%rip), %rdx     # 0x6c5c5
pushq $0x20
popq %rdi
movb $0x1, %al
callq 0xa400
jmp 0x269ca
movq (%rbx), %rcx
leaq 0x46d22(%rip), %rdx     # 0x6d6e2
pushq $0x20
popq %rdi
xorl %eax, %eax
callq 0xa400
movq 0x10(%rbx), %rdi
callq 0xb080
movl %eax, 0xc(%rbx)
movb $0x1, 0xa(%rbx)
movl $0x202, %eax            # imm = 0x202
orl 0x8(%rbx), %eax
movl %eax, %ecx
andl $-0xd, %ecx
testb %r15b, %r15b
cmovel %eax, %ecx
movw %cx, 0x8(%rbx)
movzbl %r14b, %esi
movq %rbx, %rdi
callq 0x26930
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: vdbeMemAddTerminator
static SQLITE_NOINLINE int vdbeMemAddTerminator(Mem *pMem){
  if( sqlite3VdbeMemGrow(pMem, pMem->n+2, 1) ){
    return SQLITE_NOMEM;
  }
  pMem->z[pMem->n] = 0;
  pMem->z[pMem->n+1] = 0;
  pMem->flags |= MEM_Term;
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0xc(%rdi), %esi
addl $0x2, %esi
pushq $0x1
popq %rdx
callq 0x26758
testl %eax, %eax
je 0x26f76
pushq $0x7
popq %rax
jmp 0x26f93
movq 0x10(%rbx), %rcx
movslq 0xc(%rbx), %rdx
xorl %eax, %eax
movb %al, (%rcx,%rdx)
movq 0x10(%rbx), %rcx
movslq 0xc(%rbx), %rdx
movb %al, 0x1(%rcx,%rdx)
orb $0x2, 0x9(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: sqlite3VdbeMemClearAndResize
SQLITE_PRIVATE int sqlite3VdbeMemClearAndResize(Mem *pMem, int szNew){
  assert( szNew>0 );
  assert( (pMem->flags & MEM_Dyn)==0 || pMem->szMalloc==0 );
  if( pMem->szMalloc<szNew ){
    return sqlite3VdbeMemGrow(pMem, szNew, 0);
  }
  assert( (pMem->flags & MEM_Dyn)==0 );
  pMem->z = pMem->zMalloc;
  pMem->flags &= (MEM_Null|MEM_Int|MEM_Real);
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpl %esi, 0x20(%rdi)
jge 0x26fab
xorl %edx, %edx
popq %rbp
jmp 0x26758
movq 0x18(%rdi), %rax
movq %rax, 0x10(%rdi)
andw $0xd, 0x8(%rdi)
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: out2Prerelease
static Mem *out2Prerelease(Vdbe *p, VdbeOp *pOp){
  Mem *pOut;
  assert( pOp->p2>0 );
  assert( pOp->p2<=(p->nMem-p->nCursor) );
  pOut = &p->aMem[pOp->p2];
  memAboutToChange(p, pOut);
  if( VdbeMemDynamic(pOut) ){
    return out2PrereleaseWithClear(pOut);
  }else{
    pOut->flags = MEM_Int;
    return pOut;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq 0x10(%rdi), %rax
movslq 0x8(%rsi), %rcx
imulq $0x38, %rcx, %rcx
leaq (%rax,%rcx), %rbx
movzwl 0x8(%rax,%rcx), %eax
testw $0x2460, %ax            # imm = 0x2460
je 0x2eaea
movq %rbx, %rdi
callq 0x30931
jmp 0x2eaf0
movw $0x4, 0x8(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: sqlite3VdbeMemShallowCopy
SQLITE_PRIVATE void sqlite3VdbeMemShallowCopy(Mem *pTo, const Mem *pFrom, int srcType){
  assert( (pFrom->flags & MEM_RowSet)==0 );
  assert( pTo->db==pFrom->db );
  if( VdbeMemDynamic(pTo) ){ vdbeClrCopy(pTo,pFrom,srcType); return; }
  memcpy(pTo, pFrom, MEMCELLSIZE);
  if( (pFrom->flags&MEM_Static)==0 ){
    pTo->flags &= ~(MEM_Dyn|MEM_Static|MEM_Ephem);
    assert( srcType==MEM_Ephem || srcType==MEM_Static );
    pTo->flags |= srcType;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movzwl 0x8(%rdi), %eax
testw $0x2460, %ax            # imm = 0x2460
je 0x2eb36
popq %rbp
jmp 0x3094f
movq 0x10(%rsi), %rax
movq %rax, 0x10(%rdi)
movups (%rsi), %xmm0
movups %xmm0, (%rdi)
testb $0x8, 0x9(%rsi)
jne 0x2eb58
movl $0xffffe3ff, %eax       # imm = 0xFFFFE3FF
andl 0x8(%rdi), %eax
orl %edx, %eax
movw %ax, 0x8(%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: numericType
static u16 numericType(Mem *pMem){
  if( pMem->flags & (MEM_Int|MEM_Real) ){
    return pMem->flags & (MEM_Int|MEM_Real);
  }
  if( pMem->flags & (MEM_Str|MEM_Blob) ){
    return computeNumericType(pMem);
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movzwl 0x8(%rdi), %ecx
movl %ecx, %eax
andl $0xc, %eax
je 0x2ebad
popq %rbp
retq
testb $0x12, %cl
je 0x2ebb8
popq %rbp
jmp 0x3097d
xorl %eax, %eax
jmp 0x2ebab
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: applyAffinity
static void applyAffinity(
  Mem *pRec,          /* The value to apply affinity to */
  char affinity,      /* The affinity to be applied */
  u8 enc              /* Use this text encoding */
){
  if( affinity>=SQLITE_AFF_NUMERIC ){
    assert( affinity==SQLITE_AFF_INTEGER || affinity==SQLITE_AFF_REAL
             || affinity==SQLITE_AFF_NUMERIC );
    if( (pRec->flags & MEM_Int)==0 ){
      if( (pRec->flags & MEM_Real)==0 ){
        if( pRec->flags & MEM_Str ) applyNumericAffinity(pRec,1);
      }else{
        sqlite3VdbeIntegerAffinity(pRec);
      }
    }
  }else if( affinity==SQLITE_AFF_TEXT ){
    /* Only attempt the conversion to TEXT if there is an integer or real
    ** representation (blob and NULL do not get converted) but no string
    ** representation.
    */
    if( 0==(pRec->flags&MEM_Str) && (pRec->flags&(MEM_Real|MEM_Int)) ){
      sqlite3VdbeMemStringify(pRec, enc, 1);
    }
    pRec->flags &= ~(MEM_Real|MEM_Int);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpb $0x43, %sil
jl 0x2ecda
movzwl 0x8(%rbx), %eax
testb $0x4, %al
jne 0x2ed11
testb $0x8, %al
jne 0x2ed18
testb $0x2, %al
je 0x2ed11
pushq $0x1
popq %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x12ca4
cmpb $0x42, %sil
jne 0x2ed11
movzwl 0x8(%rbx), %eax
movl %eax, %ecx
andl $0x2, %ecx
shrl %ecx
testb $0xc, %al
sete %sil
orb %cl, %sil
jne 0x2ed08
movzbl %dl, %esi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x2696b
movzwl 0x8(%rbx), %eax
andl $0xfff3, %eax           # imm = 0xFFF3
movw %ax, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2ec15
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: sqlite3VdbeMemCast
SQLITE_PRIVATE void sqlite3VdbeMemCast(Mem *pMem, u8 aff, u8 encoding){
  if( pMem->flags & MEM_Null ) return;
  switch( aff ){
    case SQLITE_AFF_BLOB: {   /* Really a cast to BLOB */
      if( (pMem->flags & MEM_Blob)==0 ){
        sqlite3ValueApplyAffinity(pMem, SQLITE_AFF_TEXT, encoding);
        assert( pMem->flags & MEM_Str || pMem->db->mallocFailed );
        MemSetTypeFlag(pMem, MEM_Blob);
      }else{
        pMem->flags &= ~(MEM_TypeMask&~MEM_Blob);
      }
      break;
    }
    case SQLITE_AFF_NUMERIC: {
      sqlite3VdbeMemNumerify(pMem);
      break;
    }
    case SQLITE_AFF_INTEGER: {
      sqlite3VdbeMemIntegerify(pMem);
      break;
    }
    case SQLITE_AFF_REAL: {
      sqlite3VdbeMemRealify(pMem);
      break;
    }
    default: {
      assert( aff==SQLITE_AFF_TEXT );
      assert( MEM_Str==(MEM_Blob>>3) );
      pMem->flags |= (pMem->flags&MEM_Blob)>>3;
      sqlite3ValueApplyAffinity(pMem, SQLITE_AFF_TEXT, encoding);
      assert( pMem->flags & MEM_Str || pMem->db->mallocFailed );
      pMem->flags &= ~(MEM_Int|MEM_Real|MEM_Blob|MEM_Zero);
      break;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movzwl 0x8(%rdi), %eax
testb $0x1, %al
jne 0x2edf5
movq %rdi, %rbx
movzbl %sil, %ecx
addl $-0x41, %ecx
cmpl $0x4, %ecx
ja 0x2edc8
leaq 0x3996e(%rip), %rsi     # 0x686e4
movslq (%rsi,%rcx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
testb $0x10, %al
jne 0x2edec
movzbl %dl, %edx
pushq $0x42
popq %rsi
movq %rbx, %rdi
callq 0x2ecaa
movl $0xffffbe00, %eax       # imm = 0xFFFFBE00
andl 0x8(%rbx), %eax
orl $0x10, %eax
jmp 0x2edf1
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2ec83
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x309c9
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2ed26
movl %eax, %ecx
shrl $0x3, %ecx
andl $0x2, %ecx
orl %eax, %ecx
movw %cx, 0x8(%rbx)
movzbl %dl, %edx
pushq $0x42
popq %rsi
movq %rbx, %rdi
callq 0x2ecaa
andw $0xbfe3, 0x8(%rbx)      # imm = 0xBFE3
jmp 0x2edf5
andl $0xfe10, %eax           # imm = 0xFE10
movw %ax, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: sqlite3BtreeCursor
SQLITE_PRIVATE int sqlite3BtreeCursor(
  Btree *p,                                   /* The btree */
  int iTable,                                 /* Root page of table to open */
  int wrFlag,                                 /* 1 to write. 0 read-only */
  struct KeyInfo *pKeyInfo,                   /* First arg to xCompare() */
  BtCursor *pCur                              /* Write new cursor here */
){
  int rc;
  if( iTable<1 ){
    rc = SQLITE_CORRUPT_BKPT;
  }else{
    sqlite3BtreeEnter(p);
    rc = btreeCursor(p, iTable, wrFlag, pKeyInfo, pCur);
    sqlite3BtreeLeave(p);
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testl %esi, %esi
jle 0x2f338
movq %r8, %r14
movl %edx, %r13d
movl %esi, %r15d
movq %rdi, %rbx
movq %rcx, -0x30(%rbp)
callq 0xf01a
movq 0x8(%rbx), %r12
testl %r13d, %r13d
je 0x2f2ba
cmpq $0x0, 0x80(%r12)
jne 0x2f2ba
movl 0x30(%r12), %edi
callq 0x1f7a9
movq %rax, 0x80(%r12)
testq %rax, %rax
je 0x2f358
andq $0x0, (%rax)
addq $0x4, 0x80(%r12)
cmpl $0x1, %r15d
jne 0x2f2cd
xorl %r15d, %r15d
cmpl $0x0, 0x3c(%r12)
setne %r15b
testl %r13d, %r13d
sete %al
movl %r15d, 0x48(%r14)
movb $-0x1, 0x58(%r14)
movq -0x30(%rbp), %rcx
movq %rcx, 0x60(%r14)
movq %rbx, (%r14)
movq %r12, 0x8(%r14)
setne 0x54(%r14)
addb %al, %al
movb %al, 0x55(%r14)
addq $0x10, %r12
movq %r12, %rax
movq (%rax), %rax
testq %rax, %rax
je 0x2f31a
cmpl %r15d, 0x48(%rax)
jne 0x2f314
orb $0x20, 0x54(%rax)
orb $0x20, 0x54(%r14)
addq $0x10, %rax
jmp 0x2f2fd
movq (%r12), %rax
movq %rax, 0x10(%r14)
movq %r14, (%r12)
movb $0x0, 0x56(%r14)
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x1034d
jmp 0x2f346
movl $0xe786, %edi           # imm = 0xE786
callq 0x1ec07
pushq $0xb
popq %r14
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x7
popq %r14
jmp 0x2f32e
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: sqlite3BtreeNext
SQLITE_PRIVATE int sqlite3BtreeNext(BtCursor *pCur, int *pRes){
  MemPage *pPage;
  assert( cursorHoldsMutex(pCur) );
  assert( pRes!=0 );
  assert( *pRes==0 || *pRes==1 );
  assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );
  pCur->info.nSize = 0;
  pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl);
  *pRes = 0;
  if( pCur->eState!=CURSOR_VALID ) return btreeNext(pCur, pRes);
  pPage = pCur->apPage[pCur->iPage];
  if( (++pCur->aiIdx[pCur->iPage])>=pPage->nCell ){
    pCur->aiIdx[pCur->iPage]--;
    return btreeNext(pCur, pRes);
  }
  if( pPage->leaf ){
    return SQLITE_OK;
  }else{
    return moveToLeftmost(pCur);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
andw $0x0, 0x36(%rdi)
andb $-0x7, 0x54(%rdi)
andl $0x0, (%rsi)
cmpb $0x1, 0x56(%rdi)
jne 0x2fac2
movsbq 0x58(%rdi), %rax
movq 0x98(%rdi,%rax,8), %rcx
movzwl 0x70(%rdi,%rax,2), %edx
leal 0x1(%rdx), %r8d
movw %r8w, 0x70(%rdi,%rax,2)
cmpw 0x12(%rcx), %r8w
jae 0x2fabd
cmpb $0x0, 0x5(%rcx)
je 0x2fac8
xorl %eax, %eax
popq %rbp
retq
movw %dx, 0x70(%rdi,%rax,2)
popq %rbp
jmp 0x318f7
popq %rbp
jmp 0x319ee
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: sqlite3BtreePrevious
SQLITE_PRIVATE int sqlite3BtreePrevious(BtCursor *pCur, int *pRes){
  assert( cursorHoldsMutex(pCur) );
  assert( pRes!=0 );
  assert( *pRes==0 || *pRes==1 );
  assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );
  *pRes = 0;
  pCur->curFlags &= ~(BTCF_AtLast|BTCF_ValidOvfl|BTCF_ValidNKey);
  pCur->info.nSize = 0;
  if( pCur->eState!=CURSOR_VALID
   || pCur->aiIdx[pCur->iPage]==0
   || pCur->apPage[pCur->iPage]->leaf==0
  ){
    return btreePrevious(pCur, pRes);
  }
  pCur->aiIdx[pCur->iPage]--;
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
andl $0x0, (%rsi)
andb $-0xf, 0x54(%rdi)
andw $0x0, 0x36(%rdi)
cmpb $0x1, 0x56(%rdi)
jne 0x2fb0c
movsbq 0x58(%rdi), %rax
movzwl 0x70(%rdi,%rax,2), %ecx
testw %cx, %cx
je 0x2fb0c
movq 0x98(%rdi,%rax,8), %rdx
cmpb $0x0, 0x5(%rdx)
je 0x2fb0c
decl %ecx
movw %cx, 0x70(%rdi,%rax,2)
xorl %eax, %eax
popq %rbp
retq
popq %rbp
jmp 0x31a4c
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: sqlite3VdbeRecordUnpack
SQLITE_PRIVATE void sqlite3VdbeRecordUnpack(
  KeyInfo *pKeyInfo,     /* Information about the record format */
  int nKey,              /* Size of the binary record */
  const void *pKey,      /* The binary record */
  UnpackedRecord *p      /* Populate this structure before returning. */
){
  const unsigned char *aKey = (const unsigned char *)pKey;
  int d; 
  u32 idx;                        /* Offset in aKey[] to read from */
  u16 u;                          /* Unsigned loop counter */
  u32 szHdr;
  Mem *pMem = p->aMem;

  p->default_rc = 0;
  assert( EIGHT_BYTE_ALIGNMENT(pMem) );
  idx = getVarint32(aKey, szHdr);
  d = szHdr;
  u = 0;
  while( idx<szHdr && d<=nKey ){
    u32 serial_type;

    idx += getVarint32(&aKey[idx], serial_type);
    pMem->enc = pKeyInfo->enc;
    pMem->db = pKeyInfo->db;
    /* pMem->flags = 0; // sqlite3VdbeSerialGet() will set this for us */
    pMem->szMalloc = 0;
    d += sqlite3VdbeSerialGet(&aKey[d], serial_type, pMem);
    pMem++;
    if( (++u)>=p->nField ) break;
  }
  assert( u<=pKeyInfo->nField + 1 );
  p->nField = u;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %esi, -0x2c(%rbp)
movq %rdi, -0x48(%rbp)
movq 0x8(%rcx), %r13
movq %rcx, -0x38(%rbp)
movb $0x0, 0x12(%rcx)
movsbl (%rdx), %r14d
testl %r14d, %r14d
movq %rdx, -0x40(%rbp)
js 0x2fbab
pushq $0x1
popq %rbx
jmp 0x2fbc0
leaq -0x4c(%rbp), %r14
movq %rdx, %rdi
movq %r14, %rsi
callq 0x2eef1
movzbl %al, %ebx
movl (%r14), %r14d
xorl %r15d, %r15d
movl %r14d, %r12d
cmpl %r14d, %ebx
jae 0x2fc38
cmpl -0x2c(%rbp), %r12d
jg 0x2fc38
movl %ebx, %edi
movq -0x40(%rbp), %r8
movsbl (%r8,%rdi), %esi
testl %esi, %esi
js 0x2fbe5
pushq $0x1
popq %rax
jmp 0x2fbfb
addq %r8, %rdi
leaq -0x30(%rbp), %rsi
callq 0x2eef1
movq -0x40(%rbp), %r8
movzbl %al, %eax
movl -0x30(%rbp), %esi
movq -0x48(%rbp), %rdx
movb 0x4(%rdx), %cl
movb %cl, 0xa(%r13)
movq 0x10(%rdx), %rcx
movq %rcx, 0x28(%r13)
andl $0x0, 0x20(%r13)
addl %eax, %ebx
movslq %r12d, %rdi
addq %r8, %rdi
movq %r13, %rdx
callq 0x2efaf
addl %eax, %r12d
addq $0x38, %r13
incl %r15d
movq -0x38(%rbp), %rax
cmpw 0x10(%rax), %r15w
jb 0x2fbc6
movq -0x38(%rbp), %rax
movw %r15w, 0x10(%rax)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: sqlite3VdbeCursorRestore
SQLITE_PRIVATE int sqlite3VdbeCursorRestore(VdbeCursor *p){
  assert( p->eCurType==CURTYPE_BTREE );
  if( sqlite3BtreeCursorHasMoved(p->uc.pCursor) ){
    return handleMovedCursor(p);
  }
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x10(%rdi), %rax
cmpb $0x1, 0x56(%rax)
jne 0x30481
xorl %eax, %eax
popq %rbp
retq
popq %rbp
jmp 0x30be6
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: sqlite3VdbeMemSetRowSet
SQLITE_PRIVATE void sqlite3VdbeMemSetRowSet(Mem *pMem){
  sqlite3 *db = pMem->db;
  assert( db!=0 );
  assert( (pMem->flags & MEM_RowSet)==0 );
  sqlite3VdbeMemRelease(pMem);
  pMem->zMalloc = sqlite3DbMallocRaw(db, 64);
  if( db->mallocFailed ){
    pMem->flags = MEM_Null;
    pMem->szMalloc = 0;
  }else{
    assert( pMem->zMalloc );
    pMem->szMalloc = sqlite3DbMallocSize(db, pMem->zMalloc);
    pMem->u.pRowSet = sqlite3RowSetInit(db, pMem->zMalloc, pMem->szMalloc);
    assert( pMem->u.pRowSet!=0 );
    pMem->flags = MEM_RowSet;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x28(%rdi), %r14
callq 0x10afb
pushq $0x40
popq %rsi
movq %r14, %rdi
callq 0x132c5
movq %rax, 0x18(%rbx)
cmpb $0x0, 0x51(%r14)
je 0x3078c
andl $0x0, 0x20(%rbx)
movw $0x1, %ax
jmp 0x307dd
movq %r14, %rdi
movq %rax, %rsi
callq 0x19b07
movl %eax, 0x20(%rbx)
movq 0x18(%rbx), %rcx
andq $0x0, (%rcx)
movq %r14, 0x8(%rcx)
andq $0x0, 0x28(%rcx)
leaq 0x38(%rcx), %rdx
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rcx)
movq %rdx, 0x20(%rcx)
movl %eax, %eax
addq $-0x38, %rax
pushq $0x18
popq %rsi
xorl %edx, %edx
divq %rsi
movw %ax, 0x30(%rcx)
movw $0x1, 0x32(%rcx)
andl $0x0, 0x34(%rcx)
movq %rcx, (%rbx)
movw $0x20, %ax
movw %ax, 0x8(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: vdbeCompareMemString
static int vdbeCompareMemString(
  const Mem *pMem1,
  const Mem *pMem2,
  const CollSeq *pColl,
  u8 *prcErr                      /* If an OOM occurs, set to SQLITE_NOMEM */
){
  if( pMem1->enc==pColl->enc ){
    /* The strings are already in the correct encoding.  Call the
     ** comparison function directly */
    return pColl->xCmp(pColl->pUser,pMem1->n,pMem1->z,pMem2->n,pMem2->z);
  }else{
    int rc;
    const void *v1, *v2;
    int n1, n2;
    Mem c1;
    Mem c2;
    sqlite3VdbeMemInit(&c1, pMem1->db, MEM_Null);
    sqlite3VdbeMemInit(&c2, pMem1->db, MEM_Null);
    sqlite3VdbeMemShallowCopy(&c1, pMem1, MEM_Ephem);
    sqlite3VdbeMemShallowCopy(&c2, pMem2, MEM_Ephem);
    v1 = sqlite3ValueText((sqlite3_value*)&c1, pColl->enc);
    n1 = v1==0 ? 0 : c1.n;
    v2 = sqlite3ValueText((sqlite3_value*)&c2, pColl->enc);
    n2 = v2==0 ? 0 : c2.n;
    rc = pColl->xCmp(pColl->pUser, n1, v1, n2, v2);
    sqlite3VdbeMemRelease(&c1);
    sqlite3VdbeMemRelease(&c2);
    if( (v1==0 || v2==0) && prcErr ) *prcErr = SQLITE_NOMEM;
    return rc;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, %r14
movq %rsi, %r13
movq %rdi, %rax
movb 0xa(%rdi), %dl
cmpb 0x8(%r14), %dl
jne 0x30a86
movq 0x10(%r14), %rdi
movq 0x18(%r14), %r9
movl 0xc(%rax), %esi
movq 0x10(%rax), %rdx
movl 0xc(%r13), %ecx
movq 0x10(%r13), %r8
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%r9
movq %rcx, -0x38(%rbp)
movq 0x28(%rax), %rcx
movw $0x1, %dx
leaq -0x70(%rbp), %rbx
movw %dx, 0x8(%rbx)
movq %rcx, 0x28(%rbx)
andl $0x0, 0x20(%rbx)
leaq -0xa8(%rbp), %r12
movw %dx, 0x8(%r12)
movq %rcx, 0x28(%r12)
andl $0x0, 0x20(%r12)
movq %rbx, %rdi
movq %rax, %rsi
movl $0x1000, %edx           # imm = 0x1000
callq 0x2eb22
movq %r12, %rdi
movq %r13, %rsi
movl $0x1000, %edx           # imm = 0x1000
callq 0x2eb22
movzbl 0x8(%r14), %esi
movq %rbx, %rdi
callq 0x10cf3
movq %rax, %r13
xorl %ebx, %ebx
movl $0x0, %r15d
testq %rax, %rax
sete -0x2a(%rbp)
je 0x30aff
movl -0x64(%rbp), %r15d
movzbl 0x8(%r14), %esi
movq %r12, %rdi
callq 0x10cf3
testq %rax, %rax
sete -0x29(%rbp)
je 0x30b1b
movl -0x9c(%rbp), %ebx
movq 0x10(%r14), %rdi
movl %r15d, %esi
movq %r13, %rdx
movl %ebx, %ecx
movq %rax, %r8
callq *0x18(%r14)
movl %eax, %ebx
leaq -0x70(%rbp), %rdi
callq 0x10afb
movq %r12, %rdi
callq 0x10afb
movq -0x38(%rbp), %rax
testq %rax, %rax
je 0x30b55
movb -0x29(%rbp), %cl
orb %cl, -0x2a(%rbp)
je 0x30b55
movb $0x7, (%rax)
movl %ebx, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: vdbeMemFromBtreeResize
static SQLITE_NOINLINE int vdbeMemFromBtreeResize(
  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. */
){
  int rc;
  pMem->flags = MEM_Null;
  if( SQLITE_OK==(rc = sqlite3VdbeMemClearAndResize(pMem, amt+2)) ){
    if( key ){
      rc = sqlite3BtreeKey(pCur, offset, amt, pMem->z);
    }else{
      rc = sqlite3BtreeData(pCur, offset, amt, pMem->z);
    }
    if( rc==SQLITE_OK ){
      pMem->z[amt] = 0;
      pMem->z[amt+1] = 0;
      pMem->flags = MEM_Blob|MEM_Term;
      pMem->n = (int)amt;
    }else{
      sqlite3VdbeMemRelease(pMem);
    }
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movl %ecx, -0x2c(%rbp)
movl %edx, %r14d
movl %esi, %r13d
movq %rdi, %r12
movw $0x1, 0x8(%r8)
leal 0x2(%r14), %esi
movq %r8, %rdi
callq 0x26f9a
movl %eax, %r15d
testl %eax, %eax
jne 0x30df2
movq 0x10(%rbx), %rcx
cmpl $0x0, -0x2c(%rbp)
je 0x30daf
movq %r12, %rdi
movl %r13d, %esi
movl %r14d, %edx
callq 0x236aa
jmp 0x30dbd
movq %r12, %rdi
movl %r13d, %esi
movl %r14d, %edx
callq 0x13ff2
movl %eax, %r15d
testl %eax, %eax
je 0x30dce
movq %rbx, %rdi
callq 0x10afb
jmp 0x30df2
movq 0x10(%rbx), %rax
movl %r14d, %ecx
xorl %r15d, %r15d
movb %r15b, (%rax,%rcx)
movq 0x10(%rbx), %rax
leal 0x1(%r14), %ecx
movb %r15b, (%rax,%rcx)
movw $0x210, 0x8(%rbx)       # imm = 0x210
movl %r14d, 0xc(%rbx)
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: moveToChild
static int moveToChild(BtCursor *pCur, u32 newPgno){
  BtShared *pBt = pCur->pBt;

  assert( cursorHoldsMutex(pCur) );
  assert( pCur->eState==CURSOR_VALID );
  assert( pCur->iPage<BTCURSOR_MAX_DEPTH );
  assert( pCur->iPage>=0 );
  if( pCur->iPage>=(BTCURSOR_MAX_DEPTH-1) ){
    return SQLITE_CORRUPT_BKPT;
  }
  pCur->info.nSize = 0;
  pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl);
  pCur->iPage++;
  pCur->aiIdx[pCur->iPage] = 0;
  return getAndInitPage(pBt, newPgno, &pCur->apPage[pCur->iPage],
                        pCur, pCur->curPagerFlags);
}

// Assembly:
movsbq 0x58(%rdi), %rax
cmpq $0x13, %rax
jl 0x31018
pushq %rbp
movq %rsp, %rbp
movl $0xe9e8, %edi           # imm = 0xE9E8
callq 0x1ec07
pushq $0xb
popq %rax
popq %rbp
retq
movq %rdi, %rcx
movq 0x8(%rdi), %rdi
andw $0x0, 0x36(%rcx)
andb $-0x7, 0x54(%rcx)
leaq 0x1(%rax), %rdx
movb %dl, 0x58(%rcx)
andw $0x0, 0x72(%rcx,%rax,2)
leaq (%rcx,%rax,8), %rdx
addq $0xa0, %rdx
movzbl 0x55(%rcx), %r8d
jmp 0x31047
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: getAndInitPage
static int getAndInitPage(
  BtShared *pBt,                  /* The database file */
  Pgno pgno,                      /* Number of the page to get */
  MemPage **ppPage,               /* Write the page pointer here */
  BtCursor *pCur,                 /* Cursor to receive the page, or NULL */
  int bReadOnly                   /* True for a read-only page */
){
  int rc;
  DbPage *pDbPage;
  assert( sqlite3_mutex_held(pBt->mutex) );
  assert( pCur==0 || ppPage==&pCur->apPage[pCur->iPage] );
  assert( pCur==0 || bReadOnly==pCur->curPagerFlags );
  assert( pCur==0 || pCur->iPage>0 );

  if( pgno>btreePagecount(pBt) ){
    rc = SQLITE_CORRUPT_BKPT;
    goto getAndInitPage_error;
  }
  rc = sqlite3PagerGet(pBt->pPager, pgno, (DbPage**)&pDbPage, bReadOnly);
  if( rc ){
    goto getAndInitPage_error;
  }
  *ppPage = (MemPage*)sqlite3PagerGetExtra(pDbPage);
  if( (*ppPage)->isInit==0 ){
    btreePageFromDbPage(pDbPage, pgno, pBt);
    rc = btreeInitPage(*ppPage);
    if( rc!=SQLITE_OK ){
      releasePage(*ppPage);
      goto getAndInitPage_error;
    }
  }
  assert( (*ppPage)->pgno==pgno );
  assert( (*ppPage)->aData==sqlite3PagerGetData(pDbPage) );

  /* If obtaining a child page for a cursor, we must verify that the page is
  ** compatible with the root page. */
  if( pCur && ((*ppPage)->nCell<1 || (*ppPage)->intKey!=pCur->curIntKey) ){
    rc = SQLITE_CORRUPT_BKPT;
    releasePage(*ppPage);
    goto getAndInitPage_error;
  }
  return SQLITE_OK;

getAndInitPage_error:
  if( pCur ) pCur->iPage--;
  testcase( pgno==0 );
  assert( pgno!=0 || rc==SQLITE_CORRUPT );
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
cmpl %esi, 0x3c(%rdi)
jae 0x3106d
movl $0xdf1d, %edi           # imm = 0xDF1D
callq 0x1ec07
pushq $0xb
popq %r15
jmp 0x3108c
movq %rdx, %r14
movl %esi, %r13d
movq %rdi, %r12
movq (%rdi), %rdi
leaq -0x30(%rbp), %rdx
movl %r8d, %ecx
callq 0xf651
movl %eax, %r15d
testl %eax, %eax
je 0x310a6
testq %rbx, %rbx
je 0x31094
decb 0x58(%rbx)
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x30(%rbp), %rdi
movq 0x10(%rdi), %rax
movq %rax, (%r14)
cmpb $0x0, (%rax)
je 0x310e8
xorl %r15d, %r15d
testq %rbx, %rbx
je 0x31094
movq (%r14), %rax
cmpw $0x0, 0x12(%rax)
je 0x310d0
movb 0x2(%rax), %al
cmpb 0x59(%rbx), %al
je 0x31094
movl $0xdf33, %edi           # imm = 0xDF33
callq 0x1ec07
movq (%r14), %rdi
callq 0x228f1
pushq $0xb
popq %r15
jmp 0x31091
movl %r13d, %esi
movq %r12, %rdx
callq 0x229b5
movq (%r14), %rdi
callq 0x1f079
testl %eax, %eax
je 0x310b6
movl %eax, %r15d
movq (%r14), %rdi
callq 0x228f1
jmp 0x3108c
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: btreePrevious
static SQLITE_NOINLINE int btreePrevious(BtCursor *pCur, int *pRes){
  int rc;
  MemPage *pPage;

  assert( cursorHoldsMutex(pCur) );
  assert( pRes!=0 );
  assert( *pRes==0 );
  assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );
  assert( (pCur->curFlags & (BTCF_AtLast|BTCF_ValidOvfl|BTCF_ValidNKey))==0 );
  assert( pCur->info.nSize==0 );
  if( pCur->eState!=CURSOR_VALID ){
    rc = restoreCursorPosition(pCur);
    if( rc!=SQLITE_OK ){
      return rc;
    }
    if( CURSOR_INVALID==pCur->eState ){
      *pRes = 1;
      return SQLITE_OK;
    }
    if( pCur->skipNext ){
      assert( pCur->eState==CURSOR_VALID || pCur->eState==CURSOR_SKIPNEXT );
      pCur->eState = CURSOR_VALID;
      if( pCur->skipNext<0 ){
        pCur->skipNext = 0;
        return SQLITE_OK;
      }
      pCur->skipNext = 0;
    }
  }

  pPage = pCur->apPage[pCur->iPage];
  assert( pPage->isInit );
  if( !pPage->leaf ){
    int idx = pCur->aiIdx[pCur->iPage];
    rc = moveToChild(pCur, get4byte(findCell(pPage, idx)));
    if( rc ) return rc;
    rc = moveToRightmost(pCur);
  }else{
    while( pCur->aiIdx[pCur->iPage]==0 ){
      if( pCur->iPage==0 ){
        pCur->eState = CURSOR_INVALID;
        *pRes = 1;
        return SQLITE_OK;
      }
      moveToParent(pCur);
    }
    assert( pCur->info.nSize==0 );
    assert( (pCur->curFlags & (BTCF_ValidNKey|BTCF_ValidOvfl))==0 );

    pCur->aiIdx[pCur->iPage]--;
    pPage = pCur->apPage[pCur->iPage];
    if( pPage->intKey && !pPage->leaf ){
      rc = sqlite3BtreePrevious(pCur, pRes);
    }else{
      rc = SQLITE_OK;
    }
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movb 0x56(%rdi), %al
cmpb $0x1, %al
jne 0x31a9c
movb 0x58(%rbx), %al
movsbq %al, %rdx
movq 0x98(%rbx,%rdx,8), %rcx
cmpb $0x0, 0x5(%rcx)
je 0x31ad0
movsbq %al, %rcx
movzwl 0x70(%rbx,%rcx,2), %edx
testw %dx, %dx
jne 0x31b10
testb %al, %al
je 0x31b3c
movq %rbx, %rdi
callq 0x30fd4
movb 0x58(%rbx), %al
jmp 0x31a75
cmpb $0x3, %al
jb 0x31ab3
movq %rbx, %rdi
callq 0x30c27
testl %eax, %eax
jne 0x31b49
movb 0x56(%rbx), %al
testb %al, %al
je 0x31b40
movl 0x50(%rbx), %eax
testl %eax, %eax
je 0x31a60
movb $0x1, 0x56(%rbx)
andl $0x0, 0x50(%rbx)
testl %eax, %eax
jns 0x31a60
jmp 0x31b47
movzwl 0x70(%rbx,%rdx,2), %eax
movzwl 0x14(%rcx), %edx
movq 0x60(%rcx), %rsi
movzbl (%rsi,%rax,2), %r8d
shll $0x8, %r8d
movzbl 0x1(%rsi,%rax,2), %edi
orl %r8d, %edi
andl %edx, %edi
addq 0x50(%rcx), %rdi
callq 0x1c9e4
movq %rbx, %rdi
movl %eax, %esi
callq 0x30ffa
testl %eax, %eax
jne 0x31b49
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x31b4e
decl %edx
movw %dx, 0x70(%rbx,%rcx,2)
movq 0x98(%rbx,%rcx,8), %rcx
xorl %eax, %eax
cmpb $0x0, 0x2(%rcx)
je 0x31b49
cmpb $0x0, 0x5(%rcx)
jne 0x31b49
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x2face
movb $0x0, 0x56(%rbx)
movl $0x1, (%r14)
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: moveToRightmost
static int moveToRightmost(BtCursor *pCur){
  Pgno pgno;
  int rc = SQLITE_OK;
  MemPage *pPage = 0;

  assert( cursorHoldsMutex(pCur) );
  assert( pCur->eState==CURSOR_VALID );
  while( !(pPage = pCur->apPage[pCur->iPage])->leaf ){
    pgno = get4byte(&pPage->aData[pPage->hdrOffset+8]);
    pCur->aiIdx[pCur->iPage] = pPage->nCell;
    rc = moveToChild(pCur, pgno);
    if( rc ) return rc;
  }
  pCur->aiIdx[pCur->iPage] = pPage->nCell-1;
  assert( pCur->info.nSize==0 );
  assert( (pCur->curFlags & BTCF_ValidNKey)==0 );
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movsbq 0x58(%rbx), %r14
movq 0x98(%rbx,%r14,8), %r15
cmpb $0x0, 0x5(%r15)
jne 0x31ba0
movq 0x50(%r15), %rax
movzbl 0x6(%r15), %ecx
leaq (%rax,%rcx), %rdi
addq $0x8, %rdi
callq 0x1c9e4
movzwl 0x12(%r15), %ecx
movw %cx, 0x70(%rbx,%r14,2)
movq %rbx, %rdi
movl %eax, %esi
callq 0x30ffa
testl %eax, %eax
je 0x31b5b
jmp 0x31baf
movzwl 0x12(%r15), %eax
decl %eax
movw %ax, 0x70(%rbx,%r14,2)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: invalidateIncrblobCursors
static void invalidateIncrblobCursors(
  Btree *pBtree,          /* The database file to check */
  i64 iRow,               /* The rowid that might be changing */
  int isClearTable        /* True if all rows are being deleted */
){
  BtCursor *p;
  if( pBtree->hasIncrblobCur==0 ) return;
  assert( sqlite3BtreeHoldsMutex(pBtree) );
  pBtree->hasIncrblobCur = 0;
  for(p=pBtree->pBt->pCursor; p; p=p->pNext){
    if( (p->curFlags & BTCF_Incrblob)!=0 ){
      pBtree->hasIncrblobCur = 1;
      if( isClearTable || p->info.nKey==iRow ){
        p->eState = CURSOR_INVALID;
      }
    }
  }
}

// Assembly:
cmpb $0x0, 0x13(%rdi)
je 0x31bf0
pushq %rbp
movq %rsp, %rbp
movb $0x0, 0x13(%rdi)
movq 0x8(%rdi), %rax
movq 0x10(%rax), %rax
testq %rax, %rax
je 0x31bef
testb $0x10, 0x54(%rax)
je 0x31bcc
movb $0x1, 0x13(%rdi)
testl %edx, %edx
jne 0x31be9
cmpq %rsi, 0x20(%rax)
jne 0x31bcc
movb $0x0, 0x56(%rax)
jmp 0x31bcc
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: pageFindSlot
static u8 *pageFindSlot(MemPage *pPg, int nByte, int *pRc){
  const int hdr = pPg->hdrOffset;
  u8 * const aData = pPg->aData;
  int iAddr = hdr + 1;
  int pc = get2byte(&aData[iAddr]);
  int x;
  int usableSize = pPg->pBt->usableSize;

  assert( pc>0 );
  do{
    int size;            /* Size of the free slot */
    /* EVIDENCE-OF: R-06866-39125 Freeblocks are always connected in order of
    ** increasing offset. */
    if( pc>usableSize-4 || pc<iAddr+4 ){
      *pRc = SQLITE_CORRUPT_BKPT;
      return 0;
    }
    /* EVIDENCE-OF: R-22710-53328 The third and fourth bytes of each
    ** freeblock form a big-endian integer which is the size of the freeblock
    ** in bytes, including the 4-byte header. */
    size = get2byte(&aData[pc+2]);
    if( (x = size - nByte)>=0 ){
      testcase( x==4 );
      testcase( x==3 );
      if( pc < pPg->cellOffset+2*pPg->nCell || size+pc > usableSize ){
        *pRc = SQLITE_CORRUPT_BKPT;
        return 0;
      }else if( x<4 ){
        /* EVIDENCE-OF: R-11498-58022 In a well-formed b-tree page, the total
        ** number of bytes in fragments may not exceed 60. */
        if( aData[hdr+7]>57 ) return 0;

        /* Remove the slot from the free-list. Update the number of
        ** fragmented bytes within the page. */
        memcpy(&aData[iAddr], &aData[pc], 2);
        aData[hdr+7] += (u8)x;
      }else{
        /* The slot remains on the free-list. Reduce its size to account
         ** for the portion used by the new allocation. */
        put2byte(&aData[pc+2], x);
      }
      return &aData[pc + x];
    }
    iAddr = pc;
    pc = get2byte(&aData[pc]);
  }while( pc );

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movzbl 0x6(%rdi), %ecx
movq 0x48(%rdi), %rdx
movq 0x50(%rdi), %rax
movzwl 0x1(%rax,%rcx), %r9d
rolw $0x8, %r9w
leaq 0x1(%rcx), %r8
movzwl %r9w, %r10d
movl 0x34(%rdx), %r9d
leal -0x4(%r9), %r14d
cmpl %r14d, %r10d
jg 0x3408f
movl %r10d, %edx
leal 0x4(%r8), %r10d
cmpl %r10d, %edx
jb 0x3408f
movl %edx, %r11d
movzwl 0x2(%rax,%r11), %r10d
rolw $0x8, %r10w
movzwl %r10w, %r15d
movl %r15d, %r10d
subl %esi, %r10d
jns 0x34096
movzwl (%rax,%r11), %r8d
rolw $0x8, %r8w
movzwl %r8w, %r10d
movl %edx, %r8d
testw %r10w, %r10w
jne 0x3404b
jmp 0x340dd
movl $0xdce9, %edi           # imm = 0xDCE9
jmp 0x340d2
movzwl 0xe(%rdi), %esi
movzwl 0x12(%rdi), %edi
leal (%rsi,%rdi,2), %esi
cmpl %esi, %edx
jb 0x340cd
addl %edx, %r15d
cmpl %r9d, %r15d
jg 0x340cd
cmpl $0x3, %r10d
ja 0x340ea
cmpb $0x39, 0x7(%rax,%rcx)
ja 0x340dd
movl %r8d, %esi
movzwl (%rax,%r11), %edi
movw %di, (%rax,%rsi)
addb %r10b, 0x7(%rax,%rcx)
jmp 0x340f7
movl $0xdcf4, %edi           # imm = 0xDCF4
callq 0x1ec07
movl $0xb, (%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl %r10d, %ecx
rolw $0x8, %cx
movw %cx, 0x2(%rax,%r11)
addl %edx, %r10d
addq %r10, %rax
jmp 0x340df
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: pageInsertArray
static int pageInsertArray(
  MemPage *pPg,                   /* Page to add cells to */
  u8 *pBegin,                     /* End of cell-pointer array */
  u8 **ppData,                    /* IN/OUT: Page content -area pointer */
  u8 *pCellptr,                   /* Pointer to cell-pointer area */
  int iFirst,                     /* Index of first cell to add */
  int nCell,                      /* Number of cells to add to pPg */
  CellArray *pCArray              /* Array of cells */
){
  int i;
  u8 *aData = pPg->aData;
  u8 *pData = *ppData;
  int iEnd = iFirst + nCell;
  assert( CORRUPT_DB || pPg->hdrOffset==0 );    /* Never called on page 1 */
  for(i=iFirst; i<iEnd; i++){
    int sz, rc;
    u8 *pSlot;
    sz = cachedCellSize(pCArray, i);
    if( (aData[1]==0 && aData[2]==0) || (pSlot = pageFindSlot(pPg,sz,&rc))==0 ){
      pData -= sz;
      if( pData<pBegin ) return 1;
      pSlot = pData;
    }
    /* pSlot and pCArray->apCell[i] will never overlap on a well-formed
    ** database.  But they might for a corrupt database.  Hence use memmove()
    ** since memcpy() sends SIGABORT with overlapping buffers on OpenBSD */
    assert( (pSlot+sz)<=pCArray->apCell[i]
         || pSlot>=(pCArray->apCell[i]+sz)
         || CORRUPT_DB );
    memmove(pSlot, pCArray->apCell[i], sz);
    put2byte(pCellptr, (pSlot - aData));
    pCellptr += 2;
  }
  *ppData = pData;
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %r14
movq %rsi, -0x40(%rbp)
movq %rdi, -0x48(%rbp)
movq 0x50(%rdi), %rax
movq %rax, -0x30(%rbp)
movq %rdx, -0x38(%rbp)
movq (%rdx), %r13
addl %r8d, %r9d
movslq %r8d, %rbx
movslq %r9d, %rax
movq %rax, -0x50(%rbp)
cmpq -0x50(%rbp), %rbx
jge 0x346c6
movq 0x10(%rbp), %rdi
movl %ebx, %esi
callq 0x344a7
movzwl %ax, %esi
movq -0x30(%rbp), %rax
cmpb $0x0, 0x1(%rax)
movl %esi, %r15d
jne 0x34676
movq -0x30(%rbp), %rax
cmpb $0x0, 0x2(%rax)
je 0x3468d
movq -0x48(%rbp), %rdi
leaq -0x54(%rbp), %rdx
callq 0x34017
testq %rax, %rax
je 0x3468d
movq %rax, %r12
jmp 0x34699
subq %r15, %r13
movq %r13, %r12
cmpq -0x40(%rbp), %r13
jb 0x346d1
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax,%rbx,8), %rsi
movq %r12, %rdi
movq %r15, %rdx
callq 0xa560
subl -0x30(%rbp), %r12d
rolw $0x8, %r12w
movw %r12w, (%r14)
addq $0x2, %r14
incq %rbx
jmp 0x3464b
movq -0x38(%rbp), %rax
movq %r13, (%rax)
xorl %eax, %eax
jmp 0x346d4
pushq $0x1
popq %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: vdbeSorterRowkey
static void *vdbeSorterRowkey(
  const VdbeSorter *pSorter,      /* Sorter object */
  int *pnKey                      /* OUT: Size of current key in bytes */
){
  void *pKey;
  if( pSorter->bUsePMA ){
    PmaReader *pReader;
#if SQLITE_MAX_WORKER_THREADS>0
    if( pSorter->bUseThreads ){
      pReader = pSorter->pReader;
    }else
#endif
    /*if( !pSorter->bUseThreads )*/{
      pReader = &pSorter->pMerger->aReadr[pSorter->pMerger->aTree[1]];
    }
    *pnKey = pReader->nKey;
    pKey = pReader->aKey;
  }else{
    *pnKey = pSorter->list.pList->nVal;
    pKey = SRVAL(pSorter->list.pList);
  }
  return pKey;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpb $0x0, 0x58(%rdi)
je 0x346f9
cmpb $0x0, 0x59(%rdi)
je 0x34707
movq 0x10(%rdi), %rax
jmp 0x3471b
movq 0x38(%rdi), %rax
movl (%rax), %ecx
movl %ecx, (%rsi)
addq $0x10, %rax
jmp 0x34724
movq 0x18(%rdi), %rcx
movq 0x10(%rcx), %rax
movslq 0x4(%rax), %rax
imulq $0x50, %rax, %rax
addq 0x18(%rcx), %rax
movl 0x14(%rax), %ecx
movl %ecx, (%rsi)
movq 0x28(%rax), %rax
popq %rbp
retq