// File: /workspace/github_c_makefile_star2_O3/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 %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x48(%rdi), %r14
movq 0x50(%rdi), %r15
movzbl 0x9(%rdi), %r12d
movzbl (%r15,%r12), %esi
callq 0x28b120
testl %eax, %eax
je 0x28b05f
leaq 0x14ab8e(%rip), %rsi    # 0x3d5bcb
leaq 0x14ac98(%rip), %rdx    # 0x3d5cdc
leaq 0x14a9e6(%rip), %r8     # 0x3d5a31
movl $0xb, %ebp
movl $0xb, %edi
movl $0x103bb, %ecx          # imm = 0x103BB
jmp 0x28b0e8
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
movl $0xaaaaaaab, %edx       # imm = 0xAAAAAAAB
imulq %rax, %rdx
shrq $0x22, %rdx
cmpl %ecx, %edx
jae 0x28b0fa
leaq 0x14ab00(%rip), %rsi    # 0x3d5bcb
leaq 0x14ac0a(%rip), %rdx    # 0x3d5cdc
leaq 0x14a958(%rip), %r8     # 0x3d5a31
movl $0xb, %ebp
movl $0xb, %edi
movl $0x103c9, %ecx          # imm = 0x103C9
xorl %eax, %eax
callq 0x274d08
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0xffffffff, 0x14(%rbx) # imm = 0xFFFFFFFF
movb $0x1, (%rbx)
movq 0x8(%r14), %rax
xorl %ebp, %ebp
testb $0x20, 0x32(%rax)
je 0x28b0ef
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x28b1f4