// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: pcache1Create
static sqlite3_pcache *pcache1Create(int szPage, int szExtra, int bPurgeable){
  PCache1 *pCache;      /* The newly created page cache */
  PGroup *pGroup;       /* The group the new page cache will belong to */
  int sz;               /* Bytes of memory required to allocate the new cache */

  assert( (szPage & (szPage-1))==0 && szPage>=512 && szPage<=65536 );
  assert( szExtra < 300 );

  sz = sizeof(PCache1) + sizeof(PGroup)*pcache1.separateCache;
  pCache = (PCache1 *)sqlite3MallocZero(sz);
  if( pCache ){
    if( pcache1.separateCache ){
      pGroup = (PGroup*)&pCache[1];
      pGroup->mxPinned = 10;
    }else{
      pGroup = &pcache1.grp;
    }
    pcache1EnterMutex(pGroup);
    if( pGroup->lru.isAnchor==0 ){
      pGroup->lru.isAnchor = 1;
      pGroup->lru.pLruPrev = pGroup->lru.pLruNext = &pGroup->lru;
    }
    pCache->pGroup = pGroup;
    pCache->szPage = szPage;
    pCache->szExtra = szExtra;
    pCache->szAlloc = szPage + szExtra + ROUND8(sizeof(PgHdr1));
    pCache->bPurgeable = (bPurgeable ? 1 : 0);
    pcache1ResizeHash(pCache);
    if( bPurgeable ){
      pCache->nMin = 10;
      pGroup->nMinPage += pCache->nMin;
      pGroup->mxPinned = pGroup->nMaxPage + 10 - pGroup->nMinPage;
      pCache->pnPurgeable = &pGroup->nPurgeable;
    }else{
      pCache->pnPurgeable = &pCache->nPurgeableDummy;
    }
    pcache1LeaveMutex(pGroup);
    if( pCache->nHash==0 ){
      pcache1Destroy((sqlite3_pcache*)pCache);
      pCache = 0;
    }
  }
  return (sqlite3_pcache *)pCache;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movl %edx, -0xc(%rbp)
movslq 0x1d5fa4(%rip), %rax    # 0x64346c
imulq $0x50, %rax, %rax
addq $0x58, %rax
movl %eax, -0x24(%rbp)
movslq -0x24(%rbp), %rdi
callq 0x3c51d0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x46d614
cmpl $0x0, 0x1d5f7a(%rip)    # 0x64346c
je 0x46d50d
movq -0x18(%rbp), %rax
addq $0x58, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl $0xa, 0x10(%rax)
jmp 0x46d518
leaq 0x1d5f04(%rip), %rax    # 0x643418
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movzwl 0x2e(%rax), %eax
cmpl $0x0, %eax
jne 0x46d547
movq -0x20(%rbp), %rax
movw $0x1, 0x2e(%rax)
movq -0x20(%rbp), %rcx
addq $0x18, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x20(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movl -0x4(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x10(%rax)
movl -0x8(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x14(%rax)
movl -0x4(%rbp), %eax
addl -0x8(%rbp), %eax
cltq
addq $0x38, %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x18(%rax)
movl -0xc(%rbp), %edx
xorl %ecx, %ecx
movl $0x1, %eax
cmpl $0x0, %edx
cmovnel %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x18(%rbp), %rdi
callq 0x46d9e0
cmpl $0x0, -0xc(%rbp)
je 0x46d5e7
movq -0x18(%rbp), %rax
movl $0xa, 0x20(%rax)
movq -0x18(%rbp), %rax
movl 0x20(%rax), %ecx
movq -0x20(%rbp), %rax
addl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
movq -0x20(%rbp), %rax
movl 0x8(%rax), %ecx
addl $0xa, %ecx
movq -0x20(%rbp), %rax
subl 0xc(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x20(%rbp), %rcx
addq $0x14, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0x46d5f7
movq -0x18(%rbp), %rcx
addq $0x30, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x3c(%rax)
jne 0x46d612
movq -0x18(%rbp), %rdi
callq 0x46d8d0
movq $0x0, -0x18(%rbp)
jmp 0x46d614
movq -0x18(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nop