// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %r15
movq 0x48(%rdi), %rax
movq %rax, -0x38(%rbp)
leaq -0x58(%rbp), %r13
movq %r13, %rdx
callq *0x80(%rdi)
movzwl 0x16(%r13), %edx
movw %dx, (%r12)
movzwl 0x14(%r13), %ecx
movl 0x10(%r13), %eax
xorl %r12d, %r12d
cmpl %ecx, %eax
je 0x38528
leaq (%r14,%rdx), %rsi
decq %rsi
movzwl 0x14(%r15), %edi
addq 0x50(%r15), %rdi
cmpq %rdi, %rsi
jbe 0x383ea
leaq 0x45111(%rip), %rsi     # 0x7d4d8
leaq 0x44daf(%rip), %rcx     # 0x7d17d
movl $0xb, %r12d
movl $0xb, %edi
movl $0xeebf, %edx           # imm = 0xEEBF
xorl %eax, %eax
callq 0xa4b0
jmp 0x38528
addq %rdx, %r14
movl -0x4(%r14), %r14d
bswapl %r14d
movq -0x38(%rbp), %rdx
movl 0x34(%rdx), %edx
notl %ecx
addl %ecx, %eax
addl %edx, %eax
addl $-0x4, %eax
movl %edx, %ecx
addl $-0x4, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, %r15d
subl $0x1, %r15d
jb 0x38525
movl $0x0, -0x3c(%rbp)
movq $0x0, -0x30(%rbp)
cmpl $0x2, %r14d
jb 0x38439
movq -0x38(%rbp), %rax
cmpl 0x3c(%rax), %r14d
jbe 0x38465
xorl %ebx, %ebx
movl $0xb, %r12d
movl $0xb, %edi
leaq 0x4508b(%rip), %rsi     # 0x7d4d8
movl $0xeecf, %edx           # imm = 0xEECF
leaq 0x44d24(%rip), %rcx     # 0x7d17d
xorl %eax, %eax
callq 0xa4b0
jmp 0x38518
testl %r15d, %r15d
je 0x3848a
movq -0x38(%rbp), %rdi
movl %r14d, %esi
leaq -0x30(%rbp), %rdx
leaq -0x3c(%rbp), %rcx
callq 0x27264
testl %eax, %eax
je 0x3848a
movl %eax, %r12d
jmp 0x3850b
cmpq $0x0, -0x30(%rbp)
jne 0x384a6
movq -0x38(%rbp), %rdi
movl %r14d, %esi
callq 0x3a372
movq %rax, -0x30(%rbp)
testq %rax, %rax
je 0x384b5
movq -0x30(%rbp), %rax
movq 0x70(%rax), %rax
cmpw $0x1, 0x2e(%rax)
jne 0x384ca
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdi
movl %r14d, %edx
callq 0x3a3c9
movl %eax, %r12d
jmp 0x384ef
movl $0xb, %r12d
movl $0xb, %edi
leaq 0x44ffc(%rip), %rsi     # 0x7d4d8
movl $0xeee3, %edx           # imm = 0xEEE3
leaq 0x44c95(%rip), %rcx     # 0x7d17d
xorl %eax, %eax
callq 0xa4b0
movq -0x30(%rbp), %rax
testq %rax, %rax
je 0x38506
movq 0x70(%rax), %rdi
testq %rdi, %rdi
je 0x38506
callq 0x25020
testl %r12d, %r12d
je 0x3850f
xorl %ebx, %ebx
jmp 0x38518
movb $0x1, %bl
movl -0x3c(%rbp), %r14d
movl %r13d, %r12d
movl %r12d, %r13d
testb %bl, %bl
jne 0x38410
jmp 0x38528
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq