	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function pager_truncate
_pager_truncate:                        ## @pager_truncate
	.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	%rsi, %r14
	movq	%rdi, %rbx
	movq	_SQLITE_OK@GOTPCREL(%rip), %r12
	movl	(%r12), %r15d
	movq	(%rdi), %rax
	movq	_PAGER_ERROR@GOTPCREL(%rip), %rcx
	xorl	%edi, %edi
	cmpq	(%rcx), %rax
	setne	%dil
	callq	_assert
	movq	(%rbx), %rax
	movq	_PAGER_READER@GOTPCREL(%rip), %rcx
	xorl	%edi, %edi
	cmpq	(%rcx), %rax
	setne	%dil
	callq	_assert
	movl	40(%rbx), %edi
	callq	_isOpen
	testq	%rax, %rax
	je	LBB0_12
## %bb.1:
	movq	(%rbx), %rax
	movq	_PAGER_WRITER_DBMOD@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jge	LBB0_3
## %bb.2:
	movq	_PAGER_OPEN@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_12
LBB0_3:
	movl	8(%rbx), %r13d
	movq	16(%rbx), %rax
	movq	_EXCLUSIVE_LOCK@GOTPCREL(%rip), %rcx
	xorl	%edi, %edi
	cmpq	(%rcx), %rax
	sete	%dil
	callq	_assert
	movl	40(%rbx), %edi
	leaq	-44(%rbp), %rsi
	callq	_sqlite3OsFileSize
	movl	%eax, %r15d
	cmpl	(%r12), %eax
	jne	LBB0_12
## %bb.4:
	movl	%r13d, %ecx
	imull	%r14d, %r13d
	movl	-44(%rbp), %eax
	cmpl	%r13d, %eax
	je	LBB0_12
## %bb.5:
	jle	LBB0_7
## %bb.6:
	movl	40(%rbx), %edi
	movl	%r13d, %esi
	callq	_sqlite3OsTruncate
	jmp	LBB0_9
LBB0_7:
	addl	%ecx, %eax
	cmpl	%r13d, %eax
	jg	LBB0_10
## %bb.8:
	movq	24(%rbx), %rdi
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	xorl	%esi, %esi
	movl	%ecx, %r15d
	movl	%ecx, %edx
	callq	_memset
	subl	%r15d, %r13d
	xorl	%edi, %edi
	cmpl	-44(%rbp), %r13d
	sete	%dil
	callq	_testcase
	xorl	%edi, %edi
	cmpl	-44(%rbp), %r13d
	setg	%dil
	callq	_testcase
	movl	40(%rbx), %edi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movl	%r15d, %edx
	movl	%r13d, %ecx
	callq	_sqlite3OsWrite
LBB0_9:
	movl	%eax, %r15d
LBB0_10:
	cmpl	(%r12), %r15d
	jne	LBB0_12
## %bb.11:
	movq	%r14, 32(%rbx)
LBB0_12:
	movl	%r15d, %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	_PAGER_ERROR,8,3                ## @PAGER_ERROR
	.comm	_PAGER_READER,8,3               ## @PAGER_READER
	.comm	_PAGER_WRITER_DBMOD,8,3         ## @PAGER_WRITER_DBMOD
	.comm	_PAGER_OPEN,8,3                 ## @PAGER_OPEN
	.comm	_EXCLUSIVE_LOCK,8,3             ## @EXCLUSIVE_LOCK
	.no_dead_strip	_pager_truncate
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function pager_truncate
_pager_truncate:                        ; @pager_truncate
	.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
	mov	x19, x1
	mov	x20, x0
Lloh0:
	adrp	x24, _SQLITE_OK@GOTPAGE
Lloh1:
	ldr	x24, [x24, _SQLITE_OK@GOTPAGEOFF]
	ldr	w21, [x24]
	ldr	x8, [x0]
Lloh2:
	adrp	x9, _PAGER_ERROR@GOTPAGE
Lloh3:
	ldr	x9, [x9, _PAGER_ERROR@GOTPAGEOFF]
Lloh4:
	ldr	x9, [x9]
	cmp	x8, x9
	cset	w0, ne
	bl	_assert
	ldr	x8, [x20]
Lloh5:
	adrp	x9, _PAGER_READER@GOTPAGE
Lloh6:
	ldr	x9, [x9, _PAGER_READER@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x9]
	cmp	x8, x9
	cset	w0, ne
	bl	_assert
	ldr	w0, [x20, #40]
	bl	_isOpen
	cbz	x0, LBB0_11
; %bb.1:
	ldr	x8, [x20]
Lloh8:
	adrp	x9, _PAGER_WRITER_DBMOD@GOTPAGE
Lloh9:
	ldr	x9, [x9, _PAGER_WRITER_DBMOD@GOTPAGEOFF]
Lloh10:
	ldr	x9, [x9]
Lloh11:
	adrp	x10, _PAGER_OPEN@GOTPAGE
Lloh12:
	ldr	x10, [x10, _PAGER_OPEN@GOTPAGEOFF]
Lloh13:
	ldr	x10, [x10]
	cmp	x8, x9
	ccmp	x8, x10, #4, lt
	b.ne	LBB0_11
; %bb.2:
	ldr	w22, [x20, #8]
	ldr	x8, [x20, #16]
Lloh14:
	adrp	x9, _EXCLUSIVE_LOCK@GOTPAGE
Lloh15:
	ldr	x9, [x9, _EXCLUSIVE_LOCK@GOTPAGEOFF]
Lloh16:
	ldr	x9, [x9]
	cmp	x8, x9
	cset	w0, eq
	bl	_assert
	ldr	w0, [x20, #40]
	add	x1, sp, #12
	bl	_sqlite3OsFileSize
	mov	x21, x0
	ldr	w8, [x24]
	cmp	w0, w8
	b.ne	LBB0_11
; %bb.3:
	mul	w23, w22, w19
	ldr	w8, [sp, #12]
	cmp	w8, w23
	b.eq	LBB0_11
; %bb.4:
	b.le	LBB0_6
; %bb.5:
	ldr	w0, [x20, #40]
	mov	x1, x23
	bl	_sqlite3OsTruncate
	b	LBB0_8
LBB0_6:
	add	w8, w8, w22
	cmp	w8, w23
	b.gt	LBB0_9
; %bb.7:
	ldr	x21, [x20, #24]
	mov	x0, x21
	mov	w1, #0
	mov	x2, x22
	bl	_memset
	ldr	w8, [sp, #12]
	sub	w23, w23, w22
	cmp	w23, w8
	cset	w0, eq
	bl	_testcase
	ldr	w8, [sp, #12]
	cmp	w23, w8
	cset	w0, gt
	bl	_testcase
	ldr	w0, [x20, #40]
	mov	x1, x21
	mov	x2, x22
	mov	x3, x23
	bl	_sqlite3OsWrite
LBB0_8:
	mov	x21, x0
LBB0_9:
	ldr	w8, [x24]
	cmp	w21, w8
	b.ne	LBB0_11
; %bb.10:
	str	x19, [x20, #32]
LBB0_11:
	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 AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_SQLITE_OK,4,2                  ; @SQLITE_OK
	.comm	_PAGER_ERROR,8,3                ; @PAGER_ERROR
	.comm	_PAGER_READER,8,3               ; @PAGER_READER
	.comm	_PAGER_WRITER_DBMOD,8,3         ; @PAGER_WRITER_DBMOD
	.comm	_PAGER_OPEN,8,3                 ; @PAGER_OPEN
	.comm	_EXCLUSIVE_LOCK,8,3             ; @EXCLUSIVE_LOCK
	.no_dead_strip	_pager_truncate
.subsections_via_symbols
