// File: /workspace/github_c_makefile_star2_O0/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: clearCell
static int clearCell(
  MemPage *pPage,          /* The page that contains the Cell */
  unsigned char *pCell,    /* First byte of the Cell */
  u16 *pnSize              /* Write the size of the Cell here */
){
  BtShared *pBt = pPage->pBt;
  CellInfo info;
  Pgno ovflPgno;
  int rc;
  int nOvfl;
  u32 ovflPageSize;

  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  pPage->xParseCell(pPage, pCell, &info);
  *pnSize = info.nSize;
  if( info.nLocal==info.nPayload ){
    return SQLITE_OK;  /* No overflow pages. Return without doing anything */
  }
  if( pCell+info.nSize-1 > pPage->aData+pPage->maskPage ){
    return SQLITE_CORRUPT_BKPT;  /* Cell extends past end of page */
  }
  ovflPgno = get4byte(pCell + info.nSize - 4);
  assert( pBt->usableSize > 4 );
  ovflPageSize = pBt->usableSize - 4;
  nOvfl = (info.nPayload - info.nLocal + ovflPageSize - 1)/ovflPageSize;
  assert( nOvfl>0 || 
    (CORRUPT_DB && (info.nPayload + ovflPageSize)<ovflPageSize)
  );
  while( nOvfl-- ){
    Pgno iNext = 0;
    MemPage *pOvfl = 0;
    if( ovflPgno<2 || ovflPgno>btreePagecount(pBt) ){
      /* 0 is not a legal page number and page 1 cannot be an 
      ** overflow page. Therefore if ovflPgno<2 or past the end of the 
      ** file the database must be corrupt. */
      return SQLITE_CORRUPT_BKPT;
    }
    if( nOvfl ){
      rc = getOverflowPage(pBt, ovflPgno, &pOvfl, &iNext);
      if( rc ) return rc;
    }

    if( ( pOvfl || ((pOvfl = btreePageLookup(pBt, ovflPgno))!=0) )
     && sqlite3PagerPageRefcount(pOvfl->pDbPage)!=1
    ){
      /* There is no reason any cursor should have an outstanding reference 
      ** to an overflow page belonging to a cell that is being deleted/updated.
      ** So if there exists more than one reference to this page, then it 
      ** must not really be an overflow page and the database must be corrupt. 
      ** It is helpful to detect this before calling freePage2(), as 
      ** freePage2() may zero the page contents if secure-delete mode is
      ** enabled. If this 'overflow' page happens to be a page that the
      ** caller is iterating through or using in some other way, this
      ** can be problematic.
      */
      rc = SQLITE_CORRUPT_BKPT;
    }else{
      rc = freePage2(pBt, pOvfl, ovflPgno);
    }

    if( pOvfl ){
      sqlite3PagerUnref(pOvfl->pDbPage);
    }
    if( rc ) return rc;
    ovflPgno = iNext;
  }
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x80(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq *%rax
movw -0x2a(%rbp), %cx
movq -0x20(%rbp), %rax
movw %cx, (%rax)
movzwl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jne 0x4b259
movl $0x0, -0x4(%rbp)
jmp 0x4b3dd
movq -0x18(%rbp), %rax
movzwl -0x2a(%rbp), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
addq $-0x1, %rax
movq -0x10(%rbp), %rcx
movq 0x50(%rcx), %rcx
movq -0x10(%rbp), %rdx
movzwl 0x14(%rdx), %edx
movslq %edx, %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jbe 0x4b298
movl $0xeebf, %edi           # imm = 0xEEBF
callq 0x2a650
movl %eax, -0x4(%rbp)
jmp 0x4b3dd
movq -0x18(%rbp), %rdi
movzwl -0x2a(%rbp), %eax
cltq
addq %rax, %rdi
addq $-0x4, %rdi
callq 0x26b20
movl %eax, -0x44(%rbp)
movq -0x28(%rbp), %rax
movl 0x34(%rax), %eax
subl $0x4, %eax
movl %eax, -0x50(%rbp)
movl -0x30(%rbp), %eax
movzwl -0x2c(%rbp), %ecx
subl %ecx, %eax
addl -0x50(%rbp), %eax
subl $0x1, %eax
xorl %edx, %edx
divl -0x50(%rbp)
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x4c(%rbp)
cmpl $0x0, %eax
je 0x4b3d6
movl $0x0, -0x54(%rbp)
movq $0x0, -0x60(%rbp)
cmpl $0x2, -0x44(%rbp)
jb 0x4b316
movl -0x44(%rbp), %eax
movl %eax, -0x64(%rbp)
movq -0x28(%rbp), %rdi
callq 0x31b90
movl %eax, %ecx
movl -0x64(%rbp), %eax
cmpl %ecx, %eax
jbe 0x4b328
movl $0xeecf, %edi           # imm = 0xEECF
callq 0x2a650
movl %eax, -0x4(%rbp)
jmp 0x4b3dd
cmpl $0x0, -0x4c(%rbp)
je 0x4b358
movq -0x28(%rbp), %rdi
movl -0x44(%rbp), %esi
leaq -0x60(%rbp), %rdx
leaq -0x54(%rbp), %rcx
callq 0x339c0
movl %eax, -0x48(%rbp)
cmpl $0x0, -0x48(%rbp)
je 0x4b356
movl -0x48(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x4b3dd
jmp 0x4b358
cmpq $0x0, -0x60(%rbp)
jne 0x4b375
movq -0x28(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0x4ba50
movq %rax, -0x60(%rbp)
cmpq $0x0, %rax
je 0x4b396
movq -0x60(%rbp), %rax
movq 0x70(%rax), %rdi
callq 0x2aee0
cmpl $0x1, %eax
je 0x4b396
movl $0xeee3, %edi           # imm = 0xEEE3
callq 0x2a650
movl %eax, -0x48(%rbp)
jmp 0x4b3a9
movq -0x28(%rbp), %rdi
movq -0x60(%rbp), %rsi
movl -0x44(%rbp), %edx
callq 0x4bab0
movl %eax, -0x48(%rbp)
cmpq $0x0, -0x60(%rbp)
je 0x4b3bd
movq -0x60(%rbp), %rax
movq 0x70(%rax), %rdi
callq 0x12a20
cmpl $0x0, -0x48(%rbp)
je 0x4b3cb
movl -0x48(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x4b3dd
movl -0x54(%rbp), %eax
movl %eax, -0x44(%rbp)
jmp 0x4b2d5
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)