	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function pager_write
_pager_write:                           ## @pager_write
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	16(%rdi), %r13
	movq	_SQLITE_OK@GOTPCREL(%rip), %rsi
	movq	(%r13), %rax
	movq	_PAGER_WRITER_LOCKED@GOTPCREL(%rip), %r12
	cmpq	(%r12), %rax
	sete	%cl
	movq	_PAGER_WRITER_CACHEMOD@GOTPCREL(%rip), %rbx
	cmpq	(%rbx), %rax
	sete	%dl
	orb	%cl, %dl
	movq	_PAGER_WRITER_DBMOD@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	movl	(%rsi), %r15d
	sete	%al
	orb	%dl, %al
	movzbl	%al, %edi
	callq	_assert
	movq	%r13, %rdi
	callq	_assert_pager_state
	movl	%eax, %edi
	callq	_assert
	xorl	%edi, %edi
	cmpq	$0, 8(%r13)
	sete	%dil
	callq	_assert
	xorl	%edi, %edi
	cmpq	$0, 16(%r13)
	sete	%dil
	callq	_assert
	movq	%r14, %rdi
	callq	_CHECK_PAGE
	movq	(%r13), %rax
	cmpq	(%r12), %rax
	jne	LBB0_3
## %bb.1:
	movq	%r13, %rdi
	callq	_pager_open_journal
	movl	%eax, %r15d
	movq	_SQLITE_OK@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r15d
	jne	LBB0_14
## %bb.2:
	movq	(%r13), %rax
LBB0_3:
	xorl	%edi, %edi
	cmpq	(%rbx), %rax
	setge	%dil
	callq	_assert
	movq	%r13, %rdi
	callq	_assert_pager_state
	movl	%eax, %edi
	callq	_assert
	movq	%r14, %rdi
	callq	_sqlite3PcacheMakeDirty
	xorl	%ebx, %ebx
	cmpq	$0, 24(%r13)
	setne	%bl
	movl	56(%r13), %edi
	callq	_isOpen
	xorl	%edi, %edi
	cmpl	%ebx, %eax
	sete	%dil
	callq	_assert
	movq	24(%r13), %rdi
	testq	%rdi, %rdi
	je	LBB0_10
## %bb.4:
	movq	(%r14), %rsi
	callq	_sqlite3BitvecTestNotNull
	testq	%rax, %rax
	jne	LBB0_10
## %bb.5:
	movq	%r13, %rdi
	callq	_pagerUseWal
	xorl	%edi, %edi
	testq	%rax, %rax
	sete	%dil
	callq	_assert
	movq	(%r14), %rax
	cmpq	32(%r13), %rax
	jle	LBB0_6
## %bb.7:
	movq	(%r13), %rax
	movq	_PAGER_WRITER_DBMOD@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_9
## %bb.8:
	movq	_PGHDR_NEED_SYNC@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 8(%r14)
LBB0_9:
	movq	%r13, %rdi
	callq	_PAGERID
	movq	_PGHDR_NEED_SYNC@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	xorl	%edi, %edi
	andl	8(%r14), %eax
	setne	%dil
	callq	_PAGERTRACE
	jmp	LBB0_10
LBB0_6:
	movq	%r14, %rdi
	callq	_pagerAddPageToRollbackJournal
	movl	%eax, %r15d
	movq	_SQLITE_OK@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r15d
	jne	LBB0_14
LBB0_10:
	movq	_PGHDR_WRITEABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 8(%r14)
	cmpq	$0, 40(%r13)
	jle	LBB0_12
## %bb.11:
	movq	%r14, %rdi
	callq	_subjournalPageIfRequired
	movl	%eax, %r15d
LBB0_12:
	movq	(%r14), %rax
	cmpq	%rax, 48(%r13)
	jge	LBB0_14
## %bb.13:
	movq	%rax, 48(%r13)
LBB0_14:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SQLITE_OK,4,2                  ## @SQLITE_OK
	.comm	_PAGER_WRITER_LOCKED,8,3        ## @PAGER_WRITER_LOCKED
	.comm	_PAGER_WRITER_CACHEMOD,8,3      ## @PAGER_WRITER_CACHEMOD
	.comm	_PAGER_WRITER_DBMOD,8,3         ## @PAGER_WRITER_DBMOD
	.comm	_PGHDR_NEED_SYNC,4,2            ## @PGHDR_NEED_SYNC
	.comm	_PGHDR_WRITEABLE,4,2            ## @PGHDR_WRITEABLE
	.no_dead_strip	_pager_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function pager_write
_pager_write:                           ; @pager_write
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x20, x0
	ldr	x19, [x0, #16]
Lloh0:
	adrp	x22, _SQLITE_OK@GOTPAGE
Lloh1:
	ldr	x22, [x22, _SQLITE_OK@GOTPAGEOFF]
	ldr	w21, [x22]
Lloh2:
	adrp	x25, _PAGER_WRITER_LOCKED@GOTPAGE
Lloh3:
	ldr	x25, [x25, _PAGER_WRITER_LOCKED@GOTPAGEOFF]
	ldr	x8, [x19]
	ldr	x9, [x25]
	cmp	x8, x9
Lloh4:
	adrp	x24, _PAGER_WRITER_CACHEMOD@GOTPAGE
Lloh5:
	ldr	x24, [x24, _PAGER_WRITER_CACHEMOD@GOTPAGEOFF]
	ldr	x9, [x24]
	ccmp	x8, x9, #4, ne
Lloh6:
	adrp	x23, _PAGER_WRITER_DBMOD@GOTPAGE
Lloh7:
	ldr	x23, [x23, _PAGER_WRITER_DBMOD@GOTPAGEOFF]
	ldr	x9, [x23]
	ccmp	x8, x9, #4, ne
	cset	w0, eq
	bl	_assert
	mov	x0, x19
	bl	_assert_pager_state
	bl	_assert
	ldr	x8, [x19, #8]
	cmp	x8, #0
	cset	w0, eq
	bl	_assert
	ldr	x8, [x19, #16]
	cmp	x8, #0
	cset	w0, eq
	bl	_assert
	mov	x0, x20
	bl	_CHECK_PAGE
	ldr	x8, [x19]
	ldr	x9, [x25]
	cmp	x8, x9
	b.ne	LBB0_3
; %bb.1:
	mov	x0, x19
	bl	_pager_open_journal
	mov	x21, x0
	ldr	w8, [x22]
	cmp	w0, w8
	b.ne	LBB0_14
; %bb.2:
	ldr	x8, [x19]
LBB0_3:
	ldr	x9, [x24]
	cmp	x8, x9
	cset	w0, ge
	bl	_assert
	mov	x0, x19
	bl	_assert_pager_state
	bl	_assert
	mov	x0, x20
	bl	_sqlite3PcacheMakeDirty
	ldr	x8, [x19, #24]
	cmp	x8, #0
	cset	w24, ne
	ldr	w0, [x19, #56]
	bl	_isOpen
	cmp	w0, w24
	cset	w0, eq
	bl	_assert
	ldr	x0, [x19, #24]
	cbz	x0, LBB0_10
; %bb.4:
	ldr	x1, [x20]
	bl	_sqlite3BitvecTestNotNull
	cbnz	x0, LBB0_10
; %bb.5:
	mov	x0, x19
	bl	_pagerUseWal
	cmp	x0, #0
	cset	w0, eq
	bl	_assert
	ldr	x8, [x20]
	ldr	x9, [x19, #32]
	cmp	x8, x9
	b.le	LBB0_9
; %bb.6:
	ldr	x8, [x19]
	ldr	x9, [x23]
Lloh8:
	adrp	x22, _PGHDR_NEED_SYNC@GOTPAGE
Lloh9:
	ldr	x22, [x22, _PGHDR_NEED_SYNC@GOTPAGEOFF]
	cmp	x8, x9
	b.eq	LBB0_8
; %bb.7:
	ldr	w8, [x22]
	ldr	w9, [x20, #8]
	orr	w8, w9, w8
	str	w8, [x20, #8]
LBB0_8:
	mov	x0, x19
	bl	_PAGERID
	ldr	w8, [x20, #8]
	ldr	w9, [x22]
	tst	w9, w8
	cset	w0, ne
	bl	_PAGERTRACE
	b	LBB0_10
LBB0_9:
	mov	x0, x20
	bl	_pagerAddPageToRollbackJournal
	mov	x21, x0
	ldr	w8, [x22]
	cmp	w0, w8
	b.ne	LBB0_14
LBB0_10:
Lloh10:
	adrp	x8, _PGHDR_WRITEABLE@GOTPAGE
Lloh11:
	ldr	x8, [x8, _PGHDR_WRITEABLE@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	ldr	w9, [x20, #8]
	orr	w8, w9, w8
	str	w8, [x20, #8]
	ldr	x8, [x19, #40]
	cmp	x8, #1
	b.lt	LBB0_12
; %bb.11:
	mov	x0, x20
	bl	_subjournalPageIfRequired
	mov	x21, x0
LBB0_12:
	ldr	x9, [x19, #48]
	ldr	x8, [x20]
	cmp	x9, x8
	b.ge	LBB0_14
; %bb.13:
	str	x8, [x19, #48]
LBB0_14:
	mov	x0, x21
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_SQLITE_OK,4,2                  ; @SQLITE_OK
	.comm	_PAGER_WRITER_LOCKED,8,3        ; @PAGER_WRITER_LOCKED
	.comm	_PAGER_WRITER_CACHEMOD,8,3      ; @PAGER_WRITER_CACHEMOD
	.comm	_PAGER_WRITER_DBMOD,8,3         ; @PAGER_WRITER_DBMOD
	.comm	_PGHDR_NEED_SYNC,4,2            ; @PGHDR_NEED_SYNC
	.comm	_PGHDR_WRITEABLE,4,2            ; @PGHDR_WRITEABLE
	.no_dead_strip	_pager_write
.subsections_via_symbols
