	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function walIndexRecover
_walIndexRecover:                       ## @walIndexRecover
	.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	$104, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	xorl	%edi, %edi
	cmpl	$2, (%r15)
	setb	%dil
	callq	_assert
	movq	_WAL_ALL_BUT_WRITE@GOTPCREL(%rip), %rbx
	movq	_WAL_WRITE_LOCK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	incl	%eax
	xorl	%edi, %edi
	cmpl	%eax, (%rbx)
	sete	%dil
	callq	_assert
	movq	_WAL_CKPT_LOCK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	xorl	%edi, %edi
	cmpl	(%rbx), %eax
	sete	%dil
	callq	_assert
	movl	4(%r15), %edi
	callq	_assert
	movl	(%r15), %r14d
	addl	(%rbx), %r14d
	xorl	%edi, %edi
	callq	_WAL_READ_LOCK
	subl	%r14d, %eax
	movq	%r15, %rdi
	movl	%r14d, %esi
	movl	%eax, %edx
	callq	_walLockExclusive
	movl	%eax, %ebx
	movq	_SQLITE_OK@GOTPCREL(%rip), %r13
	cmpl	(%r13), %eax
	jne	LBB0_3
## %bb.1:
	movl	$1, %edi
	callq	_WAL_READ_LOCK
	movq	_WAL_NREADER@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	decl	%edx
	movq	%r15, %rdi
	movl	%eax, %esi
	callq	_walLockExclusive
	movl	%eax, %ebx
	cmpl	(%r13), %eax
	je	LBB0_3
## %bb.2:
	xorl	%edi, %edi
	callq	_WAL_READ_LOCK
	subl	%r14d, %eax
	movq	%r15, %rdi
	movl	%r14d, %esi
	movl	%eax, %edx
	callq	_walUnlockExclusive
LBB0_3:
	testl	%ebx, %ebx
	jne	LBB0_37
## %bb.4:
	movq	%r15, %rdi
	callq	_WALTRACE
	leaq	16(%r15), %rdi
	xorl	%esi, %esi
	movl	$4, %edx
	callq	_memset
	movl	56(%r15), %edi
	leaq	-88(%rbp), %rsi
	callq	_sqlite3OsFileSize
	movl	%eax, %r12d
	cmpl	(%r13), %eax
	jne	LBB0_35
## %bb.5:
	movl	$0, -56(%rbp)                   ## 4-byte Folded Spill
	movq	_WAL_HDRSIZE@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rax
	movl	$0, %ecx
	cmpq	%rax, -88(%rbp)
	jle	LBB0_28
## %bb.6:
	movq	%rsp, -120(%rbp)                ## 8-byte Spill
	shlq	$3, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r12
	movl	56(%r15), %edi
	movl	(%rbx), %edx
	movq	%r12, %rsi
	xorl	%ecx, %ecx
	callq	_sqlite3OsRead
	movl	%eax, %ebx
	cmpl	(%r13), %eax
	jne	LBB0_40
## %bb.7:
	movq	%r12, %rdi
	callq	_sqlite3Get4byte
	movq	%r12, %rcx
	movq	%rax, %r12
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	leaq	64(%rcx), %rdi
	callq	_sqlite3Get4byte
	movl	%r12d, %edx
	andl	$-2, %edx
	movq	_WAL_MAGIC@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %edx
	jne	LBB0_26
## %bb.8:
	movl	%eax, %edx
	shrl	%edx
	andl	$1431655765, %edx               ## imm = 0x55555555
	movl	%eax, %ecx
	subl	%edx, %ecx
	movl	%ecx, %edx
	andl	$858993459, %edx                ## imm = 0x33333333
	shrl	$2, %ecx
	andl	$858993459, %ecx                ## imm = 0x33333333
	addl	%edx, %ecx
	movl	%ecx, %edx
	shrl	$4, %edx
	addl	%ecx, %edx
	andl	$252645135, %edx                ## imm = 0xF0F0F0F
	imull	$16843009, %edx, %ecx           ## imm = 0x1010101
	shrl	$24, %ecx
	cmpl	$1, %ecx
	ja	LBB0_26
## %bb.9:
	cmpl	$512, %eax                      ## imm = 0x200
	movl	$0, %ecx
	jl	LBB0_18
## %bb.10:
	movq	_SQLITE_MAX_PAGE_SIZE@GOTPCREL(%rip), %rdx
	cmpl	%eax, (%rdx)
	jl	LBB0_18
## %bb.11:
	andl	$1, %r12d
	movq	%r12, 16(%r15)
	movl	%eax, 8(%r15)
	movq	-56(%rbp), %r12                 ## 8-byte Reload
	leaq	96(%r12), %rdi
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	callq	_sqlite3Get4byte
	movq	%rax, 64(%r15)
	leaq	48(%r15), %rdi
	leaq	128(%r12), %rsi
	movl	$8, %edx
	callq	_memcpy
	movq	_SQLITE_BIGENDIAN@GOTPCREL(%rip), %rax
	movq	16(%r15), %rcx
	xorl	%edi, %edi
	cmpq	(%rax), %rcx
	movq	24(%r15), %r8
	sete	%dil
	movq	_WAL_HDRSIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	addq	$-8, %rdx
	movq	%r12, %rsi
	xorl	%ecx, %ecx
	callq	_walChecksumBytes
	movq	24(%r15), %rax
	movslq	(%rax), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	leaq	192(%r12), %rdi
	callq	_sqlite3Get4byte
	cmpq	-64(%rbp), %rax                 ## 8-byte Folded Reload
	jne	LBB0_26
## %bb.12:
	movq	24(%r15), %rax
	movslq	4(%rax), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	leaq	224(%r12), %rdi
	callq	_sqlite3Get4byte
	cmpq	-64(%rbp), %rax                 ## 8-byte Folded Reload
	jne	LBB0_26
## %bb.13:
	addq	$32, %r12
	movq	%r12, %rdi
	callq	_sqlite3Get4byte
	movq	_WAL_MAX_VERSION@GOTPCREL(%rip), %rcx
	cmpl	%eax, (%rcx)
	jne	LBB0_25
## %bb.14:
	movq	_WAL_FRAME_HDRSIZE@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	movslq	-72(%rbp), %r12                 ## 4-byte Folded Reload
	addq	%rax, %r12
	movl	%r12d, %edi
	callq	_sqlite3_malloc64
	testq	%rax, %rax
	je	LBB0_39
## %bb.15:
	movq	%rax, %rsi
	movq	_WAL_HDRSIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %r8
	leaq	(%r8,%r12), %rax
	xorl	%ecx, %ecx
	movq	%rcx, -80(%rbp)                 ## 8-byte Spill
	movl	$0, -56(%rbp)                   ## 4-byte Folded Spill
	cmpq	-88(%rbp), %rax
	jg	LBB0_42
## %bb.16:
	movq	%r12, %rdx
	movq	_WAL_FRAME_HDRSIZE@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	leaq	(%rsi,%rax,8), %rax
	movq	%rax, -144(%rbp)                ## 8-byte Spill
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	movl	%ecx, %eax
	andl	$65280, %eax                    ## imm = 0xFF00
	movl	%ecx, %edi
	shrl	$16, %edi
	orl	%eax, %edi
	movq	%rdi, -128(%rbp)                ## 8-byte Spill
	xorl	%eax, %eax
	cmpl	$32769, %ecx                    ## imm = 0x8001
	setb	%al
	movl	%eax, -96(%rbp)                 ## 4-byte Spill
	xorl	%eax, %eax
	cmpl	$65536, %ecx                    ## imm = 0x10000
	setae	%al
	movl	%eax, -92(%rbp)                 ## 4-byte Spill
	movl	$0, -56(%rbp)                   ## 4-byte Folded Spill
	movl	$1, -64(%rbp)                   ## 4-byte Folded Spill
	xorl	%eax, %eax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	movq	%rsi, -112(%rbp)                ## 8-byte Spill
	movq	%r12, -136(%rbp)                ## 8-byte Spill
	jmp	LBB0_20
LBB0_18:
	movl	$0, -56(%rbp)                   ## 4-byte Folded Spill
	jmp	LBB0_27
LBB0_19:                                ##   in Loop: Header=BB0_20 Depth=1
	movq	-136(%rbp), %rdx                ## 8-byte Reload
	movq	-72(%rbp), %r8                  ## 8-byte Reload
	addq	%rdx, %r8
	leaq	(%rdx,%r8), %rax
	incl	%r12d
	movl	%r12d, -64(%rbp)                ## 4-byte Spill
	cmpq	-88(%rbp), %rax
	movq	-112(%rbp), %rsi                ## 8-byte Reload
	jg	LBB0_42
LBB0_20:                                ## =>This Inner Loop Header: Depth=1
	movl	56(%r15), %edi
	movq	%rsi, %r12
                                        ## kill: def $edx killed $edx killed $rdx
	movq	%r8, -72(%rbp)                  ## 8-byte Spill
	movq	%r8, %rcx
	callq	_sqlite3OsRead
	movl	%eax, %ebx
	cmpl	(%r13), %eax
	jne	LBB0_41
## %bb.21:                              ##   in Loop: Header=BB0_20 Depth=1
	movq	%r15, %rdi
	leaq	-104(%rbp), %rsi
	leaq	-100(%rbp), %rdx
	movq	-144(%rbp), %rcx                ## 8-byte Reload
	movq	%r12, %r8
	callq	_walDecodeFrame
	testl	%eax, %eax
	je	LBB0_41
## %bb.22:                              ##   in Loop: Header=BB0_20 Depth=1
	movl	-104(%rbp), %edx
	movq	%r15, %rdi
	movl	-64(%rbp), %r12d                ## 4-byte Reload
	movl	%r12d, %esi
	callq	_walIndexAppend
	movl	%eax, %ebx
	cmpl	(%r13), %eax
	jne	LBB0_41
## %bb.23:                              ##   in Loop: Header=BB0_20 Depth=1
	movl	-100(%rbp), %eax
	testl	%eax, %eax
	je	LBB0_19
## %bb.24:                              ##   in Loop: Header=BB0_20 Depth=1
	movl	%r12d, 32(%r15)
	movl	%eax, 36(%r15)
	movq	-128(%rbp), %rax                ## 8-byte Reload
	movq	%rax, 40(%r15)
	movl	-96(%rbp), %edi                 ## 4-byte Reload
	callq	_testcase
	movl	-92(%rbp), %edi                 ## 4-byte Reload
	callq	_testcase
	movq	24(%r15), %rax
	movl	(%rax), %ecx
	movl	%ecx, -56(%rbp)                 ## 4-byte Spill
	movl	4(%rax), %eax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	jmp	LBB0_19
LBB0_25:
	movq	_SQLITE_CANTOPEN_BKPT@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
LBB0_26:
	movl	$0, -56(%rbp)                   ## 4-byte Folded Spill
	xorl	%ecx, %ecx
LBB0_27:
	movq	-120(%rbp), %rsp                ## 8-byte Reload
	movl	(%r13), %r12d
	cmpl	%r12d, %ebx
	jne	LBB0_36
LBB0_28:
	movq	24(%r15), %rax
	movl	-56(%rbp), %edx                 ## 4-byte Reload
	movl	%edx, (%rax)
	movl	%ecx, 4(%rax)
	movq	%r15, %rdi
	callq	_walIndexWriteHdr
	movq	%r15, %rdi
	callq	_walCkptInfo
	movq	$0, 16(%rax)
	movl	32(%r15), %ecx
	movl	%ecx, (%rax)
	movq	8(%rax), %rcx
	movl	$0, (%rcx)
	movq	_WAL_NREADER@GOTPCREL(%rip), %rcx
	cmpl	$2, (%rcx)
	jl	LBB0_31
## %bb.29:
	movl	$1, %edx
	movq	_READMARK_NOT_USED@GOTPCREL(%rip), %rsi
	.p2align	4, 0x90
LBB0_30:                                ## =>This Inner Loop Header: Depth=1
	movl	(%rsi), %edi
	movq	8(%rax), %rbx
	movl	%edi, (%rbx,%rdx,4)
	incq	%rdx
	movslq	(%rcx), %rdi
	cmpq	%rdi, %rdx
	jl	LBB0_30
LBB0_31:
	movl	32(%r15), %ecx
	testl	%ecx, %ecx
	je	LBB0_33
## %bb.32:
	movq	8(%rax), %rax
	movl	%ecx, 4(%rax)
LBB0_33:
	cmpl	$0, 36(%r15)
	je	LBB0_35
## %bb.34:
	movq	_SQLITE_NOTICE_RECOVER_WAL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	12(%r15), %ecx
	movl	32(%r15), %edx
	leaq	L_.str.1(%rip), %rsi
	callq	_sqlite3_log
LBB0_35:
	movl	%r12d, %ebx
LBB0_36:
	testl	%ebx, %ebx
	leaq	L_.str.4(%rip), %rax
	leaq	L_.str.3(%rip), %rdi
	cmoveq	%rax, %rdi
	callq	_WALTRACE
	xorl	%edi, %edi
	callq	_WAL_READ_LOCK
	subl	%r14d, %eax
	movq	%r15, %rdi
	movl	%r14d, %esi
	movl	%eax, %edx
	callq	_walUnlockExclusive
	movl	$1, %edi
	callq	_WAL_READ_LOCK
	movq	_WAL_NREADER@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	decl	%edx
	movq	%r15, %rdi
	movl	%eax, %esi
	callq	_walUnlockExclusive
LBB0_37:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_43
## %bb.38:
	movl	%ebx, %eax
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_39:
	movq	_SQLITE_NOMEM_BKPT@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
LBB0_40:
	movq	-120(%rbp), %rsp                ## 8-byte Reload
	jmp	LBB0_36
LBB0_41:
	movq	-112(%rbp), %rsi                ## 8-byte Reload
LBB0_42:
	movq	%rsi, %rdi
	callq	_sqlite3_free
	movq	-80(%rbp), %rcx                 ## 8-byte Reload
	jmp	LBB0_27
LBB0_43:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_WAL_ALL_BUT_WRITE,4,2          ## @WAL_ALL_BUT_WRITE
	.comm	_WAL_WRITE_LOCK,4,2             ## @WAL_WRITE_LOCK
	.comm	_WAL_CKPT_LOCK,4,2              ## @WAL_CKPT_LOCK
	.comm	_SQLITE_OK,4,2                  ## @SQLITE_OK
	.comm	_WAL_NREADER,4,2                ## @WAL_NREADER
	.comm	_WAL_HDRSIZE,8,3                ## @WAL_HDRSIZE
	.comm	_WAL_MAGIC,4,2                  ## @WAL_MAGIC
	.comm	_SQLITE_MAX_PAGE_SIZE,4,2       ## @SQLITE_MAX_PAGE_SIZE
	.comm	_SQLITE_BIGENDIAN,8,3           ## @SQLITE_BIGENDIAN
	.comm	_WAL_MAX_VERSION,4,2            ## @WAL_MAX_VERSION
	.comm	_SQLITE_CANTOPEN_BKPT,4,2       ## @SQLITE_CANTOPEN_BKPT
	.comm	_WAL_FRAME_HDRSIZE,4,2          ## @WAL_FRAME_HDRSIZE
	.comm	_SQLITE_NOMEM_BKPT,4,2          ## @SQLITE_NOMEM_BKPT
	.comm	_READMARK_NOT_USED,4,2          ## @READMARK_NOT_USED
	.comm	_SQLITE_NOTICE_RECOVER_WAL,4,2  ## @SQLITE_NOTICE_RECOVER_WAL
	.section	__TEXT,__cstring,cstring_literals
L_.str.1:                               ## @.str.1
	.asciz	"recovered %d frames from WAL file %s"

L_.str.3:                               ## @.str.3
	.asciz	"failed"

L_.str.4:                               ## @.str.4
	.asciz	"ok"

	.no_dead_strip	_walIndexRecover
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function walIndexRecover
_walIndexRecover:                       ; @walIndexRecover
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	sub	sp, sp, #80
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-88]
	ldr	w8, [x0]
	cmp	w8, #2
	cset	w0, lo
	bl	_assert
Lloh3:
	adrp	x20, _WAL_ALL_BUT_WRITE@GOTPAGE
Lloh4:
	ldr	x20, [x20, _WAL_ALL_BUT_WRITE@GOTPAGEOFF]
	ldr	w8, [x20]
Lloh5:
	adrp	x9, _WAL_WRITE_LOCK@GOTPAGE
Lloh6:
	ldr	x9, [x9, _WAL_WRITE_LOCK@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	add	w9, w9, #1
	cmp	w8, w9
	cset	w0, eq
	bl	_assert
Lloh8:
	adrp	x8, _WAL_CKPT_LOCK@GOTPAGE
Lloh9:
	ldr	x8, [x8, _WAL_CKPT_LOCK@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	ldr	w9, [x20]
	cmp	w8, w9
	cset	w0, eq
	bl	_assert
	ldr	w0, [x19, #4]
	bl	_assert
	ldr	w8, [x20]
	ldr	w9, [x19]
	add	w20, w9, w8
	mov	w0, #0
	bl	_WAL_READ_LOCK
	sub	w2, w0, w20
	mov	x0, x19
	mov	x1, x20
	bl	_walLockExclusive
	mov	x21, x0
Lloh11:
	adrp	x26, _SQLITE_OK@GOTPAGE
Lloh12:
	ldr	x26, [x26, _SQLITE_OK@GOTPAGEOFF]
	ldr	w8, [x26]
	cmp	w0, w8
	b.ne	LBB0_3
; %bb.1:
	mov	w0, #1
	bl	_WAL_READ_LOCK
	mov	x1, x0
Lloh13:
	adrp	x8, _WAL_NREADER@GOTPAGE
Lloh14:
	ldr	x8, [x8, _WAL_NREADER@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	sub	w2, w8, #1
	mov	x0, x19
	bl	_walLockExclusive
	mov	x21, x0
	ldr	w8, [x26]
	cmp	w0, w8
	b.eq	LBB0_3
; %bb.2:
	mov	w0, #0
	bl	_WAL_READ_LOCK
	sub	w2, w0, w20
	mov	x0, x19
	mov	x1, x20
	bl	_walUnlockExclusive
LBB0_3:
	cbnz	w21, LBB0_25
; %bb.4:
	mov	x0, x19
	bl	_WALTRACE
	add	x0, x19, #16
	mov	w1, #0
	mov	w2, #4
	bl	_memset
	ldr	w0, [x19, #56]
	sub	x1, x29, #96
	bl	_sqlite3OsFileSize
	mov	x22, x0
	ldr	w8, [x26]
Lloh16:
	adrp	x27, _WAL_NREADER@GOTPAGE
Lloh17:
	ldr	x27, [x27, _WAL_NREADER@GOTPAGEOFF]
	cmp	w0, w8
	b.ne	LBB0_23
; %bb.5:
	ldur	x9, [x29, #-96]
Lloh18:
	adrp	x28, _WAL_HDRSIZE@GOTPAGE
Lloh19:
	ldr	x28, [x28, _WAL_HDRSIZE@GOTPAGEOFF]
	ldr	x8, [x28]
	cmp	x9, x8
	b.le	LBB0_15
; %bb.6:
	mov	x25, sp
	lsl	x8, x8, #3
	mov	x9, x8
Lloh20:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh21:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x8, x8, #15
	and	x8, x8, #0xfffffffffffffff0
	sub	x22, x9, x8
	mov	sp, x22
	ldr	w0, [x19, #56]
	ldr	w2, [x28]
	mov	x1, x22
	mov	x3, #0
	bl	_sqlite3OsRead
	mov	x21, x0
	ldr	w8, [x26]
	cmp	w0, w8
	b.ne	LBB0_33
; %bb.7:
	mov	x0, x22
	bl	_sqlite3Get4byte
	mov	x24, x0
	add	x0, x22, #64
	bl	_sqlite3Get4byte
	and	w8, w24, #0xfffffffe
Lloh22:
	adrp	x9, _WAL_MAGIC@GOTPAGE
Lloh23:
	ldr	x9, [x9, _WAL_MAGIC@GOTPAGEOFF]
Lloh24:
	ldr	w9, [x9]
	movi.2d	v1, #0000000000000000
	cmp	w8, w9
	b.ne	LBB0_14
; %bb.8:
	mov	x23, x0
	and	x8, x0, #0xffffffff
	fmov	d0, x8
	cnt.8b	v0, v0
	uaddlv.8b	h0, v0
	fmov	w8, s0
	cmp	w8, #1
	b.hi	LBB0_14
; %bb.9:
	movi.2d	v1, #0000000000000000
	cmp	w23, #512
	b.lt	LBB0_14
; %bb.10:
Lloh25:
	adrp	x8, _SQLITE_MAX_PAGE_SIZE@GOTPAGE
Lloh26:
	ldr	x8, [x8, _SQLITE_MAX_PAGE_SIZE@GOTPAGEOFF]
Lloh27:
	ldr	w8, [x8]
	cmp	w8, w23
	b.lt	LBB0_14
; %bb.11:
	and	x8, x24, #0x1
	str	x8, [x19, #16]
	str	w23, [x19, #8]
	add	x0, x22, #96
	bl	_sqlite3Get4byte
	str	x0, [x19, #64]
	add	x0, x19, #48
	add	x1, x22, #128
	mov	w2, #8
	bl	_memcpy
Lloh28:
	adrp	x8, _SQLITE_BIGENDIAN@GOTPAGE
Lloh29:
	ldr	x8, [x8, _SQLITE_BIGENDIAN@GOTPAGEOFF]
Lloh30:
	ldr	x8, [x8]
	ldp	x9, x4, [x19, #16]
	cmp	x9, x8
	cset	w0, eq
	ldr	x8, [x28]
	sub	x2, x8, #8
	mov	x1, x22
	mov	w3, #0
	bl	_walChecksumBytes
	ldr	x8, [x19, #24]
	ldrsw	x24, [x8]
	add	x0, x22, #192
	bl	_sqlite3Get4byte
	cmp	x0, x24
	b.ne	LBB0_13
; %bb.12:
	ldr	x8, [x19, #24]
	ldrsw	x24, [x8, #4]
	add	x0, x22, #224
	bl	_sqlite3Get4byte
	cmp	x0, x24
	b.eq	LBB0_27
LBB0_13:
	movi.2d	v1, #0000000000000000
LBB0_14:
	mov	sp, x25
	ldr	w22, [x26]
	cmp	w21, w22
	b.eq	LBB0_16
	b	LBB0_24
LBB0_15:
	movi.2d	v1, #0000000000000000
LBB0_16:
	ldr	x8, [x19, #24]
	str	d1, [x8]
	mov	x0, x19
	bl	_walIndexWriteHdr
	mov	x0, x19
	bl	_walCkptInfo
	str	xzr, [x0, #16]
	ldr	w8, [x19, #32]
	str	w8, [x0]
	ldr	x8, [x0, #8]
	str	wzr, [x8]
	ldr	w8, [x27]
	cmp	w8, #2
	b.lt	LBB0_19
; %bb.17:
	mov	w8, #1
Lloh31:
	adrp	x9, _READMARK_NOT_USED@GOTPAGE
Lloh32:
	ldr	x9, [x9, _READMARK_NOT_USED@GOTPAGEOFF]
LBB0_18:                                ; =>This Inner Loop Header: Depth=1
	ldr	w10, [x9]
	ldr	x11, [x0, #8]
	str	w10, [x11, x8, lsl #2]
	add	x8, x8, #1
	ldrsw	x10, [x27]
	cmp	x8, x10
	b.lt	LBB0_18
LBB0_19:
	ldr	w8, [x19, #32]
	cbz	w8, LBB0_21
; %bb.20:
	ldr	x9, [x0, #8]
	str	w8, [x9, #4]
LBB0_21:
	ldr	w8, [x19, #36]
	cbz	w8, LBB0_23
; %bb.22:
Lloh33:
	adrp	x8, _SQLITE_NOTICE_RECOVER_WAL@GOTPAGE
Lloh34:
	ldr	x8, [x8, _SQLITE_NOTICE_RECOVER_WAL@GOTPAGEOFF]
Lloh35:
	ldr	w0, [x8]
	ldr	w2, [x19, #32]
	ldr	w3, [x19, #12]
Lloh36:
	adrp	x1, l_.str.1@PAGE
Lloh37:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_sqlite3_log
LBB0_23:
	mov	x21, x22
LBB0_24:
Lloh38:
	adrp	x8, l_.str.3@PAGE
Lloh39:
	add	x8, x8, l_.str.3@PAGEOFF
Lloh40:
	adrp	x9, l_.str.4@PAGE
Lloh41:
	add	x9, x9, l_.str.4@PAGEOFF
	cmp	w21, #0
	csel	x0, x9, x8, eq
	bl	_WALTRACE
	mov	w0, #0
	bl	_WAL_READ_LOCK
	sub	w2, w0, w20
	mov	x0, x19
	mov	x1, x20
	bl	_walUnlockExclusive
	mov	w0, #1
	bl	_WAL_READ_LOCK
	mov	x1, x0
	ldr	w8, [x27]
	sub	w2, w8, #1
	mov	x0, x19
	bl	_walUnlockExclusive
LBB0_25:
	ldur	x8, [x29, #-88]
Lloh42:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh43:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh44:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_43
; %bb.26:
	mov	x0, x21
	sub	sp, x29, #80
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_27:
	add	x0, x22, #32
	bl	_sqlite3Get4byte
Lloh45:
	adrp	x8, _WAL_MAX_VERSION@GOTPAGE
Lloh46:
	ldr	x8, [x8, _WAL_MAX_VERSION@GOTPAGEOFF]
Lloh47:
	ldr	w8, [x8]
	cmp	w8, w0
	b.ne	LBB0_31
; %bb.28:
Lloh48:
	adrp	x22, _WAL_FRAME_HDRSIZE@GOTPAGE
Lloh49:
	ldr	x22, [x22, _WAL_FRAME_HDRSIZE@GOTPAGEOFF]
	ldrsw	x8, [x22]
	add	x24, x8, w23, sxtw
	mov	x0, x24
	bl	_sqlite3_malloc64
	cbz	x0, LBB0_32
; %bb.29:
	mov	x10, x0
	mov	x11, x22
	ldr	x22, [x28]
	ldur	x8, [x29, #-96]
	add	x9, x22, x24
	cmp	x9, x8
	b.le	LBB0_34
; %bb.30:
	movi.2d	v0, #0000000000000000
	stur	q0, [x29, #-128]                ; 16-byte Folded Spill
	b	LBB0_42
LBB0_31:
	movi.2d	v1, #0000000000000000
Lloh50:
	adrp	x8, _SQLITE_CANTOPEN_BKPT@GOTPAGE
Lloh51:
	ldr	x8, [x8, _SQLITE_CANTOPEN_BKPT@GOTPAGEOFF]
Lloh52:
	ldr	w21, [x8]
	b	LBB0_14
LBB0_32:
Lloh53:
	adrp	x8, _SQLITE_NOMEM_BKPT@GOTPAGE
Lloh54:
	ldr	x8, [x8, _SQLITE_NOMEM_BKPT@GOTPAGEOFF]
Lloh55:
	ldr	w21, [x8]
LBB0_33:
	mov	sp, x25
	b	LBB0_24
LBB0_34:
	mov	x2, x24
	ldrsw	x8, [x11]
	add	x11, x10, x8, lsl #3
	and	w8, w23, #0xff00
	lsr	w9, w23, #16
	orr	w8, w8, w9
	stp	x8, x11, [x29, #-152]           ; 16-byte Folded Spill
	cmp	w23, #8, lsl #12                ; =32768
	cset	w11, ls
	cmp	w9, #0
	cset	w8, ne
	stp	w8, w11, [x29, #-160]           ; 8-byte Folded Spill
	movi.2d	v0, #0000000000000000
	stur	q0, [x29, #-128]                ; 16-byte Folded Spill
	mov	w28, #1
	stur	x10, [x29, #-136]               ; 8-byte Folded Spill
	b	LBB0_36
LBB0_35:                                ;   in Loop: Header=BB0_36 Depth=1
	stur	q0, [x29, #-128]                ; 16-byte Folded Spill
	ldur	x8, [x29, #-96]
	mov	x2, x24
	add	x22, x22, x24
	add	x9, x24, x22
	add	w28, w28, #1
	cmp	x9, x8
	ldur	x10, [x29, #-136]               ; 8-byte Folded Reload
	b.gt	LBB0_42
LBB0_36:                                ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x19, #56]
	mov	x23, x10
	mov	x1, x10
	mov	x24, x2
                                        ; kill: def $w2 killed $w2 killed $x2
	mov	x3, x22
	bl	_sqlite3OsRead
	mov	x21, x0
	ldr	w8, [x26]
	cmp	w0, w8
	b.ne	LBB0_41
; %bb.37:                               ;   in Loop: Header=BB0_36 Depth=1
	sub	x1, x29, #100
	sub	x2, x29, #104
	mov	x0, x19
	ldur	x3, [x29, #-144]                ; 8-byte Folded Reload
	mov	x4, x23
	bl	_walDecodeFrame
	cbz	w0, LBB0_41
; %bb.38:                               ;   in Loop: Header=BB0_36 Depth=1
	ldur	w2, [x29, #-100]
	mov	x0, x19
	mov	x1, x28
	bl	_walIndexAppend
	mov	x21, x0
	ldr	w8, [x26]
	cmp	w0, w8
	b.ne	LBB0_41
; %bb.39:                               ;   in Loop: Header=BB0_36 Depth=1
	ldur	w8, [x29, #-104]
	ldur	q0, [x29, #-128]                ; 16-byte Folded Reload
	cbz	w8, LBB0_35
; %bb.40:                               ;   in Loop: Header=BB0_36 Depth=1
	stp	w28, w8, [x19, #32]
	ldur	x8, [x29, #-152]                ; 8-byte Folded Reload
	str	x8, [x19, #40]
	ldur	w0, [x29, #-156]                ; 4-byte Folded Reload
	bl	_testcase
	ldur	w0, [x29, #-160]                ; 4-byte Folded Reload
	bl	_testcase
	ldr	x8, [x19, #24]
	ldr	d0, [x8]
	b	LBB0_35
LBB0_41:
	ldur	x10, [x29, #-136]               ; 8-byte Folded Reload
LBB0_42:
	mov	x0, x10
	bl	_sqlite3_free
	ldur	q1, [x29, #-128]                ; 16-byte Folded Reload
	b	LBB0_14
LBB0_43:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpAdd	Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpAdd	Lloh40, Lloh41
	.loh AdrpAdd	Lloh38, Lloh39
	.loh AdrpLdrGotLdr	Lloh42, Lloh43, Lloh44
	.loh AdrpLdrGotLdr	Lloh45, Lloh46, Lloh47
	.loh AdrpLdrGot	Lloh48, Lloh49
	.loh AdrpLdrGotLdr	Lloh50, Lloh51, Lloh52
	.loh AdrpLdrGotLdr	Lloh53, Lloh54, Lloh55
	.cfi_endproc
                                        ; -- End function
	.comm	_WAL_ALL_BUT_WRITE,4,2          ; @WAL_ALL_BUT_WRITE
	.comm	_WAL_WRITE_LOCK,4,2             ; @WAL_WRITE_LOCK
	.comm	_WAL_CKPT_LOCK,4,2              ; @WAL_CKPT_LOCK
	.comm	_SQLITE_OK,4,2                  ; @SQLITE_OK
	.comm	_WAL_NREADER,4,2                ; @WAL_NREADER
	.comm	_WAL_HDRSIZE,8,3                ; @WAL_HDRSIZE
	.comm	_WAL_MAGIC,4,2                  ; @WAL_MAGIC
	.comm	_SQLITE_MAX_PAGE_SIZE,4,2       ; @SQLITE_MAX_PAGE_SIZE
	.comm	_SQLITE_BIGENDIAN,8,3           ; @SQLITE_BIGENDIAN
	.comm	_WAL_MAX_VERSION,4,2            ; @WAL_MAX_VERSION
	.comm	_SQLITE_CANTOPEN_BKPT,4,2       ; @SQLITE_CANTOPEN_BKPT
	.comm	_WAL_FRAME_HDRSIZE,4,2          ; @WAL_FRAME_HDRSIZE
	.comm	_SQLITE_NOMEM_BKPT,4,2          ; @SQLITE_NOMEM_BKPT
	.comm	_READMARK_NOT_USED,4,2          ; @READMARK_NOT_USED
	.comm	_SQLITE_NOTICE_RECOVER_WAL,4,2  ; @SQLITE_NOTICE_RECOVER_WAL
	.section	__TEXT,__cstring,cstring_literals
l_.str.1:                               ; @.str.1
	.asciz	"recovered %d frames from WAL file %s"

l_.str.3:                               ; @.str.3
	.asciz	"failed"

l_.str.4:                               ; @.str.4
	.asciz	"ok"

	.no_dead_strip	_walIndexRecover
.subsections_via_symbols
