// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: pagerWalFrames
static int pagerWalFrames(
  Pager *pPager,                  /* Pager object */
  PgHdr *pList,                   /* List of frames to log */
  Pgno nTruncate,                 /* Database size after this commit */
  int isCommit                    /* True if this is a commit */
){
  int rc;                         /* Return code */
  int nList;                      /* Number of pages in pList */
#if defined(SQLITE_DEBUG) || defined(SQLITE_CHECK_PAGES)
  PgHdr *p;                       /* For looping over pages */
#endif

  assert( pPager->pWal );
  assert( pList );
#ifdef SQLITE_DEBUG
  /* Verify that the page list is in accending order */
  for(p=pList; p && p->pDirty; p=p->pDirty){
    assert( p->pgno < p->pDirty->pgno );
  }
#endif

  assert( pList->pDirty==0 || isCommit );
  if( isCommit ){
    /* If a WAL transaction is being committed, there is no point in writing
    ** any pages with page numbers greater than nTruncate into the WAL file.
    ** They will never be read by any client. So remove them from the pDirty
    ** list here. */
    PgHdr *p;
    PgHdr **ppNext = &pList;
    nList = 0;
    for(p=pList; (*ppNext = p)!=0; p=p->pDirty){
      if( p->pgno<=nTruncate ){
        ppNext = &p->pDirty;
        nList++;
      }
    }
    assert( pList );
  }else{
    nList = 1;
  }
  pPager->aStat[PAGER_STAT_WRITE] += nList;

  if( pList->pgno==1 ) pager_write_changecounter(pList);
  rc = sqlite3WalFrames(pPager->pWal, 
      pPager->pageSize, pList, nTruncate, isCommit, pPager->walSyncFlags
  );
  if( rc==SQLITE_OK && pPager->pBackup ){
    PgHdr *p;
    for(p=pList; p; p=p->pDirty){
      sqlite3BackupUpdate(pPager->pBackup, p->pgno, (u8 *)p->pData);
    }
  }

#ifdef SQLITE_CHECK_PAGES
  pList = sqlite3PcacheDirtyList(pPager->pPCache);
  for(p=pList; p; p=p->pDirty){
    pager_set_pagehash(p);
  }
#endif

  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
je 0x213d7
leaq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
je 0x213d5
movq -0x28(%rbp), %rax
movl 0x28(%rax), %eax
cmpl -0x14(%rbp), %eax
ja 0x213c5
movq -0x28(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x30(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x213c7
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x21393
jmp 0x213de
movl $0x1, -0x20(%rbp)
movl -0x20(%rbp), %ecx
movq -0x8(%rbp), %rax
addl 0xf8(%rax), %ecx
movl %ecx, 0xf8(%rax)
movq -0x10(%rbp), %rax
cmpl $0x1, 0x28(%rax)
jne 0x21404
movq -0x10(%rbp), %rdi
callq 0x223a0
movq -0x8(%rbp), %rax
movq 0x118(%rax), %rdi
movq -0x8(%rbp), %rax
movl 0xbc(%rax), %esi
movq -0x10(%rbp), %rdx
movl -0x14(%rbp), %ecx
movl -0x18(%rbp), %r8d
movq -0x8(%rbp), %rax
movzbl 0xe(%rax), %r9d
callq 0x22410
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x21481
movq -0x8(%rbp), %rax
cmpq $0x0, 0x70(%rax)
je 0x21481
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x2147f
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rdi
movq -0x38(%rbp), %rax
movl 0x28(%rax), %esi
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdx
callq 0x22970
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x2144e
jmp 0x21481
movl -0x1c(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)