	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_psb_mmu_remove_pages           ## -- Begin function psb_mmu_remove_pages
	.p2align	4, 0x90
_psb_mmu_remove_pages:                  ## @psb_mmu_remove_pages
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, -72(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r13
	testl	%r8d, %r8d
	movl	%edx, -48(%rbp)                 ## 4-byte Spill
	je	LBB0_1
## %bb.2:
	movl	%ecx, %ebx
	movl	%edx, %eax
	cltd
	idivl	%ecx
	movl	%eax, %r15d
	jmp	LBB0_3
LBB0_1:
	movl	$1, %r15d
	movl	%edx, %ebx
LBB0_3:
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	movl	%ebx, -44(%rbp)                 ## 4-byte Spill
	movl	%ebx, %r14d
	shll	%cl, %r14d
	movl	%r8d, -52(%rbp)                 ## 4-byte Spill
	movl	%r8d, %ebx
	shll	%cl, %ebx
	movq	8(%r13), %rdi
	callq	_down_read
	testl	%r15d, %r15d
	jle	LBB0_12
## %bb.4:
	movslq	%r14d, %rax
	movq	%rax, -88(%rbp)                 ## 8-byte Spill
	movslq	%ebx, %rax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	xorl	%eax, %eax
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rbx
	movq	-72(%rbp), %r14                 ## 8-byte Reload
	movl	%r15d, -56(%rbp)                ## 4-byte Spill
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_5 Depth=1
	movq	-96(%rbp), %r14                 ## 8-byte Reload
	addq	-80(%rbp), %r14                 ## 8-byte Folded Reload
	movl	-60(%rbp), %eax                 ## 4-byte Reload
	incl	%eax
	movl	-56(%rbp), %r15d                ## 4-byte Reload
	cmpl	%r15d, %eax
	je	LBB0_12
LBB0_5:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_6 Depth 2
                                        ##       Child Loop BB0_8 Depth 3
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	movq	-88(%rbp), %rax                 ## 8-byte Reload
	leaq	(%r14,%rax), %rsi
	movq	%r14, -96(%rbp)                 ## 8-byte Spill
	movq	%rsi, -104(%rbp)                ## 8-byte Spill
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_6 Depth=2
	movq	%r12, %r14
	movq	-104(%rbp), %rsi                ## 8-byte Reload
	cmpq	%rsi, %r12
	movq	%r15, %r13
	je	LBB0_11
LBB0_6:                                 ##   Parent Loop BB0_5 Depth=1
                                        ## =>  This Loop Header: Depth=2
                                        ##       Child Loop BB0_8 Depth 3
	movq	%r14, %rdi
	callq	_psb_pd_addr_end
	movq	%rax, %r12
	movq	%r13, %r15
	movq	%r13, %rdi
	movq	%r14, %rsi
	callq	_psb_mmu_pt_map_lock
	testq	%rax, %rax
	je	LBB0_10
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=2
	movq	%rax, %r13
	.p2align	4, 0x90
LBB0_8:                                 ##   Parent Loop BB0_5 Depth=1
                                        ##     Parent Loop BB0_6 Depth=2
                                        ## =>    This Inner Loop Header: Depth=3
	movq	%r13, %rdi
	movq	%r14, %rsi
	callq	_psb_mmu_invalidate_pte
	decl	(%r13)
	movslq	(%rbx), %rax
	addq	%rax, %r14
	cmpq	%r12, %r14
	jb	LBB0_8
## %bb.9:                               ##   in Loop: Header=BB0_6 Depth=2
	movq	%r13, %rdi
	callq	_psb_mmu_pt_unmap_unlock
	jmp	LBB0_10
LBB0_12:
	cmpl	$-1, (%r13)
	je	LBB0_14
## %bb.13:
	movq	%r13, %rdi
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	movl	-48(%rbp), %edx                 ## 4-byte Reload
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	movl	-52(%rbp), %r8d                 ## 4-byte Reload
	callq	_psb_mmu_flush_ptes
LBB0_14:
	movq	8(%r13), %rdi
	callq	_up_read
	cmpl	$-1, (%r13)
	je	LBB0_15
## %bb.16:
	movq	8(%r13), %rdi
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_psb_mmu_flush                  ## TAILCALL
LBB0_15:
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PAGE_SHIFT,4,2                 ## @PAGE_SHIFT
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_psb_mmu_remove_pages           ; -- Begin function psb_mmu_remove_pages
	.p2align	2
_psb_mmu_remove_pages:                  ; @psb_mmu_remove_pages
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	str	x1, [sp, #8]                    ; 8-byte Folded Spill
	mov	x19, x0
	str	w4, [sp, #20]                   ; 4-byte Folded Spill
	str	w2, [sp]                        ; 4-byte Folded Spill
	cbz	w4, LBB0_2
; %bb.1:
	str	w3, [sp, #4]                    ; 4-byte Folded Spill
	sdiv	w21, w2, w3
	b	LBB0_3
LBB0_2:
	mov	w21, #1
	str	w2, [sp, #4]                    ; 4-byte Folded Spill
LBB0_3:
Lloh0:
	adrp	x8, _PAGE_SHIFT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PAGE_SHIFT@GOTPAGEOFF]
Lloh2:
	ldr	w20, [x8]
	ldr	x0, [x19, #8]
	bl	_down_read
	cmp	w21, #1
	b.lt	LBB0_12
; %bb.4:
	mov	w22, #0
	ldr	w8, [sp, #4]                    ; 4-byte Folded Reload
	lsl	w8, w8, w20
	sxtw	x8, w8
	str	x8, [sp, #24]                   ; 8-byte Folded Spill
	ldr	w8, [sp, #20]                   ; 4-byte Folded Reload
	lsl	w8, w8, w20
	sxtw	x20, w8
Lloh3:
	adrp	x23, _PAGE_SIZE@GOTPAGE
Lloh4:
	ldr	x23, [x23, _PAGE_SIZE@GOTPAGEOFF]
	ldr	x28, [sp, #8]                   ; 8-byte Folded Reload
	b	LBB0_6
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=1
	add	x28, x28, x20
	add	w22, w22, #1
	cmp	w22, w21
	b.eq	LBB0_12
LBB0_6:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_8 Depth 2
                                        ;       Child Loop BB0_10 Depth 3
	ldr	x8, [sp, #24]                   ; 8-byte Folded Reload
	add	x24, x28, x8
	mov	x25, x28
	b	LBB0_8
LBB0_7:                                 ;   in Loop: Header=BB0_8 Depth=2
	mov	x25, x26
	cmp	x26, x24
	b.eq	LBB0_5
LBB0_8:                                 ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB0_10 Depth 3
	mov	x0, x25
	mov	x1, x24
	bl	_psb_pd_addr_end
	mov	x26, x0
	mov	x0, x19
	mov	x1, x25
	bl	_psb_mmu_pt_map_lock
	cbz	x0, LBB0_7
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=2
	mov	x27, x0
LBB0_10:                                ;   Parent Loop BB0_6 Depth=1
                                        ;     Parent Loop BB0_8 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	mov	x0, x27
	mov	x1, x25
	bl	_psb_mmu_invalidate_pte
	ldr	w8, [x27]
	sub	w8, w8, #1
	str	w8, [x27]
	ldrsw	x8, [x23]
	add	x25, x25, x8
	cmp	x25, x26
	b.lo	LBB0_10
; %bb.11:                               ;   in Loop: Header=BB0_8 Depth=2
	mov	x0, x27
	bl	_psb_mmu_pt_unmap_unlock
	b	LBB0_7
LBB0_12:
	ldr	w8, [x19]
	cmn	w8, #1
	b.eq	LBB0_14
; %bb.13:
	mov	x0, x19
	ldr	x1, [sp, #8]                    ; 8-byte Folded Reload
	ldp	w2, w3, [sp]                    ; 8-byte Folded Reload
	ldr	w4, [sp, #20]                   ; 4-byte Folded Reload
	bl	_psb_mmu_flush_ptes
LBB0_14:
	ldr	x0, [x19, #8]
	bl	_up_read
	ldr	w8, [x19]
	cmn	w8, #1
	b.eq	LBB0_16
; %bb.15:
	ldr	x0, [x19, #8]
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	b	_psb_mmu_flush
LBB0_16:
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.comm	_PAGE_SHIFT,4,2                 ; @PAGE_SHIFT
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
.subsections_via_symbols
