	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function walRestartLog
_walRestartLog:                         ## @walRestartLog
	.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	_SQLITE_OK@GOTPCREL(%rip), %rbx
	cmpl	$0, (%rdi)
	je	LBB0_2
## %bb.1:
	movl	(%rbx), %r12d
	jmp	LBB0_12
LBB0_2:
	movq	%rdi, %r15
	callq	_walCkptInfo
	movq	%rax, %r14
	movq	(%rax), %rax
	xorl	%edi, %edi
	cmpq	8(%r15), %rax
	sete	%dil
	callq	_assert
	cmpq	$0, (%r14)
	jle	LBB0_9
## %bb.3:
	leaq	-48(%rbp), %rsi
	movl	$4, %edi
	callq	_sqlite3_randomness
	movl	$1, %edi
	callq	_WAL_READ_LOCK
	movq	_WAL_NREADER@GOTPCREL(%rip), %r13
	movl	(%r13), %edx
	decl	%edx
	movq	%r15, %rdi
	movl	%eax, %esi
	callq	_walLockExclusive
	cmpl	(%rbx), %eax
	jne	LBB0_8
## %bb.4:
	movq	16(%r15), %rbx
	incl	24(%r15)
	movq	$0, 8(%r15)
	movq	%rbx, %rdi
	callq	_sqlite3Get4byte
	leaq	1(%rax), %rsi
	movq	%rbx, %rdi
	callq	_sqlite3Put4byte
	movq	-48(%rbp), %rax
	movq	%rax, 8(%rbx)
	movq	%r15, %rdi
	callq	_walIndexWriteHdr
	movq	$0, (%r14)
	movq	8(%r14), %rax
	movl	$0, 4(%rax)
	cmpl	$3, (%r13)
	jl	LBB0_7
## %bb.5:
	movl	$2, %eax
	movq	_READMARK_NOT_USED@GOTPCREL(%rip), %rcx
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%rcx), %edx
	movq	8(%r14), %rsi
	movl	%edx, (%rsi,%rax,4)
	incq	%rax
	movslq	(%r13), %rdx
	cmpq	%rdx, %rax
	jl	LBB0_6
LBB0_7:
	movq	8(%r14), %rax
	xorl	%edi, %edi
	cmpl	$0, (%rax)
	sete	%dil
	callq	_assert
	movl	$1, %edi
	callq	_WAL_READ_LOCK
	movl	(%r13), %edx
	decl	%edx
	movq	%r15, %rdi
	movl	%eax, %esi
	callq	_walUnlockExclusive
	jmp	LBB0_9
LBB0_8:
	movl	%eax, %r12d
	movq	_SQLITE_BUSY@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	jne	LBB0_12
LBB0_9:
	xorl	%edi, %edi
	callq	_WAL_READ_LOCK
	movq	%r15, %rdi
	movl	%eax, %esi
	callq	_walUnlockShared
	movl	$-1, (%r15)
	movl	$1, %ebx
	leaq	-52(%rbp), %r14
	movq	_WAL_RETRY@GOTPCREL(%rip), %r13
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	movq	%r14, %rsi
	movl	$1, %edx
	movl	%ebx, %ecx
	callq	_walTryBeginRead
	incl	%ebx
	cmpl	(%r13), %eax
	je	LBB0_10
## %bb.11:
	movl	%eax, %r12d
	movzbl	%r12b, %ebx
	movq	_SQLITE_BUSY@GOTPCREL(%rip), %rax
	xorl	%edi, %edi
	cmpl	(%rax), %ebx
	setne	%dil
	callq	_assert
	movq	_SQLITE_IOERR@GOTPCREL(%rip), %rax
	xorl	%edi, %edi
	cmpl	(%rax), %ebx
	sete	%dil
	callq	_testcase
	movq	_SQLITE_PROTOCOL@GOTPCREL(%rip), %rax
	xorl	%edi, %edi
	cmpl	(%rax), %r12d
	sete	%dil
	callq	_testcase
	xorl	%edi, %edi
	movq	_SQLITE_OK@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	sete	%dil
	callq	_testcase
LBB0_12:
	movl	%r12d, %eax
	addq	$24, %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	_WAL_NREADER,4,2                ## @WAL_NREADER
	.comm	_READMARK_NOT_USED,4,2          ## @READMARK_NOT_USED
	.comm	_SQLITE_BUSY,4,2                ## @SQLITE_BUSY
	.comm	_WAL_RETRY,4,2                  ## @WAL_RETRY
	.comm	_SQLITE_IOERR,4,2               ## @SQLITE_IOERR
	.comm	_SQLITE_PROTOCOL,4,2            ## @SQLITE_PROTOCOL
	.no_dead_strip	_walRestartLog
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function walRestartLog
_walRestartLog:                         ; @walRestartLog
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.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
Lloh0:
	adrp	x22, _SQLITE_OK@GOTPAGE
Lloh1:
	ldr	x22, [x22, _SQLITE_OK@GOTPAGEOFF]
	ldr	w8, [x0]
	cbz	w8, LBB0_2
; %bb.1:
	ldr	w21, [x22]
	b	LBB0_12
LBB0_2:
	mov	x19, x0
	bl	_walCkptInfo
	mov	x20, x0
	ldr	x8, [x0]
	ldr	x9, [x19, #8]
	cmp	x8, x9
	cset	w0, eq
	bl	_assert
	ldr	x8, [x20]
Lloh2:
	adrp	x23, _SQLITE_BUSY@GOTPAGE
Lloh3:
	ldr	x23, [x23, _SQLITE_BUSY@GOTPAGEOFF]
	cmp	x8, #1
	b.lt	LBB0_9
; %bb.3:
	add	x1, sp, #8
	mov	w0, #4
	bl	_sqlite3_randomness
	mov	w0, #1
	bl	_WAL_READ_LOCK
	mov	x1, x0
Lloh4:
	adrp	x24, _WAL_NREADER@GOTPAGE
Lloh5:
	ldr	x24, [x24, _WAL_NREADER@GOTPAGEOFF]
	ldr	w8, [x24]
	sub	w2, w8, #1
	mov	x0, x19
	bl	_walLockExclusive
	ldr	w8, [x22]
	cmp	w0, w8
	b.ne	LBB0_8
; %bb.4:
	ldr	x21, [x19, #16]
	ldr	w8, [x19, #24]
	add	w8, w8, #1
	str	w8, [x19, #24]
	str	xzr, [x19, #8]
	mov	x0, x21
	bl	_sqlite3Get4byte
	add	x1, x0, #1
	mov	x0, x21
	bl	_sqlite3Put4byte
	ldr	x8, [sp, #8]
	str	x8, [x21, #8]
	mov	x0, x19
	bl	_walIndexWriteHdr
	str	xzr, [x20]
	ldr	x8, [x20, #8]
	str	wzr, [x8, #4]
	ldr	w8, [x24]
	cmp	w8, #3
	b.lt	LBB0_7
; %bb.5:
	mov	w8, #2
Lloh6:
	adrp	x9, _READMARK_NOT_USED@GOTPAGE
Lloh7:
	ldr	x9, [x9, _READMARK_NOT_USED@GOTPAGEOFF]
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w10, [x9]
	ldr	x11, [x20, #8]
	str	w10, [x11, x8, lsl #2]
	add	x8, x8, #1
	ldrsw	x10, [x24]
	cmp	x8, x10
	b.lt	LBB0_6
LBB0_7:
	ldr	x8, [x20, #8]
	ldr	w8, [x8]
	cmp	w8, #0
	cset	w0, eq
	bl	_assert
	mov	w0, #1
	bl	_WAL_READ_LOCK
	mov	x1, x0
	ldr	w8, [x24]
	sub	w2, w8, #1
	mov	x0, x19
	bl	_walUnlockExclusive
	b	LBB0_9
LBB0_8:
	mov	x21, x0
	ldr	w8, [x23]
	cmp	w0, w8
	b.ne	LBB0_12
LBB0_9:
	mov	w0, #0
	bl	_WAL_READ_LOCK
	mov	x1, x0
	mov	x0, x19
	bl	_walUnlockShared
	mov	w8, #-1
	str	w8, [x19]
	mov	w20, #1
Lloh8:
	adrp	x24, _WAL_RETRY@GOTPAGE
Lloh9:
	ldr	x24, [x24, _WAL_RETRY@GOTPAGEOFF]
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	add	x1, sp, #4
	mov	x0, x19
	mov	w2, #1
	mov	x3, x20
	bl	_walTryBeginRead
	ldr	w8, [x24]
	add	w20, w20, #1
	cmp	w0, w8
	b.eq	LBB0_10
; %bb.11:
	mov	x21, x0
	and	w19, w0, #0xff
	ldr	w8, [x23]
	cmp	w19, w8
	cset	w0, ne
	bl	_assert
Lloh10:
	adrp	x8, _SQLITE_IOERR@GOTPAGE
Lloh11:
	ldr	x8, [x8, _SQLITE_IOERR@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	cmp	w19, w8
	cset	w0, eq
	bl	_testcase
Lloh13:
	adrp	x8, _SQLITE_PROTOCOL@GOTPAGE
Lloh14:
	ldr	x8, [x8, _SQLITE_PROTOCOL@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	cmp	w21, w8
	cset	w0, eq
	bl	_testcase
	ldr	w8, [x22]
	cmp	w21, w8
	cset	w0, eq
	bl	_testcase
LBB0_12:
	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
	add	sp, sp, #80
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_SQLITE_OK,4,2                  ; @SQLITE_OK
	.comm	_WAL_NREADER,4,2                ; @WAL_NREADER
	.comm	_READMARK_NOT_USED,4,2          ; @READMARK_NOT_USED
	.comm	_SQLITE_BUSY,4,2                ; @SQLITE_BUSY
	.comm	_WAL_RETRY,4,2                  ; @WAL_RETRY
	.comm	_SQLITE_IOERR,4,2               ; @SQLITE_IOERR
	.comm	_SQLITE_PROTOCOL,4,2            ; @SQLITE_PROTOCOL
	.no_dead_strip	_walRestartLog
.subsections_via_symbols
