	.file	"extr_sqlite3.c_pager_write.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	pager_write, @function
pager_write:
.LFB0:
	.cfi_startproc
	endbr64
	push	r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	push	r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	sub	rsp, 8
	.cfi_def_cfa_offset 48
	mov	rbx, QWORD PTR 16[rdi]
	mov	r12d, DWORD PTR SQLITE_OK[rip]
	mov	edi, 1
	mov	rax, QWORD PTR [rbx]
	cmp	rax, QWORD PTR PAGER_WRITER_LOCKED[rip]
	je	.L2
	cmp	rax, QWORD PTR PAGER_WRITER_CACHEMOD[rip]
	je	.L2
	xor	edi, edi
	cmp	QWORD PTR PAGER_WRITER_DBMOD[rip], rax
	sete	dil
.L2:
	call	assert@PLT
	mov	rdi, rbx
	call	assert_pager_state@PLT
	mov	edi, eax
	call	assert@PLT
	xor	edi, edi
	cmp	QWORD PTR 8[rbx], 0
	sete	dil
	call	assert@PLT
	xor	edi, edi
	cmp	QWORD PTR 16[rbx], 0
	sete	dil
	call	assert@PLT
	mov	rdi, rbp
	call	CHECK_PAGE@PLT
	mov	rax, QWORD PTR [rbx]
	cmp	rax, QWORD PTR PAGER_WRITER_LOCKED[rip]
	je	.L16
.L3:
	xor	edi, edi
	cmp	QWORD PTR PAGER_WRITER_CACHEMOD[rip], rax
	setle	dil
	xor	r13d, r13d
	call	assert@PLT
	mov	rdi, rbx
	call	assert_pager_state@PLT
	mov	edi, eax
	call	assert@PLT
	mov	rdi, rbp
	call	sqlite3PcacheMakeDirty@PLT
	mov	edi, DWORD PTR 56[rbx]
	cmp	QWORD PTR 24[rbx], 0
	setne	r13b
	call	isOpen@PLT
	xor	edi, edi
	cmp	r13d, eax
	sete	dil
	call	assert@PLT
	mov	rdi, QWORD PTR 24[rbx]
	test	rdi, rdi
	jne	.L17
.L5:
	mov	eax, DWORD PTR PGHDR_WRITEABLE[rip]
	or	DWORD PTR 8[rbp], eax
	cmp	QWORD PTR 40[rbx], 0
	jg	.L18
	mov	rax, QWORD PTR 0[rbp]
	cmp	QWORD PTR 48[rbx], rax
	jge	.L1
.L19:
	mov	QWORD PTR 48[rbx], rax
.L1:
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	mov	eax, r12d
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	.cfi_restore_state
	mov	rdi, rbp
	call	subjournalPageIfRequired@PLT
	mov	r12d, eax
	mov	rax, QWORD PTR 0[rbp]
	cmp	QWORD PTR 48[rbx], rax
	jge	.L1
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L16:
	mov	rdi, rbx
	call	pager_open_journal@PLT
	cmp	DWORD PTR SQLITE_OK[rip], eax
	mov	r12d, eax
	jne	.L1
	mov	rax, QWORD PTR [rbx]
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L17:
	mov	rsi, QWORD PTR 0[rbp]
	call	sqlite3BitvecTestNotNull@PLT
	test	rax, rax
	jne	.L5
	mov	rdi, rbx
	call	pagerUseWal@PLT
	xor	edi, edi
	test	rax, rax
	sete	dil
	call	assert@PLT
	mov	rax, QWORD PTR 32[rbx]
	cmp	QWORD PTR 0[rbp], rax
	jle	.L20
	mov	rax, QWORD PTR PAGER_WRITER_DBMOD[rip]
	cmp	QWORD PTR [rbx], rax
	je	.L7
	mov	eax, DWORD PTR PGHDR_NEED_SYNC[rip]
	or	DWORD PTR 8[rbp], eax
.L7:
	mov	rdi, rbx
	call	PAGERID@PLT
	mov	eax, DWORD PTR 8[rbp]
	xor	edi, edi
	test	DWORD PTR PGHDR_NEED_SYNC[rip], eax
	setne	dil
	call	PAGERTRACE@PLT
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L20:
	mov	rdi, rbp
	call	pagerAddPageToRollbackJournal@PLT
	cmp	DWORD PTR SQLITE_OK[rip], eax
	mov	r12d, eax
	jne	.L1
	jmp	.L5
	.cfi_endproc
.LFE0:
	.size	pager_write, .-pager_write
	.comm	SQLITE_OK,4,4
	.comm	PGHDR_WRITEABLE,4,4
	.comm	PGHDR_NEED_SYNC,4,4
	.comm	PAGER_WRITER_LOCKED,8,8
	.comm	PAGER_WRITER_DBMOD,8,8
	.comm	PAGER_WRITER_CACHEMOD,8,8
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_sqlite3.c_pager_write.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	pager_write, %function
pager_write:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, lr}
	ldr	r7, .L22
	ldr	r4, [r0, #8]
	mov	r5, r0
	ldr	r3, [r7]
	ldr	r0, [r4]
	ldr	r8, .L22+4
	cmp	r0, r3
	ldr	r6, [r8]
	beq	.L10
	ldr	r3, .L22+8
	ldr	r3, [r3]
	cmp	r0, r3
	beq	.L10
	ldr	r3, .L22+12
	ldr	r3, [r3]
	sub	r0, r3, r0
	clz	r0, r0
	lsr	r0, r0, #5
	b	.L2
.L10:
	mov	r0, #1
.L2:
	bl	assert
	mov	r0, r4
	bl	assert_pager_state
	bl	assert
	ldr	r0, [r4, #4]
	clz	r0, r0
	lsr	r0, r0, #5
	bl	assert
	ldr	r0, [r4, #8]
	clz	r0, r0
	lsr	r0, r0, #5
	bl	assert
	mov	r0, r5
	bl	CHECK_PAGE
	ldr	r2, [r7]
	ldr	r3, [r4]
	cmp	r3, r2
	beq	.L18
.L3:
	ldr	r2, .L22+8
	ldr	r0, [r2]
	cmp	r0, r3
	movgt	r0, #0
	movle	r0, #1
	bl	assert
	mov	r0, r4
	bl	assert_pager_state
	bl	assert
	mov	r0, r5
	bl	sqlite3PcacheMakeDirty
	ldr	r7, [r4, #12]
	ldr	r0, [r4, #28]
	subs	r7, r7, #0
	movne	r7, #1
	bl	isOpen
	sub	r0, r7, r0
	clz	r0, r0
	lsr	r0, r0, #5
	bl	assert
	ldr	r0, [r4, #12]
	cmp	r0, #0
	bne	.L19
.L5:
	ldr	r2, .L22+16
	ldr	r3, [r5, #4]
	ldr	r1, [r2]
	ldr	r2, [r4, #20]
	orr	r3, r3, r1
	cmp	r2, #0
	str	r3, [r5, #4]
	bgt	.L20
.L8:
	ldr	r3, [r5]
	ldr	r2, [r4, #24]
	cmp	r2, r3
	strlt	r3, [r4, #24]
.L1:
	mov	r0, r6
	pop	{r4, r5, r6, r7, r8, pc}
.L20:
	mov	r0, r5
	bl	subjournalPageIfRequired
	mov	r6, r0
	b	.L8
.L18:
	mov	r0, r4
	bl	pager_open_journal
	ldr	r3, [r8]
	mov	r6, r0
	cmp	r3, r0
	bne	.L1
	ldr	r3, [r4]
	b	.L3
.L19:
	ldr	r1, [r5]
	bl	sqlite3BitvecTestNotNull
	cmp	r0, #0
	bne	.L5
	mov	r0, r4
	bl	pagerUseWal
	clz	r0, r0
	lsr	r0, r0, #5
	bl	assert
	ldr	r2, [r5]
	ldr	r3, [r4, #16]
	cmp	r2, r3
	ble	.L21
	ldr	r3, .L22+12
	ldr	r2, [r4]
	ldr	r3, [r3]
	ldr	r7, .L22+20
	cmp	r2, r3
	ldrne	r3, [r5, #4]
	ldrne	r2, [r7]
	mov	r0, r4
	orrne	r3, r3, r2
	strne	r3, [r5, #4]
	bl	PAGERID
	ldr	r3, [r7]
	ldr	r2, [r5, #4]
	tst	r2, r3
	movne	r0, #1
	moveq	r0, #0
	bl	PAGERTRACE
	b	.L5
.L21:
	mov	r0, r5
	bl	pagerAddPageToRollbackJournal
	ldr	r3, [r8]
	mov	r6, r0
	cmp	r3, r0
	bne	.L1
	b	.L5
.L23:
	.align	2
.L22:
	.word	PAGER_WRITER_LOCKED
	.word	SQLITE_OK
	.word	PAGER_WRITER_CACHEMOD
	.word	PAGER_WRITER_DBMOD
	.word	PGHDR_WRITEABLE
	.word	PGHDR_NEED_SYNC
	.size	pager_write, .-pager_write
	.comm	SQLITE_OK,4,4
	.comm	PGHDR_WRITEABLE,4,4
	.comm	PGHDR_NEED_SYNC,4,4
	.comm	PAGER_WRITER_LOCKED,4,4
	.comm	PAGER_WRITER_DBMOD,4,4
	.comm	PAGER_WRITER_CACHEMOD,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
