// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: getPageNormal
static int getPageNormal(
  Pager *pPager,      /* The pager open on the database file */
  Pgno pgno,          /* Page number to fetch */
  DbPage **ppPage,    /* Write a pointer to the page here */
  int flags           /* PAGER_GET_XXX flags */
){
  int rc = SQLITE_OK;
  PgHdr *pPg;
  u8 noContent;                   /* True if PAGER_GET_NOCONTENT is set */
  sqlite3_pcache_page *pBase;

  assert( pPager->errCode==SQLITE_OK );
  assert( pPager->eState>=PAGER_READER );
  assert( assert_pager_state(pPager) );
  assert( pPager->hasHeldSharedLock==1 );

  if( pgno==0 ) return SQLITE_CORRUPT_BKPT;
  pBase = sqlite3PcacheFetch(pPager->pPCache, pgno, 3);
  if( pBase==0 ){
    pPg = 0;
    rc = sqlite3PcacheFetchStress(pPager->pPCache, pgno, &pBase);
    if( rc!=SQLITE_OK ) goto pager_acquire_err;
    if( pBase==0 ){
      rc = SQLITE_NOMEM_BKPT;
      goto pager_acquire_err;
    }
  }
  pPg = *ppPage = sqlite3PcacheFetchFinish(pPager->pPCache, pgno, pBase);
  assert( pPg==(*ppPage) );
  assert( pPg->pgno==pgno );
  assert( pPg->pPager==pPager || pPg->pPager==0 );

  noContent = (flags & PAGER_GET_NOCONTENT)!=0;
  if( pPg->pPager && !noContent ){
    /* In this case the pcache already contains an initialized copy of
    ** the page. Return without further ado.  */
    assert( pgno!=PAGER_MJ_PGNO(pPager) );
    pPager->aStat[PAGER_STAT_HIT]++;
    return SQLITE_OK;

  }else{
    /* The pager cache has created a new page. Its content needs to
    ** be initialized. But first some error checks:
    **
    ** (*) obsolete.  Was: maximum page number is 2^31
    ** (2) Never try to fetch the locking page
    */
    if( pgno==PAGER_MJ_PGNO(pPager) ){
      rc = SQLITE_CORRUPT_BKPT;
      goto pager_acquire_err;
    }

    pPg->pPager = pPager;

    assert( !isOpen(pPager->fd) || !MEMDB );
    if( !isOpen(pPager->fd) || pPager->dbSize<pgno || noContent ){
      if( pgno>pPager->mxPgno ){
        rc = SQLITE_FULL;
        goto pager_acquire_err;
      }
      if( noContent ){
        /* Failure to set the bits in the InJournal bit-vectors is benign.
        ** It merely means that we might do some extra work to journal a
        ** page that does not need to be journaled.  Nevertheless, be sure
        ** to test the case where a malloc error occurs while trying to set
        ** a bit in a bit vector.
        */
        sqlite3BeginBenignMalloc();
        if( pgno<=pPager->dbOrigSize ){
          TESTONLY( rc = ) sqlite3BitvecSet(pPager->pInJournal, pgno);
          testcase( rc==SQLITE_NOMEM );
        }
        TESTONLY( rc = ) addToSavepointBitvecs(pPager, pgno);
        testcase( rc==SQLITE_NOMEM );
        sqlite3EndBenignMalloc();
      }
      memset(pPg->pData, 0, pPager->pageSize);
      IOTRACE(("ZERO %p %d\n", pPager, pgno));
    }else{
      assert( pPg->pPager==pPager );
      pPager->aStat[PAGER_STAT_MISS]++;
      rc = readDbPage(pPg);
      if( rc!=SQLITE_OK ){
        goto pager_acquire_err;
      }
    }
    pager_set_pagehash(pPg);
  }
  return SQLITE_OK;

pager_acquire_err:
  assert( rc!=SQLITE_OK );
  if( pPg ){
    sqlite3PcacheDrop(pPg);
  }
  pagerUnlockIfUnused(pPager);
  *ppPage = 0;
  return rc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testl %esi, %esi
je 0x28903b
movl %ecx, %r15d
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %rbx
movq 0x118(%rdi), %rax
movzbl 0x2d(%rax), %edx
movq 0x40(%rax), %rdi
andl $0x3, %edx
callq *0x232745(%rip)         # 0x4bb740
testq %rax, %rax
je 0x28906c
movq 0x118(%rbx), %rdi
movl %ebp, %esi
movq %rax, %rdx
callq 0x289279
movq %rax, %r12
movq %rax, (%r14)
testb $0x1, %r15b
jne 0x2890c0
cmpq $0x0, 0x28(%r12)
je 0x2890c0
incl 0xf0(%rbx)
xorl %r13d, %r13d
jmp 0x289167
leaq 0x14cb89(%rip), %rsi    # 0x3d5bcb
leaq 0x14cc93(%rip), %rdx    # 0x3d5cdc
leaq 0x14c9e1(%rip), %r8     # 0x3d5a31
movl $0xb, %r13d
movl $0xb, %edi
movl $0xdf59, %ecx           # imm = 0xDF59
xorl %eax, %eax
callq 0x274d08
jmp 0x289167
movq 0x118(%rbx), %r12
movl $0x7, %r13d
cmpb $0x2, 0x2d(%r12)
je 0x28914b
movq 0x40(%r12), %rdi
callq *0x2326a8(%rip)         # 0x4bb738
cmpl 0x20(%r12), %eax
jle 0x289213
movq 0x10(%r12), %rsi
testq %rsi, %rsi
je 0x289179
cmpw $0x0, 0x36(%rsi)
jne 0x2890ba
testb $0x8, 0x34(%rsi)
je 0x2891f4
movq 0x40(%rsi), %rsi
jmp 0x2890a0
movl 0x2329fa(%rip), %eax    # 0x4bbac0
cltd
idivl 0xbc(%rbx)
incl %eax
cmpl %ebp, %eax
jne 0x289101
leaq 0x14caf1(%rip), %rsi    # 0x3d5bcb
leaq 0x14cbfb(%rip), %rdx    # 0x3d5cdc
leaq 0x14c949(%rip), %r8     # 0x3d5a31
movl $0xb, %r13d
movl $0xb, %edi
movl $0xdf79, %ecx           # imm = 0xDF79
xorl %eax, %eax
callq 0x274d08
jmp 0x289143
movq %rbx, 0x28(%r12)
movq 0x48(%rbx), %rax
cmpq $0x0, (%rax)
je 0x289135
testb $0x1, %r15b
jne 0x289135
cmpl %ebp, 0x1c(%rbx)
jb 0x289135
incl 0xf4(%rbx)
movq %r12, %rdi
callq 0x2892c5
movl %eax, %r13d
testl %eax, %eax
jne 0x289143
jmp 0x289033
movl $0xd, %r13d
cmpl %ebp, 0xc0(%rbx)
jae 0x28919d
movq %r12, %rdi
callq 0x2893a4
movq 0x118(%rbx), %rax
cmpl $0x0, 0x18(%rax)
jne 0x289160
movq %rbx, %rdi
callq 0x2893d8
movq $0x0, (%r14)
movl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq $0x0, 0x10(%r12)
movq 0x8(%r12), %rsi
testq %rsi, %rsi
je 0x289213
cmpw $0x0, 0x36(%rsi)
je 0x2891f9
movq 0x40(%rsi), %rsi
jmp 0x289187
testb $0x1, %r15b
je 0x2891d9
movq 0x235c9e(%rip), %rax    # 0x4bee48
testq %rax, %rax
je 0x2891b1
callq *%rax
cmpl %ebp, 0x20(%rbx)
jb 0x2891c1
movq 0x40(%rbx), %rdi
movl %ebp, %esi
callq 0x286fa5
movq %rbx, %rdi
movl %ebp, %esi
callq 0x286bec
movq 0x235c7e(%rip), %rax    # 0x4bee50
testq %rax, %rax
je 0x2891d9
callq *%rax
movq 0x8(%r12), %rdi
movslq 0xbc(%rbx), %rdx
xorl %r13d, %r13d
xorl %esi, %esi
callq 0x173a0
jmp 0x289167
movq %rsi, 0x10(%r12)
movq 0x38(%r12), %rdi
callq *0x30(%r12)
cmpl $0x5, %eax
je 0x289213
movl %eax, %r13d
testl %eax, %eax
jne 0x28914b
movq 0x40(%r12), %rdi
movl %ebp, %esi
movl $0x2, %edx
callq *0x23251b(%rip)         # 0x4bb740
movl $0x7, %r13d
testq %rax, %rax
jne 0x289000
jmp 0x28914b