// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3PcacheFetchStress
SQLITE_PRIVATE int sqlite3PcacheFetchStress(
  PCache *pCache,                 /* Obtain the page from this cache */
  Pgno pgno,                      /* Page number to obtain */
  sqlite3_pcache_page **ppPage    /* Write result here */
){
  PgHdr *pPg;
  if( pCache->eCreate==2 ) return 0;

  if( sqlite3PcachePagecount(pCache)>pCache->szSpill ){
    /* Find a dirty page to write-out and recycle. First try to find a
    ** page that does not require a journal-sync (one with PGHDR_NEED_SYNC
    ** cleared), but if that is not possible settle for any other
    ** unreferenced dirty page.
    **
    ** If the LRU page in the dirty list that has a clear PGHDR_NEED_SYNC
    ** flag is currently referenced, then the following may leave pSynced
    ** set incorrectly (pointing to other than the LRU page with NEED_SYNC
    ** cleared). This is Ok, as pSynced is just an optimization.  */
    for(pPg=pCache->pSynced;
        pPg && (pPg->nRef || (pPg->flags&PGHDR_NEED_SYNC));
        pPg=pPg->pDirtyPrev
    );
    pCache->pSynced = pPg;
    if( !pPg ){
      for(pPg=pCache->pDirtyTail; pPg && pPg->nRef; pPg=pPg->pDirtyPrev);
    }
    if( pPg ){
      int rc;
#ifdef SQLITE_LOG_CACHE_SPILL
      sqlite3_log(SQLITE_FULL,
                  "spill page %d making room for %d - cache used: %d/%d",
                  pPg->pgno, pgno,
                  sqlite3GlobalConfig.pcache2.xPagecount(pCache->pCache),
                numberOfCachePages(pCache));
#endif
      pcacheTrace(("%p.SPILL %d\n",pCache,pPg->pgno));
      rc = pCache->xStress(pCache->pStress, pPg);
      pcacheDump(pCache);
      if( rc!=SQLITE_OK && rc!=SQLITE_BUSY ){
        return rc;
      }
    }
  }
  *ppPage = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, pgno, 2);
  return *ppPage==0 ? SQLITE_NOMEM_BKPT : SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x2d(%rax), %eax
cmpl $0x2, %eax
jne 0x3e12ec
movl $0x0, -0x4(%rbp)
jmp 0x3e1429
movq -0x10(%rbp), %rdi
callq 0x3da150
movq -0x10(%rbp), %rcx
cmpl 0x20(%rcx), %eax
jle 0x3e13ee
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x28(%rbp)
movb %al, -0x2d(%rbp)
je 0x3e1346
movq -0x28(%rbp), %rax
movswl 0x36(%rax), %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x2e(%rbp)
jne 0x3e1340
movq -0x28(%rbp), %rax
movzwl 0x34(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x2e(%rbp)
movb -0x2e(%rbp), %al
movb %al, -0x2d(%rbp)
movb -0x2d(%rbp), %al
testb $0x1, %al
jne 0x3e134f
jmp 0x3e135f
jmp 0x3e1351
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x3e130e
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
cmpq $0x0, -0x28(%rbp)
jne 0x3e13b6
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x28(%rbp)
movb %al, -0x2f(%rbp)
je 0x3e139b
movq -0x28(%rbp), %rax
movswl 0x36(%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x2f(%rbp)
movb -0x2f(%rbp), %al
testb $0x1, %al
jne 0x3e13a4
jmp 0x3e13b4
jmp 0x3e13a6
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x3e137e
jmp 0x3e13b6
cmpq $0x0, -0x28(%rbp)
je 0x3e13ec
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x38(%rcx), %rdi
movq -0x28(%rbp), %rsi
callq *%rax
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x3e13ea
cmpl $0x5, -0x2c(%rbp)
je 0x3e13ea
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x3e1429
jmp 0x3e13ec
jmp 0x3e13ee
movq 0x25e53b(%rip), %rax    # 0x63f930
movq -0x10(%rbp), %rcx
movq 0x40(%rcx), %rdi
movl -0x14(%rbp), %esi
movl $0x2, %edx
callq *%rax
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rdx
xorl %eax, %eax
movl $0x7, %ecx
cmpq $0x0, %rdx
cmovel %ecx, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)