// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: pagerStress
static int pagerStress(void *p, PgHdr *pPg){
  Pager *pPager = (Pager *)p;
  int rc = SQLITE_OK;

  assert( pPg->pPager==pPager );
  assert( pPg->flags&PGHDR_DIRTY );

  /* The doNotSpill NOSYNC bit is set during times when doing a sync of
  ** journal (and adding a new header) is not allowed.  This occurs
  ** during calls to sqlite3PagerWrite() while trying to journal multiple
  ** pages belonging to the same sector.
  **
  ** The doNotSpill ROLLBACK and OFF bits inhibits all cache spilling
  ** regardless of whether or not a sync is required.  This is set during
  ** a rollback or by user request, respectively.
  **
  ** Spilling is also prohibited when in an error state since that could
  ** lead to database corruption.   In the current implementation it
  ** is impossible for sqlite3PcacheFetch() to be called with createFlag==3
  ** while in the error state, hence it is impossible for this routine to
  ** be called in the error state.  Nevertheless, we include a NEVER()
  ** test for the error state as a safeguard against future changes.
  */
  if( NEVER(pPager->errCode) ) return SQLITE_OK;
  testcase( pPager->doNotSpill & SPILLFLAG_ROLLBACK );
  testcase( pPager->doNotSpill & SPILLFLAG_OFF );
  testcase( pPager->doNotSpill & SPILLFLAG_NOSYNC );
  if( pPager->doNotSpill
   && ((pPager->doNotSpill & (SPILLFLAG_ROLLBACK|SPILLFLAG_OFF))!=0
      || (pPg->flags & PGHDR_NEED_SYNC)!=0)
  ){
    return SQLITE_OK;
  }

  pPager->aStat[PAGER_STAT_SPILL]++;
  pPg->pDirty = 0;
  if( pagerUseWal(pPager) ){
    /* Write a single frame for this page to the log. */
    rc = subjournalPageIfRequired(pPg);
    if( rc==SQLITE_OK ){
      rc = pagerWalFrames(pPager, pPg, 0, 0);
    }
  }else{

#ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE
    if( pPager->tempFile==0 ){
      rc = sqlite3JournalCreate(pPager->jfd);
      if( rc!=SQLITE_OK ) return pager_error(pPager, rc);
    }
#endif

    /* Sync the journal file if required. */
    if( pPg->flags&PGHDR_NEED_SYNC
     || pPager->eState==PAGER_WRITER_CACHEMOD
    ){
      rc = syncJournal(pPager, 1);
    }

    /* Write the contents of the page out to the database file. */
    if( rc==SQLITE_OK ){
      assert( (pPg->flags&PGHDR_NEED_SYNC)==0 );
      rc = pager_write_pagelist(pPager, pPg);
    }
  }

  /* Mark the page as clean. */
  if( rc==SQLITE_OK ){
    PAGERTRACE(("STRESS %d page %d\n", PAGERID(pPager), pPg->pgno));
    sqlite3PcacheMakeClean(pPg);
  }

  return pager_error(pPager, rc);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, 0x2c(%rax)
je 0x3dbd45
movl $0x0, -0x4(%rbp)
jmp 0x3dbe37
movq -0x20(%rbp), %rax
movzbl 0x18(%rax), %eax
cmpl $0x0, %eax
je 0x3dbd7e
movq -0x20(%rbp), %rax
movzbl 0x18(%rax), %eax
andl $0x3, %eax
cmpl $0x0, %eax
jne 0x3dbd72
movq -0x18(%rbp), %rax
movzwl 0x34(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x3dbd7e
movl $0x0, -0x4(%rbp)
jmp 0x3dbe37
movq -0x20(%rbp), %rax
movl 0xfc(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xfc(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x120(%rax)
je 0x3dbdd3
movq -0x18(%rbp), %rdi
callq 0x3dc0b0
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x3dbdd1
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
xorl %ecx, %ecx
movl %ecx, %edx
callq 0x3dc0f0
movl %eax, -0x24(%rbp)
jmp 0x3dbe19
movq -0x18(%rbp), %rax
movzwl 0x34(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
jne 0x3dbdf0
movq -0x20(%rbp), %rax
movzbl 0x14(%rax), %eax
cmpl $0x3, %eax
jne 0x3dbe01
movq -0x20(%rbp), %rdi
movl $0x1, %esi
callq 0x3dc220
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x3dbe17
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x3dc4a0
movl %eax, -0x24(%rbp)
jmp 0x3dbe19
cmpl $0x0, -0x24(%rbp)
jne 0x3dbe28
movq -0x18(%rbp), %rdi
callq 0x3dc690
movq -0x20(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x3dc6f0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq