// File: /workspace/github_c_makefile_star2_O2/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:
testl %esi, %esi
je 0x232cab
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
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 *0x207a7d(%rip)         # 0x43a6f0
testq %rax, %rax
je 0x232cb5
movq 0x118(%rbx), %rdi
movl %ebp, %esi
movq %rax, %rdx
callq 0x232e8f
movq %rax, %r12
movq %rax, (%r14)
testb $0x1, %r15b
jne 0x232d0d
cmpq $0x0, 0x28(%r12)
je 0x232d0d
incl 0xf0(%rbx)
xorl %r13d, %r13d
jmp 0x232d83
movl $0xdf59, %edi           # imm = 0xDF59
jmp 0x232547
movq 0x118(%rbx), %r12
pushq $0x7
popq %r13
cmpb $0x2, 0x2d(%r12)
je 0x232d77
movq 0x40(%r12), %rdi
callq *0x207a11(%rip)         # 0x43a6e8
cmpl 0x20(%r12), %eax
jle 0x232e2d
leaq 0x10(%r12), %rax
movq %rax, %rsi
movq (%rsi), %rsi
testq %rsi, %rsi
je 0x232d95
cmpw $0x0, 0x36(%rsi)
jne 0x232d07
testb $0x8, 0x34(%rsi)
je 0x232e10
addq $0x40, %rsi
jmp 0x232cea
movl 0x207d5d(%rip), %eax    # 0x43aa70
cltd
idivl 0xbc(%rbx)
incl %eax
cmpl %ebp, %eax
jne 0x232d2f
movl $0xdf79, %edi           # imm = 0xDF79
callq 0x232547
movl %eax, %r13d
jmp 0x232d6f
movq %rbx, 0x28(%r12)
movq 0x48(%rbx), %rax
cmpq $0x0, (%rax)
je 0x232d63
testb $0x1, %r15b
jne 0x232d63
cmpl %ebp, 0x1c(%rbx)
jb 0x232d63
incl 0xf4(%rbx)
movq %r12, %rdi
callq 0x232edb
movl %eax, %r13d
testl %eax, %eax
jne 0x232d6f
jmp 0x232ca3
cmpl %ebp, 0xc0(%rbx)
jae 0x232db9
pushq $0xd
popq %r13
movq %r12, %rdi
callq 0x232fb7
movq %rbx, %rdi
callq 0x232fe7
andq $0x0, (%r14)
movl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
andq $0x0, 0x10(%r12)
leaq 0x8(%r12), %rsi
movq (%rsi), %rsi
testq %rsi, %rsi
je 0x232e2d
cmpw $0x0, 0x36(%rsi)
je 0x232e13
addq $0x40, %rsi
jmp 0x232da0
testb $0x1, %r15b
je 0x232df5
movq 0x20b032(%rip), %rax    # 0x43ddf8
testq %rax, %rax
je 0x232dcd
callq *%rax
cmpl %ebp, 0x20(%rbx)
jb 0x232ddd
movq 0x40(%rbx), %rdi
movl %ebp, %esi
callq 0x23101a
movq %rbx, %rdi
movl %ebp, %esi
callq 0x230c7c
movq 0x20b012(%rip), %rax    # 0x43de00
testq %rax, %rax
je 0x232df5
callq *%rax
movq 0x8(%r12), %rdi
movslq 0xbc(%rbx), %rdx
xorl %r13d, %r13d
xorl %esi, %esi
callq 0x17380
jmp 0x232d83
movq %rsi, (%rax)
movq 0x38(%r12), %rdi
callq *0x30(%r12)
cmpl $0x5, %eax
je 0x232e2d
movl %eax, %r13d
testl %eax, %eax
jne 0x232d77
movq 0x40(%r12), %rdi
pushq $0x2
popq %rdx
movl %ebp, %esi
callq *0x2078b3(%rip)         # 0x43a6f0
pushq $0x7
popq %r13
testq %rax, %rax
jne 0x232c78
jmp 0x232d77