// File: /workspace/github_c_makefile_star2_O1/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 0x292e81
movl %ecx, %r15d
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %rbx
movq 0x118(%rdi), %rax
movzbl 0x2d(%rax), %edx
andl $0x3, %edx
movq 0x40(%rax), %rdi
callq *0x233902(%rip)         # 0x4c6740
movq %rax, %r12
testq %rax, %rax
je 0x292eb2
movq 0x118(%rbx), %rdi
movl %ebp, %esi
movq %r12, %rdx
callq 0x2930e5
movq %rax, %r12
movq %rax, (%r14)
testb $0x1, %r15b
jne 0x292f03
cmpq $0x0, 0x28(%r12)
je 0x292f03
incl 0xf0(%rbx)
xorl %r13d, %r13d
jmp 0x29307b
leaq 0x14c497(%rip), %rsi    # 0x3df31f
leaq 0x14c5a1(%rip), %rdx    # 0x3df430
leaq 0x14c2ef(%rip), %r8     # 0x3df185
movl $0xb, %r13d
movl $0xb, %edi
movl $0xdf59, %ecx           # imm = 0xDF59
xorl %eax, %eax
callq 0x27e637
jmp 0x29307b
movq %r14, (%rsp)
movq 0x118(%rbx), %r14
xorl %r13d, %r13d
cmpb $0x2, 0x2d(%r14)
je 0x293046
movq 0x40(%r14), %rdi
callq *0x233863(%rip)         # 0x4c6738
cmpl 0x20(%r14), %eax
jle 0x293023
movq 0x10(%r14), %rsi
testq %rsi, %rsi
je 0x292fe8
cmpw $0x0, 0x36(%rsi)
jne 0x292efd
testb $0x8, 0x34(%rsi)
je 0x293006
movq 0x40(%rsi), %rsi
jmp 0x292ee3
movl 0x233bb7(%rip), %eax    # 0x4c6ac0
cltd
idivl 0xbc(%rbx)
incl %eax
cmpl %ebp, %eax
jne 0x292f47
leaq 0x14c402(%rip), %rsi    # 0x3df31f
leaq 0x14c50c(%rip), %rdx    # 0x3df430
leaq 0x14c25a(%rip), %r8     # 0x3df185
movl $0xb, %r13d
movl $0xb, %edi
movl $0xdf79, %ecx           # imm = 0xDF79
xorl %eax, %eax
callq 0x27e637
jmp 0x293052
movq %rbx, 0x28(%r12)
movq 0x48(%rbx), %rax
cmpq $0x0, (%rax)
je 0x292f7f
testb $0x1, %r15b
jne 0x292f7f
cmpl %ebp, 0x1c(%rbx)
jb 0x292f7f
incl 0xf4(%rbx)
movq %r12, %rdi
callq 0x293131
movl %eax, %r13d
testl %eax, %eax
jne 0x293052
jmp 0x292e79
movl $0xd, %r13d
cmpl %ebp, 0xc0(%rbx)
jb 0x293052
testb $0x1, %r15b
je 0x292fcd
movq 0x236eaa(%rip), %rax    # 0x4c9e48
testq %rax, %rax
je 0x292fa5
callq *%rax
cmpl %ebp, 0x20(%rbx)
jb 0x292fb5
movq 0x40(%rbx), %rdi
movl %ebp, %esi
callq 0x290c97
movq %rbx, %rdi
movl %ebp, %esi
callq 0x29079d
movq 0x236e8a(%rip), %rax    # 0x4c9e50
testq %rax, %rax
je 0x292fcd
callq *%rax
movq 0x8(%r12), %rdi
movslq 0xbc(%rbx), %rdx
xorl %r13d, %r13d
xorl %esi, %esi
callq 0x173a0
jmp 0x29307b
movq %rsi, 0x10(%r14)
movq 0x8(%r14), %rsi
testq %rsi, %rsi
je 0x293002
cmpw $0x0, 0x36(%rsi)
je 0x29300a
movq 0x40(%rsi), %rsi
jmp 0x292ff0
xorl %esi, %esi
jmp 0x29300a
movq %rsi, 0x10(%r14)
testq %rsi, %rsi
je 0x293023
movq 0x38(%r14), %rdi
callq *0x30(%r14)
cmpl $0x5, %eax
je 0x293023
movl %eax, %r13d
testl %eax, %eax
jne 0x293046
movq 0x40(%r14), %rdi
movl %ebp, %esi
movl $0x2, %edx
callq *0x23370c(%rip)         # 0x4c6740
movq %rax, %r12
xorl %eax, %eax
testq %r12, %r12
movl $0x7, %r13d
cmovnel %eax, %r13d
testl %r13d, %r13d
je 0x29308d
xorl %r12d, %r12d
movq (%rsp), %r14
testq %r12, %r12
je 0x29305f
movq %r12, %rdi
callq 0x293205
movq 0x118(%rbx), %rax
cmpl $0x0, 0x18(%rax)
jne 0x293074
movq %rbx, %rdi
callq 0x293239
movq $0x0, (%r14)
movl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %r12, %r12
movq (%rsp), %r14
jne 0x292e46
movl $0x7, %r13d
xorl %r12d, %r12d
jmp 0x293052