// File: /workspace/github_c_makefile_star2_O0/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
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movzbl 0x12(%rax), %eax
cmpl $0x0, %eax
je 0x20ace
movq -0x8(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
jne 0x20bd4
movq -0x8(%rbp), %rax
movq 0x110(%rax), %rdi
callq 0x24f80
cmpl $0x0, %eax
jne 0x20bd4
cmpl $0x0, -0x1c(%rbp)
je 0x20bd4
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0xbc(%rcx), %eax
je 0x20bd4
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x8(%rbp), %rax
movzbl 0x13(%rax), %eax
cmpl $0x0, %eax
jle 0x20b43
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
cmpq $0x0, (%rax)
je 0x20b43
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x23e00
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0x20b65
movl -0x1c(%rbp), %edi
callq 0x24fa0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x20b63
movl $0x7, -0x18(%rbp)
jmp 0x20b65
cmpl $0x0, -0x18(%rbp)
jne 0x20bd2
movq -0x8(%rbp), %rdi
callq 0x24fc0
movq -0x30(%rbp), %rax
movl -0x1c(%rbp), %ecx
addq %rcx, %rax
subq $0x1, %rax
movl -0x1c(%rbp), %ecx
cqto
idivq %rcx
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x1c(%rax)
movl -0x1c(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xbc(%rax)
movq -0x8(%rbp), %rax
movq 0x108(%rax), %rdi
callq 0x24ff0
movq -0x28(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x108(%rax)
movq -0x8(%rbp), %rax
movq 0x110(%rax), %rdi
movl -0x1c(%rbp), %esi
callq 0x25010
jmp 0x20bd4
movq -0x8(%rbp), %rax
movl 0xbc(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
cmpl $0x0, -0x18(%rbp)
jne 0x20c18
cmpl $0x0, -0x14(%rbp)
jge 0x20bfe
movq -0x8(%rbp), %rax
movswl 0xb2(%rax), %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movw %ax, %cx
movq -0x8(%rbp), %rax
movw %cx, 0xb2(%rax)
movq -0x8(%rbp), %rdi
callq 0x24e80
movl -0x18(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)