	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_moea64_unwire                  ## -- Begin function moea64_unwire
	.p2align	4, 0x90
_moea64_unwire:                         ## @moea64_unwire
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %r12
	movq	%rsi, %r13
	movl	%edi, -44(%rbp)                 ## 4-byte Spill
	movl	%edx, -80(%rbp)
	movq	%rsi, %rdi
	callq	_PMAP_LOCK
	movq	_pvo_tree@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	4(%r13), %rsi
	leaq	-80(%rbp), %rdx
	movq	%rsi, -64(%rbp)                 ## 8-byte Spill
	callq	_RB_NFIND
	testq	%rax, %rax
	je	LBB0_14
## %bb.1:
	movq	%rax, %rbx
	movq	%r13, -56(%rbp)                 ## 8-byte Spill
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_13:                                ##   in Loop: Header=BB0_2 Depth=1
	decl	(%r13)
	movq	_pvo_tree@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	movq	%rbx, %rdx
	callq	_RB_NEXT
	movq	%rax, %rbx
	testq	%rax, %rax
	je	LBB0_14
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	callq	_PVO_VADDR
	cmpq	%r12, %rax
	jge	LBB0_14
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	(%rbx), %ecx
	movq	_PVO_WIRED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%ecx, %eax
	jne	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	leaq	L_.str(%rip), %rdi
	movq	%rbx, %rsi
	callq	_panic
	movq	_PVO_WIRED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	(%rbx), %ecx
LBB0_5:                                 ##   in Loop: Header=BB0_2 Depth=1
	notl	%eax
	andl	%ecx, %eax
	movl	%eax, (%rbx)
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movq	%rbx, %rsi
	xorl	%edx, %edx
	callq	_MOEA64_PTE_REPLACE
	movl	%eax, %r15d
	movq	_PVO_MANAGED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rbx)
	je	LBB0_13
## %bb.6:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	_VM_PROT_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 4(%rbx)
	je	LBB0_13
## %bb.7:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%r12, %r13
	testl	%r15d, %r15d
	jns	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	_LPTE_CHG@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
LBB0_9:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	_LPTE_RPGN@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	andl	8(%rbx), %edi
	callq	_PHYS_TO_VM_PAGE
	movq	%rax, %r14
	movq	%rax, %rdi
	callq	_atomic_readandclear_32
	movl	%eax, %r12d
	orl	%r15d, %r12d
	movq	_LPTE_CHG@GOTPCREL(%rip), %rax
	testl	%r12d, (%rax)
	je	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	%r14, %rdi
	callq	_vm_page_dirty
LBB0_11:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	_LPTE_REF@GOTPCREL(%rip), %rax
	testl	%r12d, (%rax)
	movq	%r13, %r12
	movq	-56(%rbp), %r13                 ## 8-byte Reload
	je	LBB0_13
## %bb.12:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	_PGA_REFERENCED@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_vm_page_aflag_set
	jmp	LBB0_13
LBB0_14:
	movq	%r13, %rdi
	callq	_PMAP_UNLOCK
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_pvo_tree,4,2                   ## @pvo_tree
	.comm	_PVO_WIRED,4,2                  ## @PVO_WIRED
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"moea64_unwire: pvo %p is missing PVO_WIRED"

	.comm	_PVO_MANAGED,4,2                ## @PVO_MANAGED
	.comm	_VM_PROT_WRITE,4,2              ## @VM_PROT_WRITE
	.comm	_LPTE_CHG,4,2                   ## @LPTE_CHG
	.comm	_LPTE_RPGN,4,2                  ## @LPTE_RPGN
	.comm	_LPTE_REF,4,2                   ## @LPTE_REF
	.comm	_PGA_REFERENCED,4,2             ## @PGA_REFERENCED
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_moea64_unwire                  ; -- Begin function moea64_unwire
	.p2align	2
_moea64_unwire:                         ; @moea64_unwire
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	mov	x20, x3
	mov	x19, x1
	mov	x21, x0
	str	w2, [sp]
	mov	x0, x1
	bl	_PMAP_LOCK
Lloh0:
	adrp	x28, _pvo_tree@GOTPAGE
Lloh1:
	ldr	x28, [x28, _pvo_tree@GOTPAGEOFF]
	ldr	w0, [x28]
	add	x22, x19, #4
	mov	x2, sp
	mov	x1, x22
	bl	_RB_NFIND
	cbz	x0, LBB0_12
; %bb.1:
	mov	x23, x0
Lloh2:
	adrp	x27, _PVO_WIRED@GOTPAGE
Lloh3:
	ldr	x27, [x27, _PVO_WIRED@GOTPAGEOFF]
Lloh4:
	adrp	x26, _PVO_MANAGED@GOTPAGE
Lloh5:
	ldr	x26, [x26, _PVO_MANAGED@GOTPAGEOFF]
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	w8, [x19]
	sub	w8, w8, #1
	str	w8, [x19]
	ldr	w0, [x28]
	mov	x1, x22
	mov	x2, x23
	bl	_RB_NEXT
	mov	x23, x0
	cbz	x0, LBB0_12
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x23
	bl	_PVO_VADDR
	cmp	x0, x20
	b.ge	LBB0_12
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w9, [x23]
	ldr	w8, [x27]
	tst	w8, w9
	b.ne	LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
Lloh6:
	adrp	x0, l_.str@PAGE
Lloh7:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x23
	bl	_panic
	ldr	w8, [x27]
	ldr	w9, [x23]
LBB0_6:                                 ;   in Loop: Header=BB0_3 Depth=1
	bic	w8, w9, w8
	str	w8, [x23]
	mov	x0, x21
	mov	x1, x23
	mov	w2, #0
	bl	_MOEA64_PTE_REPLACE
	ldr	w8, [x23]
	ldr	w9, [x26]
	tst	w9, w8
	b.eq	LBB0_2
; %bb.7:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w8, [x23, #4]
Lloh8:
	adrp	x9, _VM_PROT_WRITE@GOTPAGE
Lloh9:
	ldr	x9, [x9, _VM_PROT_WRITE@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_2
; %bb.8:                                ;   in Loop: Header=BB0_3 Depth=1
Lloh11:
	adrp	x8, _LPTE_CHG@GOTPAGE
Lloh12:
	ldr	x8, [x8, _LPTE_CHG@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	cmp	w0, #0
	csel	w24, w8, w0, lt
	ldr	w8, [x23, #8]
Lloh14:
	adrp	x9, _LPTE_RPGN@GOTPAGE
Lloh15:
	ldr	x9, [x9, _LPTE_RPGN@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	and	w0, w9, w8
	bl	_PHYS_TO_VM_PAGE
	mov	x25, x0
	bl	_atomic_readandclear_32
	orr	w24, w0, w24
Lloh17:
	adrp	x8, _LPTE_CHG@GOTPAGE
Lloh18:
	ldr	x8, [x8, _LPTE_CHG@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	tst	w24, w8
	b.eq	LBB0_10
; %bb.9:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, x25
	bl	_vm_page_dirty
LBB0_10:                                ;   in Loop: Header=BB0_3 Depth=1
Lloh20:
	adrp	x8, _LPTE_REF@GOTPAGE
Lloh21:
	ldr	x8, [x8, _LPTE_REF@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	tst	w8, w24
	b.eq	LBB0_2
; %bb.11:                               ;   in Loop: Header=BB0_3 Depth=1
Lloh23:
	adrp	x8, _PGA_REFERENCED@GOTPAGE
Lloh24:
	ldr	x8, [x8, _PGA_REFERENCED@GOTPAGEOFF]
Lloh25:
	ldr	w1, [x8]
	mov	x0, x25
	bl	_vm_page_aflag_set
	b	LBB0_2
LBB0_12:
	mov	x0, x19
	bl	_PMAP_UNLOCK
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_pvo_tree,4,2                   ; @pvo_tree
	.comm	_PVO_WIRED,4,2                  ; @PVO_WIRED
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"moea64_unwire: pvo %p is missing PVO_WIRED"

	.comm	_PVO_MANAGED,4,2                ; @PVO_MANAGED
	.comm	_VM_PROT_WRITE,4,2              ; @VM_PROT_WRITE
	.comm	_LPTE_CHG,4,2                   ; @LPTE_CHG
	.comm	_LPTE_RPGN,4,2                  ; @LPTE_RPGN
	.comm	_LPTE_REF,4,2                   ; @LPTE_REF
	.comm	_PGA_REFERENCED,4,2             ; @PGA_REFERENCED
.subsections_via_symbols
