// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: rebuildPage
static int rebuildPage(
  MemPage *pPg,                   /* Edit this page */
  int nCell,                      /* Final number of cells on page */
  u8 **apCell,                    /* Array of cells */
  u16 *szCell                     /* Array of cell sizes */
){
  const int hdr = pPg->hdrOffset;          /* Offset of header on pPg */
  u8 * const aData = pPg->aData;           /* Pointer to data for pPg */
  const int usableSize = pPg->pBt->usableSize;
  u8 * const pEnd = &aData[usableSize];
  int i;
  u8 *pCellptr = pPg->aCellIdx;
  u8 *pTmp = sqlite3PagerTempSpace(pPg->pBt->pPager);
  u8 *pData;

  i = get2byte(&aData[hdr+5]);
  memcpy(&pTmp[i], &aData[i], usableSize - i);

  pData = pEnd;
  for(i=0; i<nCell; i++){
    u8 *pCell = apCell[i];
    if( SQLITE_WITHIN(pCell,aData,pEnd) ){
      pCell = &pTmp[pCell - aData];
    }
    pData -= szCell[i];
    put2byte(pCellptr, (pData - aData));
    pCellptr += 2;
    if( pData < pCellptr ) return SQLITE_CORRUPT_BKPT;
    memcpy(pData, pCell, szCell[i]);
    assert( szCell[i]==pPg->xCellSize(pPg, pCell) || CORRUPT_DB );
    testcase( szCell[i]!=pPg->xCellSize(pPg,pCell) );
  }

  /* The pPg->nFree field is now set incorrectly. The caller will fix it. */
  pPg->nCell = nCell;
  pPg->nOverflow = 0;

  put2byte(&aData[hdr+1], 0);
  put2byte(&aData[hdr+3], pPg->nCell);
  put2byte(&aData[hdr+5], pData - aData);
  aData[hdr+7] = 0x00;
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %r15
movq %rdx, -0x60(%rbp)
movl %esi, %ebx
movzbl 0x6(%rdi), %ecx
movq 0x48(%rdi), %rax
movq 0x50(%rdi), %rsi
movslq 0x34(%rax), %rdx
leaq (%rsi,%rdx), %r12
movq %rdi, -0x40(%rbp)
movq 0x60(%rdi), %rdi
movq %rdi, -0x58(%rbp)
movq (%rax), %rax
movq 0x108(%rax), %rdi
movq %rcx, -0x48(%rbp)
movzwl 0x5(%rsi,%rcx), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movq %rdi, -0x50(%rbp)
addq %rax, %rdi
movq %rsi, -0x38(%rbp)
addq %rax, %rsi
subq %rax, %rdx
callq 0xa3b0
xorl %r13d, %r13d
testl %ebx, %ebx
movl $0x0, %r14d
movl %ebx, -0x2c(%rbp)
cmovgl %ebx, %r14d
movq %r12, %rbx
cmpq %r13, %r14
je 0x3444e
movq -0x58(%rbp), %rax
leaq (%rax,%r13,2), %rcx
movzwl (%r15,%r13,2), %eax
subq %rax, %rbx
movl %ebx, %edx
movq -0x38(%rbp), %rdi
subl %edi, %edx
rolw $0x8, %dx
movq -0x60(%rbp), %rax
movq (%rax,%r13,8), %rax
movw %dx, (%rcx)
addq $0x2, %rcx
cmpq %rcx, %rbx
jb 0x3448b
movq %rax, %rcx
subq %rdi, %rcx
cmpq %r12, %rax
movq -0x50(%rbp), %rdx
leaq (%rdx,%rcx), %rsi
cmovaeq %rax, %rsi
cmpq %rdi, %rax
cmovbq %rax, %rsi
movzwl (%r15,%r13,2), %edx
movq %rbx, %rdi
callq 0xa3b0
incq %r13
jmp 0x343eb
movq -0x40(%rbp), %rdi
movl -0x2c(%rbp), %eax
movw %ax, 0x12(%rdi)
xorl %eax, %eax
movb %al, 0x1(%rdi)
movq -0x48(%rbp), %rdx
movq -0x38(%rbp), %rsi
andw $0x0, 0x1(%rsi,%rdx)
movb 0x13(%rdi), %cl
movb %cl, 0x3(%rsi,%rdx)
movb 0x12(%rdi), %cl
movb %cl, 0x4(%rsi,%rdx)
subq %rsi, %rbx
movb %bh, 0x5(%rsi,%rdx)
movb %bl, 0x6(%rsi,%rdx)
movb %al, 0x7(%rsi,%rdx)
jmp 0x34498
movl $0xf09c, %edi           # imm = 0xF09C
callq 0x1ec07
pushq $0xb
popq %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq