	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_goya_mmu_remove_device_cpu_mappings ## -- Begin function goya_mmu_remove_device_cpu_mappings
	.p2align	4, 0x90
_goya_mmu_remove_device_cpu_mappings:   ## @goya_mmu_remove_device_cpu_mappings
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	16(%rdi), %rbx
	movq	_HW_CAP_MMU@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rbx)
	je	LBB0_16
## %bb.1:
	cmpl	$0, 4(%rbx)
	je	LBB0_16
## %bb.2:
	movq	%rdi, %r15
	movq	_mmCPU_IF_ARUSER_OVR_EN@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	xorl	%esi, %esi
	callq	_WREG32
	movq	_mmCPU_IF_AWUSER_OVR_EN@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	xorl	%esi, %esi
	callq	_WREG32
	movq	_PAGE_SIZE_2MB@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leal	-1(%rdx), %eax
	testl	%eax, (%r15)
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	je	LBB0_8
## %bb.3:
	movq	_SZ_2M@GOTPCREL(%rip), %r13
	cmpq	$0, (%r13)
	jle	LBB0_10
## %bb.4:
	movq	_PAGE_SIZE_4KB@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edx
	xorl	%r14d, %r14d
	movq	_VA_CPU_ACCESSIBLE_MEM_ADDR@GOTPCREL(%rip), %r12
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_5 Depth=1
	movslq	(%rbx), %rdx
	addq	%rdx, %r14
	cmpq	(%r13), %r14
	jge	LBB0_10
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movl	8(%r15), %edi
	movq	(%r12), %rsi
	addq	%r14, %rsi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_hl_mmu_unmap
	testq	%rax, %rax
	je	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	4(%r15), %edi
	movq	(%r12), %rdx
	addq	%r14, %rdx
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_warn_ratelimited
	jmp	LBB0_7
LBB0_8:
	movl	8(%r15), %edi
	movq	_VA_CPU_ACCESSIBLE_MEM_ADDR@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_hl_mmu_unmap
	testq	%rax, %rax
	je	LBB0_10
## %bb.9:
	movl	4(%r15), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_warn
LBB0_10:
	movq	_CPU_FW_IMAGE_SIZE@GOTPCREL(%rip), %r13
	cmpq	$0, (%r13)
	movq	_PAGE_SIZE_2MB@GOTPCREL(%rip), %r12
	jle	LBB0_15
## %bb.11:
	movl	(%r12), %edx
	xorl	%ebx, %ebx
	leaq	L_.str.2(%rip), %r14
	jmp	LBB0_12
	.p2align	4, 0x90
LBB0_14:                                ##   in Loop: Header=BB0_12 Depth=1
	movslq	(%r12), %rdx
	addq	%rdx, %rbx
	cmpq	(%r13), %rbx
	jge	LBB0_15
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movl	8(%r15), %edi
	movq	24(%r15), %rsi
	addq	%rbx, %rsi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_hl_mmu_unmap
	testq	%rax, %rax
	je	LBB0_14
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=1
	movl	4(%r15), %edi
	movq	24(%r15), %rdx
	addq	%rbx, %rdx
	movq	%r14, %rsi
	callq	_dev_warn_ratelimited
	jmp	LBB0_14
LBB0_15:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	$0, 4(%rax)
LBB0_16:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_HW_CAP_MMU,4,2                 ## @HW_CAP_MMU
	.comm	_mmCPU_IF_ARUSER_OVR_EN,4,2     ## @mmCPU_IF_ARUSER_OVR_EN
	.comm	_mmCPU_IF_AWUSER_OVR_EN,4,2     ## @mmCPU_IF_AWUSER_OVR_EN
	.comm	_PAGE_SIZE_2MB,4,2              ## @PAGE_SIZE_2MB
	.comm	_VA_CPU_ACCESSIBLE_MEM_ADDR,8,3 ## @VA_CPU_ACCESSIBLE_MEM_ADDR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to unmap CPU accessible memory\n"

	.comm	_SZ_2M,8,3                      ## @SZ_2M
	.comm	_PAGE_SIZE_4KB,4,2              ## @PAGE_SIZE_4KB
L_.str.1:                               ## @.str.1
	.asciz	"failed to unmap address 0x%llx\n"

	.comm	_CPU_FW_IMAGE_SIZE,8,3          ## @CPU_FW_IMAGE_SIZE
L_.str.2:                               ## @.str.2
	.asciz	"Failed to unmap address 0x%llx\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_goya_mmu_remove_device_cpu_mappings ; -- Begin function goya_mmu_remove_device_cpu_mappings
	.p2align	2
_goya_mmu_remove_device_cpu_mappings:   ; @goya_mmu_remove_device_cpu_mappings
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	ldr	x21, [x0, #16]
	ldr	w8, [x21]
Lloh0:
	adrp	x9, _HW_CAP_MMU@GOTPAGE
Lloh1:
	ldr	x9, [x9, _HW_CAP_MMU@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_16
; %bb.1:
	ldr	w8, [x21, #4]
	cbz	w8, LBB0_16
; %bb.2:
	mov	x19, x0
Lloh3:
	adrp	x8, _mmCPU_IF_ARUSER_OVR_EN@GOTPAGE
Lloh4:
	ldr	x8, [x8, _mmCPU_IF_ARUSER_OVR_EN@GOTPAGEOFF]
Lloh5:
	ldr	w0, [x8]
	mov	w1, #0
	bl	_WREG32
Lloh6:
	adrp	x8, _mmCPU_IF_AWUSER_OVR_EN@GOTPAGE
Lloh7:
	ldr	x8, [x8, _mmCPU_IF_AWUSER_OVR_EN@GOTPAGEOFF]
Lloh8:
	ldr	w0, [x8]
	mov	w1, #0
	bl	_WREG32
	ldr	w8, [x19]
Lloh9:
	adrp	x22, _PAGE_SIZE_2MB@GOTPAGE
Lloh10:
	ldr	x22, [x22, _PAGE_SIZE_2MB@GOTPAGEOFF]
	ldr	w2, [x22]
	sub	w9, w2, #1
	tst	w9, w8
	b.eq	LBB0_8
; %bb.3:
Lloh11:
	adrp	x23, _SZ_2M@GOTPAGE
Lloh12:
	ldr	x23, [x23, _SZ_2M@GOTPAGEOFF]
	ldr	x8, [x23]
	cmp	x8, #1
	b.lt	LBB0_10
; %bb.4:
	mov	x24, #0
Lloh13:
	adrp	x25, _PAGE_SIZE_4KB@GOTPAGE
Lloh14:
	ldr	x25, [x25, _PAGE_SIZE_4KB@GOTPAGEOFF]
	ldr	w2, [x25]
Lloh15:
	adrp	x26, _VA_CPU_ACCESSIBLE_MEM_ADDR@GOTPAGE
Lloh16:
	ldr	x26, [x26, _VA_CPU_ACCESSIBLE_MEM_ADDR@GOTPAGEOFF]
Lloh17:
	adrp	x20, l_.str.1@PAGE
Lloh18:
	add	x20, x20, l_.str.1@PAGEOFF
	b	LBB0_6
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=1
	ldrsw	x2, [x25]
	ldr	x8, [x23]
	add	x24, x24, x2
	cmp	x24, x8
	b.ge	LBB0_10
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x19, #8]
	ldr	x8, [x26]
	add	x1, x8, x24
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_hl_mmu_unmap
	cbz	x0, LBB0_5
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	w0, [x19, #4]
	ldr	x8, [x26]
	add	x2, x8, x24
	mov	x1, x20
	bl	_dev_warn_ratelimited
	b	LBB0_5
LBB0_8:
	ldr	w0, [x19, #8]
Lloh19:
	adrp	x8, _VA_CPU_ACCESSIBLE_MEM_ADDR@GOTPAGE
Lloh20:
	ldr	x8, [x8, _VA_CPU_ACCESSIBLE_MEM_ADDR@GOTPAGEOFF]
Lloh21:
	ldr	x1, [x8]
	bl	_hl_mmu_unmap
	cbz	x0, LBB0_10
; %bb.9:
	ldr	w0, [x19, #4]
Lloh22:
	adrp	x1, l_.str@PAGE
Lloh23:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_warn
LBB0_10:
Lloh24:
	adrp	x23, _CPU_FW_IMAGE_SIZE@GOTPAGE
Lloh25:
	ldr	x23, [x23, _CPU_FW_IMAGE_SIZE@GOTPAGEOFF]
	ldr	x8, [x23]
	cmp	x8, #1
	b.lt	LBB0_15
; %bb.11:
	mov	x24, #0
	ldr	w2, [x22]
Lloh26:
	adrp	x20, l_.str.2@PAGE
Lloh27:
	add	x20, x20, l_.str.2@PAGEOFF
	b	LBB0_13
LBB0_12:                                ;   in Loop: Header=BB0_13 Depth=1
	ldrsw	x2, [x22]
	ldr	x8, [x23]
	add	x24, x24, x2
	cmp	x24, x8
	b.ge	LBB0_15
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x19, #8]
	ldr	x8, [x19, #24]
	add	x1, x8, x24
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_hl_mmu_unmap
	cbz	x0, LBB0_12
; %bb.14:                               ;   in Loop: Header=BB0_13 Depth=1
	ldr	w0, [x19, #4]
	ldr	x8, [x19, #24]
	add	x2, x8, x24
	mov	x1, x20
	bl	_dev_warn_ratelimited
	b	LBB0_12
LBB0_15:
	str	wzr, [x21, #4]
LBB0_16:
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpAdd	Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_HW_CAP_MMU,4,2                 ; @HW_CAP_MMU
	.comm	_mmCPU_IF_ARUSER_OVR_EN,4,2     ; @mmCPU_IF_ARUSER_OVR_EN
	.comm	_mmCPU_IF_AWUSER_OVR_EN,4,2     ; @mmCPU_IF_AWUSER_OVR_EN
	.comm	_PAGE_SIZE_2MB,4,2              ; @PAGE_SIZE_2MB
	.comm	_VA_CPU_ACCESSIBLE_MEM_ADDR,8,3 ; @VA_CPU_ACCESSIBLE_MEM_ADDR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to unmap CPU accessible memory\n"

	.comm	_SZ_2M,8,3                      ; @SZ_2M
	.comm	_PAGE_SIZE_4KB,4,2              ; @PAGE_SIZE_4KB
l_.str.1:                               ; @.str.1
	.asciz	"failed to unmap address 0x%llx\n"

	.comm	_CPU_FW_IMAGE_SIZE,8,3          ; @CPU_FW_IMAGE_SIZE
l_.str.2:                               ; @.str.2
	.asciz	"Failed to unmap address 0x%llx\n"

.subsections_via_symbols
