// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x3e0d25
movl $0xdf59, %edi           # imm = 0xDF59
callq 0x3dff80
movl %eax, -0x4(%rbp)
jmp 0x3e0f21
movq -0x10(%rbp), %rax
movq 0x118(%rax), %rdi
movl -0x14(%rbp), %esi
movl $0x3, %edx
callq 0x3e1150
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x3e0d8a
movq $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x118(%rax), %rdi
movl -0x14(%rbp), %esi
leaq -0x40(%rbp), %rdx
callq 0x3e12c0
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
je 0x3e0d75
jmp 0x3e0ef7
cmpq $0x0, -0x40(%rbp)
jne 0x3e0d88
movl $0x7, -0x28(%rbp)
jmp 0x3e0ef7
jmp 0x3e0d8a
movq -0x10(%rbp), %rax
movq 0x118(%rax), %rdi
movl -0x14(%rbp), %esi
movq -0x40(%rbp), %rdx
callq 0x3e11a0
movq -0x20(%rbp), %rcx
movq %rax, (%rcx)
movq %rax, -0x30(%rbp)
movl -0x24(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
movb %al, -0x31(%rbp)
movq -0x30(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x3e0df0
cmpb $0x0, -0x31(%rbp)
jne 0x3e0df0
movq -0x10(%rbp), %rax
movl 0xf0(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xf0(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x3e0f21
movl -0x14(%rbp), %eax
movl %eax, -0x44(%rbp)
movl 0x25eeb4(%rip), %eax    # 0x63fcb0
movq -0x10(%rbp), %rcx
cltd
idivl 0xbc(%rcx)
movl %eax, %ecx
movl -0x44(%rbp), %eax
addl $0x1, %ecx
cmpl %ecx, %eax
jne 0x3e0e25
movl $0xdf79, %edi           # imm = 0xDF79
callq 0x3dff80
movl %eax, -0x28(%rbp)
jmp 0x3e0ef7
movq -0x10(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
cmpq $0x0, (%rax)
je 0x3e0e54
movq -0x10(%rbp), %rax
movl 0x1c(%rax), %eax
cmpl -0x14(%rbp), %eax
jb 0x3e0e54
movzbl -0x31(%rbp), %eax
cmpl $0x0, %eax
je 0x3e0ec3
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0xc0(%rcx), %eax
jbe 0x3e0e6f
movl $0xd, -0x28(%rbp)
jmp 0x3e0ef7
cmpb $0x0, -0x31(%rbp)
je 0x3e0ea7
callq 0x3e01d0
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x20(%rcx), %eax
ja 0x3e0e96
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
movl -0x14(%rbp), %esi
callq 0x3dd250
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x3dcac0
callq 0x3e0220
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movslq 0xbc(%rax), %rdx
xorl %esi, %esi
callq 0x19360
jmp 0x3e0eec
movq -0x10(%rbp), %rax
movl 0xf4(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xf4(%rax)
movq -0x30(%rbp), %rdi
callq 0x3e1440
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
je 0x3e0eea
jmp 0x3e0ef7
jmp 0x3e0eec
jmp 0x3e0eee
movl $0x0, -0x4(%rbp)
jmp 0x3e0f21
cmpq $0x0, -0x30(%rbp)
je 0x3e0f07
movq -0x30(%rbp), %rdi
callq 0x3e15a0
movq -0x10(%rbp), %rdi
callq 0x3e1610
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
movl -0x28(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)