// File: /workspace/github_c_makefile_star2_O0/coyove[P]chann/./lib/unqlite/unqlite.c
// Function: pager_playback
static int pager_playback(Pager *pPager)
{
	unsigned char *zTmp = 0; /* cc warning */
	sxu32 n,nRec;
	sxi64 iOfft;
	int rc;
	/* Read the journal header*/
	rc = pager_read_journal_header(pPager,&nRec,&pPager->dbSize);
	if( rc != UNQLITE_OK ){
		if( rc == UNQLITE_DONE ){
			goto end_playback;
		}
		unqliteGenErrorFormat(pPager->pDb,"IO error while reading journal file '%s' header",pPager->zJournal);
		return rc;
	}
	/* Truncate the database back to its original size */
	rc = unqliteOsTruncate(pPager->pfd,pPager->iPageSize * pPager->dbSize);
	if( rc != UNQLITE_OK ){
		unqliteGenError(pPager->pDb,"IO error while truncating database file");
		return rc;
	}
	/* Allocate a temporary page */
	zTmp = (unsigned char *)SyMemBackendAlloc(pPager->pAllocator,(sxu32)pPager->iPageSize);
	if( zTmp == 0 ){
		unqliteGenOutofMem(pPager->pDb);
		return UNQLITE_NOMEM;
	}
	SyZero((void *)zTmp,(sxu32)pPager->iPageSize);
	/* Copy original pages out of the journal and back into the 
    ** database file and/or page cache.
    */
	iOfft = pPager->iJournalOfft;
	for( n = 0 ; n < nRec ; ++n ){
		rc = pager_play_back_one_page(pPager,&iOfft,zTmp);
		if( rc != UNQLITE_OK ){
			if( rc != SXERR_IGNORE ){
				unqliteGenError(pPager->pDb,"Page playback error");
				goto end_playback;
			}
		}
	}
end_playback:
	/* Release the temp page */
	SyMemBackendFree(pPager->pAllocator,(void *)zTmp);
	if( rc == UNQLITE_OK ){
		/* Sync the database file */
		unqliteOsSync(pPager->pfd,UNQLITE_SYNC_FULL);
	}
	if( rc == UNQLITE_DONE ){
		rc = UNQLITE_OK;
	}
	/* Return to the caller */
	return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rdx
addq $0x40, %rdx
leaq -0x20(%rbp), %rsi
callq 0x698e0
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x69676
cmpl $-0x1c, -0x2c(%rbp)
jne 0x6964d
jmp 0x69771
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdx
leaq 0x58a67(%rip), %rsi     # 0xc20cb
movb $0x0, %al
callq 0x68100
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x697ac
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdi
movq -0x10(%rbp), %rax
movslq 0x208(%rax), %rsi
movq -0x10(%rbp), %rax
imulq 0x40(%rax), %rsi
callq 0x69b20
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x696bf
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x58a4c(%rip), %rsi     # 0xc20fb
callq 0x58950
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x697ac
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movl 0x208(%rax), %esi
callq 0x5bf70
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x696f9
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x67f90
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x697ac
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x208(%rax), %esi
callq 0x54280
movq -0x10(%rbp), %rax
movq 0x170(%rax), %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jae 0x6976f
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq -0x28(%rbp), %rsi
callq 0x69b50
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x69762
cmpl $-0x3f, -0x2c(%rbp)
je 0x69760
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x589ca(%rip), %rsi     # 0xc2123
callq 0x58950
jmp 0x69771
jmp 0x69762
jmp 0x69764
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x69722
jmp 0x69771
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x5d6b0
cmpl $0x0, -0x2c(%rbp)
jne 0x69799
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdi
movl $0x3, %esi
callq 0x695e0
cmpl $-0x1c, -0x2c(%rbp)
jne 0x697a6
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)