// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, -0x90(%rbp)
movl %ecx, -0x30(%rbp)
testl %ecx, %ecx
je 0x1a7d7
xorl %eax, %eax
leaq -0x90(%rbp), %rcx
xorl %edi, %edi
cmpl %edx, 0x28(%r14)
setbe %dil
leaq 0x18(%r14), %rsi
cmovbeq %rsi, %rcx
addl %edi, %eax
movq 0x18(%r14), %r14
movq %r14, (%rcx)
testq %r14, %r14
jne 0x1a7ae
movq -0x90(%rbp), %r14
jmp 0x1a7dc
movl $0x1, %eax
movl %edx, -0x34(%rbp)
addl %eax, 0xf8(%rbx)
cmpl $0x1, 0x28(%r14)
jne 0x1a7f4
movq %r14, %rdi
callq 0x1b67c
movq 0x118(%rbx), %r12
movl 0xbc(%rbx), %ecx
movq %rbx, -0x88(%rbp)
movzbl 0xe(%rbx), %r13d
cmpw $0x0, 0x3c(%r12)
movl %ecx, -0x2c(%rbp)
je 0x1a8db
movl 0x58(%r12), %r15d
testq %r15, %r15
je 0x1a97c
movslq %ecx, %rax
movq %r12, -0xb8(%rbp)
movq %r12, -0x48(%rbp)
movq 0x10(%r12), %rdx
movq %rdx, -0x98(%rbp)
movq %rdx, -0xb0(%rbp)
movq $0x0, -0xa8(%rbp)
movl %r13d, -0x40(%rbp)
movl %r13d, -0xa0(%rbp)
movl %ecx, -0x9c(%rbp)
addq $0x18, %rax
movq %r15, %r12
movq %rax, -0x58(%rbp)
imulq %rax, %r12
addq $0x20, %r12
xorl %r13d, %r13d
testq %r14, %r14
je 0x1aa57
movq %r14, %rax
movq %rax, %rbx
cmpl $0x0, -0x30(%rbp)
je 0x1a8a3
cmpq $0x0, 0x18(%rbx)
movl $0x0, %ecx
cmovel -0x34(%rbp), %ecx
jmp 0x1a8a5
xorl %ecx, %ecx
movq 0x8(%rbx), %rsi
movl 0x28(%rbx), %edx
leaq -0xb8(%rbp), %rdi
movq %r12, %r8
callq 0x1b76b
testl %eax, %eax
jne 0x1aa50
movq %rbx, %rcx
addq -0x58(%rbp), %r12
movq 0x18(%rbx), %rax
incl %r15d
testq %rax, %rax
jne 0x1a88a
jmp 0x1aa59
movq 0x30(%r12), %rax
movq (%rax), %r15
cmpl $0x0, 0x60(%r15)
je 0x1ab17
leaq -0x80(%rbp), %rsi
movl $0x4, %edi
callq 0xbad4
cmpb $0x0, 0x3f(%r12)
je 0x1aaec
incl 0x80(%r12)
xorl %ebx, %ebx
movl %ebx, 0x58(%r12)
movl 0x68(%r12), %eax
bswapl %eax
incl %eax
bswapl %eax
movl %eax, 0x68(%r12)
movl -0x80(%rbp), %eax
movl %eax, 0x6c(%r12)
movq %r12, %rdi
callq 0x1ba11
movl %ebx, 0x60(%r15)
movl %ebx, 0x68(%r15)
movl $0xffffffff, 0x6c(%r15,%rbx,4) # imm = 0xFFFFFFFF
incq %rbx
cmpq $0x3, %rbx
jne 0x1a93f
cmpb $0x0, 0x3f(%r12)
jne 0x1ab17
movq 0x8(%r12), %rdi
movq (%rdi), %rax
movl $0x4, %esi
movl $0x4, %edx
movl $0x9, %ecx
callq *0x70(%rax)
jmp 0x1ab17
movabsq $0x18e22d0082067f37, %rax # imm = 0x18E22D0082067F37
movq %rax, -0x80(%rbp)
movl %ecx, %eax
shrl $0x18, %eax
movb %al, -0x78(%rbp)
movl %ecx, %eax
shrl $0x10, %eax
movb %al, -0x77(%rbp)
movb %ch, -0x76(%rbp)
movb %cl, -0x75(%rbp)
movl 0x80(%r12), %eax
movl %eax, %ecx
bswapl %ecx
movl %ecx, -0x74(%rbp)
testl %eax, %eax
jne 0x1a9c2
leaq 0x68(%r12), %rsi
movl $0x8, %edi
callq 0xbad4
movq 0x68(%r12), %rax
movq %rax, -0x70(%rbp)
xorl %eax, %eax
movq $-0x8, %rdx
xorl %ecx, %ecx
addl %eax, %ecx
addl -0x78(%rbp,%rdx), %ecx
addl -0x74(%rbp,%rdx), %eax
addl %ecx, %eax
addq $0x8, %rdx
cmpq $0x10, %rdx
jb 0x1a9d6
movl %ecx, %edx
shrl $0x18, %edx
leaq -0x80(%rbp), %rsi
movb %dl, 0x18(%rsi)
movl %ecx, %edx
shrl $0x10, %edx
movb %dl, 0x19(%rsi)
movb %ch, -0x66(%rbp)
movb %cl, 0x1b(%rsi)
movl %eax, %edx
shrl $0x18, %edx
movb %dl, 0x1c(%rsi)
movl %eax, %edx
shrl $0x10, %edx
movb %dl, 0x1d(%rsi)
movb %ah, -0x62(%rbp)
movb %al, 0x1f(%rsi)
movl -0x2c(%rbp), %edx
movl %edx, 0x38(%r12)
movb $0x0, 0x55(%r12)
movl %ecx, 0x60(%r12)
movl %eax, 0x64(%r12)
movb $0x1, 0x43(%r12)
movq 0x10(%r12), %rdi
movq (%rdi), %rax
movl $0x20, %edx
xorl %ecx, %ecx
callq *0x18(%rax)
testl %eax, %eax
je 0x1aabe
movl %eax, %ebx
jmp 0x1ad3a
xorl %ecx, %ecx
movq %rcx, -0x50(%rbp)
cmpl $0x0, -0x30(%rbp)
sete %al
testb $0x20, -0x40(%rbp)
sete %cl
orb %al, %cl
je 0x1aa80
xorl %ebx, %ebx
cmpl $0x0, -0x30(%rbp)
jne 0x1ac07
jmp 0x1ac41
movq -0x48(%rbp), %rax
cmpb $0x0, 0x45(%rax)
je 0x1ab80
movq 0x10(%rax), %rdi
movq (%rdi), %rax
movq 0x58(%rax), %rax
testq %rax, %rax
je 0x1ab9a
callq *%rax
movl $0x10000, %edx          # imm = 0x10000
cmpl %edx, %eax
cmovbl %eax, %edx
cmpl $0x20, %eax
movl $0x200, %ecx            # imm = 0x200
cmovgel %edx, %ecx
jmp 0x1ab9f
testl %r13d, %r13d
je 0x1aae4
cmpb $0x0, 0x44(%r12)
je 0x1aae4
movq 0x10(%r12), %rdi
movl %r13d, %esi
andl $0x13, %esi
movq (%rdi), %rax
callq *0x28(%rax)
testl %eax, %eax
jne 0x1aa50
movl -0x2c(%rbp), %ecx
jmp 0x1a82b
movq 0x8(%r12), %rdi
movq (%rdi), %rax
movl $0x4, %esi
movl $0x4, %edx
movl $0xa, %ecx
callq *0x70(%rax)
cmpl $0x5, %eax
je 0x1ab17
movl %eax, %ebx
testl %eax, %eax
je 0x1a908
jmp 0x1ab70
movl %r13d, -0x40(%rbp)
cmpb $0x0, 0x3f(%r12)
jne 0x1ab3d
movq 0x8(%r12), %rdi
movq (%rdi), %rax
movl $0x3, %esi
movl $0x1, %edx
movl $0x5, %ecx
callq *0x70(%rax)
movw $0xffff, 0x3c(%r12)     # imm = 0xFFFF
movl $0x1, %r15d
leaq -0x80(%rbp), %r13
movq %r12, %rdi
movq %r13, %rsi
movl $0x1, %edx
movl %r15d, %ecx
callq 0x1ba9b
incl %r15d
cmpl $-0x1, %eax
je 0x1ab4f
movl %eax, %ebx
movl -0x40(%rbp), %r13d
testl %ebx, %ebx
movl -0x2c(%rbp), %ecx
jne 0x1ad3a
jmp 0x1a81d
movl -0x40(%rbp), %esi
andl $0x13, %esi
movq -0x98(%rbp), %rdi
movq (%rdi), %rax
callq *0x28(%rax)
movl %eax, %ebx
xorl %r13d, %r13d
jmp 0x1ac07
movl $0x1000, %ecx           # imm = 0x1000
leaq (%rcx,%r12), %rsi
decq %rsi
movq %rsi, %rax
cqto
idivq %rcx
subq %rdx, %rsi
movq %rsi, -0xa8(%rbp)
xorl %ebx, %ebx
movl $0x0, %r13d
movq %rsi, -0x40(%rbp)
cmpq %rsi, %r12
jge 0x1ac07
xorl %r13d, %r13d
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rsi
movl 0x28(%rax), %edx
leaq -0xb8(%rbp), %rdi
movl -0x34(%rbp), %ecx
movq %r12, %r8
callq 0x1b76b
testl %eax, %eax
jne 0x1aa50
addq -0x58(%rbp), %r12
incl %r13d
cmpq -0x40(%rbp), %r12
movq -0x50(%rbp), %rax
jl 0x1abd0
jmp 0x1aa6f
movq -0x48(%rbp), %r12
cmpb $0x0, 0x43(%r12)
je 0x1ac41
movq 0x20(%r12), %rax
testq %rax, %rax
js 0x1ac41
addl %r13d, %r15d
imulq -0x58(%rbp), %r15
addq $0x20, %r15
cmpq %rax, %r15
cmovleq %rax, %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0x1b85f
movb $0x0, 0x43(%r12)
movq -0x48(%rbp), %rax
movl 0x58(%rax), %r15d
testq %r14, %r14
je 0x1ac79
testl %ebx, %ebx
jne 0x1ac79
movq %r14, %r12
incl %r15d
movl 0x28(%r12), %edx
movq -0x48(%rbp), %rdi
movl %r15d, %esi
callq 0x1b8de
movl %eax, %ebx
movq 0x18(%r12), %r12
testq %r12, %r12
je 0x1ac79
testl %ebx, %ebx
je 0x1ac55
testl %ebx, %ebx
sete %al
jne 0x1acb6
testl %r13d, %r13d
movq -0x48(%rbp), %r12
jle 0x1acba
incl %r15d
movq -0x50(%rbp), %rax
movl 0x28(%rax), %edx
movq %r12, %rdi
movl %r15d, %esi
callq 0x1b8de
movl %eax, %ebx
testl %eax, %eax
sete %al
jne 0x1acba
leal -0x1(%r13), %ecx
cmpl $0x1, %r13d
movl %ecx, %r13d
ja 0x1ac89
jmp 0x1acba
movq -0x48(%rbp), %r12
testb %al, %al
je 0x1acff
movl -0x2c(%rbp), %ecx
movl %ecx, %eax
andl $0xff00, %eax           # imm = 0xFF00
shrl $0x10, %ecx
orl %eax, %ecx
movw %cx, 0x56(%r12)
movl %r15d, 0x58(%r12)
cmpl $0x0, -0x30(%rbp)
movq %r12, %rbx
movq -0x88(%rbp), %r12
je 0x1ad0a
incl 0x50(%rbx)
movl -0x34(%rbp), %eax
movl %eax, 0x5c(%rbx)
movq %rbx, %rdi
callq 0x1ba11
movl %r15d, 0x18(%rbx)
jmp 0x1ad0a
testl %ebx, %ebx
movq -0x88(%rbp), %r12
jne 0x1ad3a
testq %r14, %r14
sete %al
cmpq $0x0, 0x70(%r12)
sete %cl
xorl %ebx, %ebx
orb %al, %cl
jne 0x1ad3a
movq 0x70(%r12), %rdi
movl 0x28(%r14), %esi
movq 0x8(%r14), %rdx
callq 0x1b6ab
movq 0x18(%r14), %r14
testq %r14, %r14
jne 0x1ad1f
movl %ebx, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq