	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_sqlite3_backup_finish          ## -- Begin function sqlite3_backup_finish
	.p2align	4, 0x90
_sqlite3_backup_finish:                 ## @sqlite3_backup_finish
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	testq	%rdi, %rdi
	je	LBB0_1
## %bb.2:
	movq	%rdi, %r12
	movq	48(%rdi), %r14
	movl	(%r14), %edi
	callq	_sqlite3_mutex_enter
	movq	16(%r12), %rdi
	callq	_sqlite3BtreeEnter
	movq	8(%r12), %rax
	testq	%rax, %rax
	je	LBB0_5
## %bb.3:
	movl	(%rax), %edi
	callq	_sqlite3_mutex_enter
	cmpq	$0, 8(%r12)
	je	LBB0_5
## %bb.4:
	movq	16(%r12), %rax
	decl	(%rax)
LBB0_5:
	cmpq	$0, 40(%r12)
	je	LBB0_10
## %bb.6:
	movq	16(%r12), %rdi
	callq	_sqlite3BtreePager
	movl	%eax, %edi
	callq	_sqlite3PagerBackupPtr
	movq	%rax, %rbx
	xorl	%edi, %edi
	testq	%rax, %rax
	setne	%dil
	callq	_assert
	movq	(%rbx), %rax
	cmpq	%r12, %rax
	je	LBB0_9
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movq	%rax, %rbx
	movl	$1, %edi
	callq	_assert
	movq	32(%rbx), %rax
	cmpq	%r12, %rax
	jne	LBB0_7
## %bb.8:
	addq	$32, %rbx
LBB0_9:
	movq	32(%r12), %rax
	movq	%rax, (%rbx)
LBB0_10:
	movl	24(%r12), %edi
	movq	_SQLITE_OK@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	xorl	%edx, %edx
	callq	_sqlite3BtreeRollback
	movl	(%r12), %r15d
	movq	_SQLITE_DONE@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r15d
	jne	LBB0_12
## %bb.11:
	movl	(%rbx), %r15d
LBB0_12:
	movq	8(%r12), %rdi
	testq	%rdi, %rdi
	je	LBB0_14
## %bb.13:
	movl	%r15d, %esi
	callq	_sqlite3Error
	movq	8(%r12), %rdi
	callq	_sqlite3LeaveMutexAndCloseZombie
LBB0_14:
	movq	16(%r12), %rdi
	callq	_sqlite3BtreeLeave
	cmpq	$0, 8(%r12)
	je	LBB0_16
## %bb.15:
	movq	%r12, %rdi
	callq	_sqlite3_free
LBB0_16:
	movq	%r14, %rdi
	callq	_sqlite3LeaveMutexAndCloseZombie
	jmp	LBB0_17
LBB0_1:
	movq	_SQLITE_OK@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
LBB0_17:
	movl	%r15d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SQLITE_OK,4,2                  ## @SQLITE_OK
	.comm	_SQLITE_DONE,4,2                ## @SQLITE_DONE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_sqlite3_backup_finish          ; -- Begin function sqlite3_backup_finish
	.p2align	2
_sqlite3_backup_finish:                 ; @sqlite3_backup_finish
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	cbz	x0, LBB0_14
; %bb.1:
	mov	x20, x0
	ldr	x19, [x0, #48]
	ldr	w0, [x19]
	bl	_sqlite3_mutex_enter
	ldr	x0, [x20, #16]
	bl	_sqlite3BtreeEnter
	ldr	x8, [x20, #8]
	cbz	x8, LBB0_4
; %bb.2:
	ldr	w0, [x8]
	bl	_sqlite3_mutex_enter
	ldr	x8, [x20, #8]
	cbz	x8, LBB0_4
; %bb.3:
	ldr	x8, [x20, #16]
	ldr	w9, [x8]
	sub	w9, w9, #1
	str	w9, [x8]
LBB0_4:
	ldr	x8, [x20, #40]
	cbz	x8, LBB0_9
; %bb.5:
	ldr	x0, [x20, #16]
	bl	_sqlite3BtreePager
	bl	_sqlite3PagerBackupPtr
	mov	x21, x0
	cmp	x0, #0
	cset	w0, ne
	bl	_assert
	ldr	x8, [x21]
	cmp	x8, x20
	b.eq	LBB0_8
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	mov	x21, x8
	mov	w0, #1
	bl	_assert
	ldr	x8, [x21, #32]
	cmp	x8, x20
	b.ne	LBB0_6
; %bb.7:
	add	x21, x21, #32
LBB0_8:
	ldr	x8, [x20, #32]
	str	x8, [x21]
LBB0_9:
	ldr	w0, [x20, #24]
Lloh0:
	adrp	x21, _SQLITE_OK@GOTPAGE
Lloh1:
	ldr	x21, [x21, _SQLITE_OK@GOTPAGEOFF]
	ldr	w1, [x21]
	mov	w2, #0
	bl	_sqlite3BtreeRollback
Lloh2:
	adrp	x8, _SQLITE_DONE@GOTPAGE
Lloh3:
	ldr	x8, [x8, _SQLITE_DONE@GOTPAGEOFF]
	ldr	w9, [x20]
Lloh4:
	ldr	w8, [x8]
	ldr	w10, [x21]
	cmp	w9, w8
	csel	w21, w10, w9, eq
	ldr	x0, [x20, #8]
	cbz	x0, LBB0_11
; %bb.10:
	mov	x1, x21
	bl	_sqlite3Error
	ldr	x0, [x20, #8]
	bl	_sqlite3LeaveMutexAndCloseZombie
LBB0_11:
	ldr	x0, [x20, #16]
	bl	_sqlite3BtreeLeave
	ldr	x8, [x20, #8]
	cbz	x8, LBB0_13
; %bb.12:
	mov	x0, x20
	bl	_sqlite3_free
LBB0_13:
	mov	x0, x19
	bl	_sqlite3LeaveMutexAndCloseZombie
	b	LBB0_15
LBB0_14:
Lloh5:
	adrp	x8, _SQLITE_OK@GOTPAGE
Lloh6:
	ldr	x8, [x8, _SQLITE_OK@GOTPAGEOFF]
Lloh7:
	ldr	w21, [x8]
LBB0_15:
	mov	x0, x21
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_SQLITE_OK,4,2                  ; @SQLITE_OK
	.comm	_SQLITE_DONE,4,2                ; @SQLITE_DONE
.subsections_via_symbols
