// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3PagerSetPagesize
SQLITE_PRIVATE int sqlite3PagerSetPagesize(Pager *pPager, u32 *pPageSize, int nReserve){
  int rc = SQLITE_OK;

  /* It is not possible to do a full assert_pager_state() here, as this
  ** function may be called from within PagerOpen(), before the state
  ** of the Pager object is internally consistent.
  **
  ** At one point this function returned an error if the pager was in 
  ** PAGER_ERROR state. But since PAGER_ERROR state guarantees that
  ** there is at least one outstanding page reference, this function
  ** is a no-op for that case anyhow.
  */

  u32 pageSize = *pPageSize;
  assert( pageSize==0 || (pageSize>=512 && pageSize<=SQLITE_MAX_PAGE_SIZE) );
  if( (pPager->memDb==0 || pPager->dbSize==0)
   && sqlite3PcacheRefCount(pPager->pPCache)==0 
   && pageSize && pageSize!=(u32)pPager->pageSize 
  ){
    char *pNew = NULL;             /* New temp space */
    i64 nByte = 0;

    if( pPager->eState>PAGER_OPEN && isOpen(pPager->fd) ){
      rc = sqlite3OsFileSize(pPager->fd, &nByte);
    }
    if( rc==SQLITE_OK ){
      pNew = (char *)sqlite3PageMalloc(pageSize);
      if( !pNew ) rc = SQLITE_NOMEM;
    }

    if( rc==SQLITE_OK ){
      pager_reset(pPager);
      pPager->dbSize = (Pgno)((nByte+pageSize-1)/pageSize);
      pPager->pageSize = pageSize;
      sqlite3PageFree(pPager->pTmpSpace);
      pPager->pTmpSpace = pNew;
      sqlite3PcacheSetPageSize(pPager->pPCache, pageSize);
    }
  }

  *pPageSize = pPager->pageSize;
  if( rc==SQLITE_OK ){
    if( nReserve<0 ) nReserve = pPager->nReserve;
    assert( nReserve>=0 && nReserve<1000 );
    pPager->nReserve = (i16)nReserve;
    pagerReportSize(pPager);
    pagerFixMaplimit(pPager);
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %rbx
movl (%rsi), %r12d
cmpb $0x0, 0x12(%rdi)
je 0x1a297
cmpl $0x0, 0x1c(%rbx)
jne 0x1a37c
movq 0x110(%rbx), %rax
cmpl $0x0, 0x18(%rax)
sete %al
testl %r12d, %r12d
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x1a37c
cmpl 0xbc(%rbx), %r12d
je 0x1a37c
movq $0x0, -0x30(%rbp)
cmpb $0x0, 0x13(%rbx)
je 0x1a2ec
movq 0x48(%rbx), %rdi
movq (%rdi), %rax
testq %rax, %rax
je 0x1a2ec
leaq -0x30(%rbp), %rsi
callq *0x30(%rax)
testl %eax, %eax
jne 0x1a3b8
movl %r12d, %edi
callq 0x1cc98
testq %rax, %rax
je 0x1a3b3
movq %rax, %r13
movq 0x70(%rbx), %rax
testq %rax, %rax
je 0x1a316
movl $0x1, 0x18(%rax)
movq 0x40(%rax), %rax
jmp 0x1a304
movq 0x110(%rbx), %rdi
xorl %esi, %esi
callq 0x1cd4d
movq -0x30(%rbp), %rax
addq %r12, %rax
decq %rax
cqto
idivq %r12
movl %eax, 0x1c(%rbx)
movl %r12d, 0xbc(%rbx)
movq 0x108(%rbx), %rdi
callq 0x1cdc9
movq %r13, 0x108(%rbx)
movq 0x110(%rbx), %r13
movq 0x40(%r13), %rdi
testq %rdi, %rdi
je 0x1a378
leaq 0x40(%r13), %rax
movq %rax, -0x38(%rbp)
callq *0x7a192(%rip)          # 0x94500
xorps %xmm0, %xmm0
movq -0x38(%rbp), %rax
movups %xmm0, (%rax)
movl %r12d, 0x20(%r13)
movl 0xbc(%rbx), %eax
movl %eax, (%r15)
testl %r14d, %r14d
jns 0x1a392
movzwl 0xb2(%rbx), %r14d
movw %r14w, 0xb2(%rbx)
movq %rbx, %rdi
callq 0x1cc2a
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x7, %eax
movl 0xbc(%rbx), %ecx
movl %ecx, (%r15)
jmp 0x1a3a4