// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: btreeInitPage
static int btreeInitPage(MemPage *pPage){
  u8 *data;          /* Equal to pPage->aData */
  BtShared *pBt;        /* The main btree structure */

  assert( pPage->pBt!=0 );
  assert( pPage->pBt->db!=0 );
  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  assert( pPage->pgno==sqlite3PagerPagenumber(pPage->pDbPage) );
  assert( pPage == sqlite3PagerGetExtra(pPage->pDbPage) );
  assert( pPage->aData == sqlite3PagerGetData(pPage->pDbPage) );
  assert( pPage->isInit==0 );

  pBt = pPage->pBt;
  data = pPage->aData + pPage->hdrOffset;
  /* EVIDENCE-OF: R-28594-02890 The one-byte flag at offset 0 indicating
  ** the b-tree page type. */
  if( decodeFlags(pPage, data[0]) ){
    return SQLITE_CORRUPT_PAGE(pPage);
  }
  assert( pBt->pageSize>=512 && pBt->pageSize<=65536 );
  pPage->maskPage = (u16)(pBt->pageSize - 1);
  pPage->nOverflow = 0;
  pPage->cellOffset = pPage->hdrOffset + 8 + pPage->childPtrSize;
  pPage->aCellIdx = data + pPage->childPtrSize + 8;
  pPage->aDataEnd = pPage->aData + pBt->usableSize;
  pPage->aDataOfst = pPage->aData + pPage->childPtrSize;
  /* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the
  ** number of cells on the page. */
  pPage->nCell = get2byte(&data[3]);
  if( pPage->nCell>MX_CELL(pBt) ){
    /* To many cells for a single page.  The page must be corrupt */
    return SQLITE_CORRUPT_PAGE(pPage);
  }
  testcase( pPage->nCell==MX_CELL(pBt) );
  /* EVIDENCE-OF: R-24089-57979 If a page contains no cells (which is only
  ** possible for a root page of a table that contains no rows) then the
  ** offset to the cell content area will equal the page size minus the
  ** bytes of reserved space. */
  assert( pPage->nCell>0
       || get2byteNotZero(&data[5])==(int)pBt->usableSize
       || CORRUPT_DB );
  pPage->nFree = -1;  /* Indicate that this value is yet uncomputed */
  pPage->isInit = 1;
  if( pBt->db->flags & SQLITE_CellSizeCk ){
    return btreeCellSizeCheck(pPage);
  }
  return SQLITE_OK;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x48(%rdi), %r14
movq 0x50(%rdi), %r15
movzbl 0x9(%rdi), %r12d
movzbl (%r15,%r12), %esi
callq 0x234a71
testl %eax, %eax
je 0x2349cb
movl $0x103bb, %edi          # imm = 0x103BB
jmp 0x234a2f
addq %r12, %r15
movl 0x34(%r14), %eax
leal -0x1(%rax), %ecx
movw %cx, 0x1a(%rbx)
movb $0x0, 0xc(%rbx)
movzbl 0x9(%rbx), %ecx
movzbl 0xa(%rbx), %edx
leal 0x8(%rcx,%rdx), %ecx
movw %cx, 0x12(%rbx)
leaq 0x8(%r15,%rdx), %rcx
movq %rcx, 0x60(%rbx)
movq 0x50(%rbx), %rcx
movl 0x38(%r14), %esi
addq %rcx, %rsi
movq %rsi, 0x58(%rbx)
addq %rdx, %rcx
movq %rcx, 0x68(%rbx)
movzwl 0x3(%r15), %ecx
rolw $0x8, %cx
movzwl %cx, %ecx
movw %cx, 0x18(%rbx)
addl $-0x8, %eax
pushq $0x6
popq %rsi
xorl %edx, %edx
divl %esi
cmpl %ecx, %eax
jae 0x234a3f
movl $0x103c9, %edi          # imm = 0x103C9
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x232547
orl $-0x1, 0x14(%rbx)
movb $0x1, (%rbx)
movq 0x8(%r14), %rax
testb $0x20, 0x32(%rax)
jne 0x234a5e
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x234b16