// File: /workspace/github_c_makefile_star2_O3/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: unqlitePagerAcquire
static int unqlitePagerAcquire(
  Pager *pPager,      /* The pager open on the database file */
  pgno pgno,          /* Page number to fetch */
  unqlite_page **ppPage,    /* OUT: Acquired page */
  int fetchOnly,      /* Cache lookup only */
  int noContent       /* Do not bother reading content from disk if true */
)
{
	Page *pPage;
	int rc;
	/* Acquire a shared lock (if not yet done) on the database and rollback any hot-journal if present */
	rc = pager_shared_lock(pPager);
	if( rc != UNQLITE_OK ){
		return rc;
	}
	/* Fetch the page from the cache */
	pPage = pager_fetch_page(pPager,pgno);
	if( fetchOnly ){
		if( ppPage ){
			*ppPage = (unqlite_page *)pPage;
		}
		return pPage ? UNQLITE_OK : UNQLITE_NOTFOUND;
	}
	if( pPage == 0 ){
		/* Allocate a new page */
		pPage = pager_alloc_page(pPager,pgno);
		if( pPage == 0 ){
			unqliteGenOutofMem(pPager->pDb);
			return UNQLITE_NOMEM;
		}
		/* Read page contents */
		rc = pager_get_page_contents(pPager,pPage,noContent);
		if( rc != UNQLITE_OK ){
			SyMemBackendPoolFree(pPager->pAllocator,pPage);
			return rc;
		}
		/* Link the page */
		pager_link_page(pPager,pPage);
	}else{
		if( ppPage ){
			page_ref(pPage);
		}
	}
	/* All done, page is loaded in memeory */
	if( ppPage ){
		*ppPage = (unqlite_page *)pPage;
	}
	return UNQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r13d
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
callq 0x3acaa
movl %eax, %ebx
testl %eax, %eax
jne 0x3ac99
movq %r15, -0x30(%rbp)
cmpl $0x0, 0x254(%r14)
je 0x3ab69
movq 0x248(%r14), %rax
movl 0x250(%r14), %ecx
decl %ecx
movl %r12d, %edx
andl %ecx, %edx
movq (%rax,%rdx,8), %r15
testq %r15, %r15
je 0x3ab69
cmpq %r12, 0x10(%r15)
je 0x3ab6c
movq 0x48(%r15), %r15
jmp 0x3ab58
xorl %r15d, %r15d
testl %r13d, %r13d
je 0x3ab8f
movq -0x30(%rbp), %rax
testq %rax, %rax
je 0x3ab7d
movq %r15, (%rax)
xorl %eax, %eax
testq %r15, %r15
movl $0xfffffffa, %ebx       # imm = 0xFFFFFFFA
cmovnel %eax, %ebx
jmp 0x3ac99
testq %r15, %r15
je 0x3aba8
cmpq $0x0, -0x30(%rbp)
je 0x3ac97
incl 0x24(%r15)
jmp 0x3ac90
movq %r14, %rdi
movq %r12, %rsi
callq 0x3b1e4
testq %rax, %rax
je 0x3ac3c
movq %rax, %r15
cmpl $0x0, 0x1fc(%r14)
jne 0x3abfc
movq 0x10(%r15), %rcx
cmpq 0x40(%r14), %rcx
jae 0x3abfc
testb $0x1, 0x16d(%r14)
je 0x3ac53
movq 0x58(%r14), %rax
testq %rax, %rax
je 0x3ac53
movslq 0x208(%r14), %rdx
imulq %rdx, %rcx
addq %rcx, %rax
movq %rax, (%r15)
jmp 0x3ac7e
movl 0x208(%r14), %eax
testq %rax, %rax
je 0x3ac7e
movq (%r15), %rcx
addq %rcx, %rax
movb $0x0, (%rcx)
incq %rcx
cmpq %rax, %rcx
jae 0x3ac7e
movb $0x0, (%rcx)
incq %rcx
cmpq %rax, %rcx
jae 0x3ac7e
movb $0x0, (%rcx)
incq %rcx
cmpq %rax, %rcx
jae 0x3ac7e
movb $0x0, (%rcx)
incq %rcx
cmpq %rax, %rcx
jb 0x3ac0e
jmp 0x3ac7e
movq 0x8(%r14), %rdi
leaq 0x38d8f(%rip), %rsi     # 0x739d6
callq 0x31537
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x3ac99
movq 0x30(%r14), %rdi
movq (%r15), %rsi
movslq 0x208(%r14), %rdx
imulq %rdx, %rcx
movq (%rdi), %rax
callq *0x10(%rax)
testl %eax, %eax
je 0x3ac7e
movl %eax, %ebx
movq (%r14), %rdi
movq %r15, %rsi
callq 0x2e659
jmp 0x3ac99
movq %r14, %rdi
movq %r15, %rsi
callq 0x3b264
cmpq $0x0, -0x30(%rbp)
je 0x3ac97
movq -0x30(%rbp), %rax
movq %r15, (%rax)
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq