	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_sqlite3_wal_checkpoint_v2      ## -- Begin function sqlite3_wal_checkpoint_v2
	.p2align	4, 0x90
_sqlite3_wal_checkpoint_v2:             ## @sqlite3_wal_checkpoint_v2
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r8, %r14
	movq	%rcx, %r12
	movl	%edx, %r13d
	movq	%rdi, %r15
	movq	_SQLITE_MAX_ATTACHED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	testq	%rcx, %rcx
	je	LBB0_2
## %bb.1:
	movl	$-1, (%r12)
LBB0_2:
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	testq	%r14, %r14
	je	LBB0_4
## %bb.3:
	movl	$-1, (%r14)
LBB0_4:
	movq	_SQLITE_CHECKPOINT_PASSIVE@GOTPCREL(%rip), %rax
	xorl	%edi, %edi
	cmpl	$0, (%rax)
	sete	%dil
	callq	_assert
	movq	_SQLITE_CHECKPOINT_FULL@GOTPCREL(%rip), %rax
	xorl	%edi, %edi
	cmpl	$1, (%rax)
	sete	%dil
	callq	_assert
	movq	_SQLITE_CHECKPOINT_RESTART@GOTPCREL(%rip), %rax
	xorl	%edi, %edi
	cmpl	$2, (%rax)
	sete	%dil
	callq	_assert
	movq	_SQLITE_CHECKPOINT_TRUNCATE@GOTPCREL(%rip), %rbx
	xorl	%edi, %edi
	cmpl	$3, (%rbx)
	sete	%dil
	callq	_assert
	movq	_SQLITE_CHECKPOINT_PASSIVE@GOTPCREL(%rip), %rax
	cmpl	%r13d, (%rax)
	jg	LBB0_6
## %bb.5:
	cmpl	%r13d, (%rbx)
	jl	LBB0_6
## %bb.7:
	movl	8(%r15), %edi
	callq	_sqlite3_mutex_enter
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	testq	%rcx, %rcx
	je	LBB0_8
## %bb.9:
	cmpb	$0, (%rcx)
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	je	LBB0_11
## %bb.10:
	movq	%r15, %rdi
	movq	%rcx, %rsi
	callq	_sqlite3FindDbName
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movl	%eax, %esi
LBB0_11:
	testl	%esi, %esi
	js	LBB0_12
LBB0_13:
	movq	$0, 24(%r15)
	movq	%r15, %rdi
	movl	%r13d, %edx
	movq	%r12, %rcx
	movq	%r14, %r8
	callq	_sqlite3Checkpoint
	movl	%eax, %ebx
	movq	%r15, %rdi
	movl	%eax, %esi
	callq	_sqlite3Error
	jmp	LBB0_14
LBB0_6:
	movq	_SQLITE_MISUSE@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_17
LBB0_8:
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	testl	%esi, %esi
	jns	LBB0_13
LBB0_12:
	movq	_SQLITE_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	leaq	L_.str(%rip), %rdx
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_sqlite3ErrorWithMsg
LBB0_14:
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_sqlite3ApiExit
	movl	%eax, %ebx
	cmpq	$0, (%r15)
	jne	LBB0_16
## %bb.15:
	movq	$0, 16(%r15)
LBB0_16:
	movl	8(%r15), %edi
	callq	_sqlite3_mutex_leave
LBB0_17:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SQLITE_MAX_ATTACHED,4,2        ## @SQLITE_MAX_ATTACHED
	.comm	_SQLITE_CHECKPOINT_PASSIVE,4,2  ## @SQLITE_CHECKPOINT_PASSIVE
	.comm	_SQLITE_CHECKPOINT_FULL,4,2     ## @SQLITE_CHECKPOINT_FULL
	.comm	_SQLITE_CHECKPOINT_RESTART,4,2  ## @SQLITE_CHECKPOINT_RESTART
	.comm	_SQLITE_CHECKPOINT_TRUNCATE,4,2 ## @SQLITE_CHECKPOINT_TRUNCATE
	.comm	_SQLITE_MISUSE,4,2              ## @SQLITE_MISUSE
	.comm	_SQLITE_ERROR,4,2               ## @SQLITE_ERROR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"unknown database: %s"

	.comm	_SQLITE_MISUSE_BKPT,4,2         ## @SQLITE_MISUSE_BKPT
	.comm	_SQLITE_OK,4,2                  ## @SQLITE_OK
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_sqlite3_wal_checkpoint_v2      ; -- Begin function sqlite3_wal_checkpoint_v2
	.p2align	2
_sqlite3_wal_checkpoint_v2:             ; @sqlite3_wal_checkpoint_v2
	.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, x4
	mov	x22, x3
	mov	x23, x2
	mov	x21, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _SQLITE_MAX_ATTACHED@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SQLITE_MAX_ATTACHED@GOTPAGEOFF]
Lloh2:
	ldr	w24, [x8]
	cbz	x3, LBB0_2
; %bb.1:
	mov	w8, #-1
	str	w8, [x22]
LBB0_2:
	cbz	x20, LBB0_4
; %bb.3:
	mov	w8, #-1
	str	w8, [x20]
LBB0_4:
Lloh3:
	adrp	x25, _SQLITE_CHECKPOINT_PASSIVE@GOTPAGE
Lloh4:
	ldr	x25, [x25, _SQLITE_CHECKPOINT_PASSIVE@GOTPAGEOFF]
	ldr	w8, [x25]
	cmp	w8, #0
	cset	w0, eq
	bl	_assert
Lloh5:
	adrp	x8, _SQLITE_CHECKPOINT_FULL@GOTPAGE
Lloh6:
	ldr	x8, [x8, _SQLITE_CHECKPOINT_FULL@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	cmp	w8, #1
	cset	w0, eq
	bl	_assert
Lloh8:
	adrp	x8, _SQLITE_CHECKPOINT_RESTART@GOTPAGE
Lloh9:
	ldr	x8, [x8, _SQLITE_CHECKPOINT_RESTART@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	cmp	w8, #2
	cset	w0, eq
	bl	_assert
Lloh11:
	adrp	x26, _SQLITE_CHECKPOINT_TRUNCATE@GOTPAGE
Lloh12:
	ldr	x26, [x26, _SQLITE_CHECKPOINT_TRUNCATE@GOTPAGEOFF]
	ldr	w8, [x26]
	cmp	w8, #3
	cset	w0, eq
	bl	_assert
	ldr	w8, [x25]
	ldr	w9, [x26]
	cmp	w8, w23
	ccmp	w9, w23, #8, le
	b.ge	LBB0_6
; %bb.5:
Lloh13:
	adrp	x8, _SQLITE_MISUSE@GOTPAGE
Lloh14:
	ldr	x8, [x8, _SQLITE_MISUSE@GOTPAGEOFF]
Lloh15:
	ldr	w20, [x8]
	b	LBB0_15
LBB0_6:
	ldr	w0, [x19, #8]
	bl	_sqlite3_mutex_enter
	cbz	x21, LBB0_9
; %bb.7:
	ldrb	w8, [x21]
	cbz	w8, LBB0_9
; %bb.8:
	mov	x0, x19
	mov	x1, x21
	bl	_sqlite3FindDbName
	mov	x24, x0
LBB0_9:
	tbnz	w24, #31, LBB0_11
; %bb.10:
	str	xzr, [x19, #24]
	mov	x0, x19
	mov	x1, x24
	mov	x2, x23
	mov	x3, x22
	mov	x4, x20
	bl	_sqlite3Checkpoint
	mov	x20, x0
	mov	x0, x19
	mov	x1, x20
	bl	_sqlite3Error
	b	LBB0_12
LBB0_11:
Lloh16:
	adrp	x8, _SQLITE_ERROR@GOTPAGE
Lloh17:
	ldr	x8, [x8, _SQLITE_ERROR@GOTPAGEOFF]
Lloh18:
	ldr	w20, [x8]
Lloh19:
	adrp	x2, l_.str@PAGE
Lloh20:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x19
	mov	x1, x20
	mov	x3, x21
	bl	_sqlite3ErrorWithMsg
LBB0_12:
	mov	x0, x19
	mov	x1, x20
	bl	_sqlite3ApiExit
	mov	x20, x0
	ldr	x8, [x19]
	cbnz	x8, LBB0_14
; %bb.13:
	str	xzr, [x19, #16]
LBB0_14:
	ldr	w0, [x19, #8]
	bl	_sqlite3_mutex_leave
LBB0_15:
	mov	x0, x20
	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 AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_SQLITE_MAX_ATTACHED,4,2        ; @SQLITE_MAX_ATTACHED
	.comm	_SQLITE_CHECKPOINT_PASSIVE,4,2  ; @SQLITE_CHECKPOINT_PASSIVE
	.comm	_SQLITE_CHECKPOINT_FULL,4,2     ; @SQLITE_CHECKPOINT_FULL
	.comm	_SQLITE_CHECKPOINT_RESTART,4,2  ; @SQLITE_CHECKPOINT_RESTART
	.comm	_SQLITE_CHECKPOINT_TRUNCATE,4,2 ; @SQLITE_CHECKPOINT_TRUNCATE
	.comm	_SQLITE_MISUSE,4,2              ; @SQLITE_MISUSE
	.comm	_SQLITE_ERROR,4,2               ; @SQLITE_ERROR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"unknown database: %s"

	.comm	_SQLITE_MISUSE_BKPT,4,2         ; @SQLITE_MISUSE_BKPT
	.comm	_SQLITE_OK,4,2                  ; @SQLITE_OK
.subsections_via_symbols
