	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function _hl_mmu_unmap
__hl_mmu_unmap:                         ## @_hl_mmu_unmap
	.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, %r15
	movq	%rdi, %rbx
	movq	(%rdi), %r13
	movq	_PAGE_SIZE_2MB@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	24(%r13), %ecx
	movl	28(%r13), %edx
	movq	%r15, %rdi
	callq	_hl_mem_area_inside_range
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	%rbx, %rdi
	callq	_get_hop0_addr
	movq	%rbx, %rdi
	movq	%rax, %rsi
	movq	%r15, %rdx
	callq	_get_hop0_pte_addr
	movq	%rax, -104(%rbp)                ## 8-byte Spill
	movq	(%rax), %rsi
	movq	%rbx, %rdi
	callq	_get_next_hop_addr
	movq	_ULLONG_MAX@GOTPCREL(%rip), %r14
	cmpq	(%r14), %rax
	je	LBB0_3
## %bb.1:
	movq	%rax, %r12
	movq	%rbx, %rdi
	movq	%rax, %rsi
	movq	%r15, %rdx
	callq	_get_hop1_pte_addr
	movq	%rax, -96(%rbp)                 ## 8-byte Spill
	movq	(%rax), %rsi
	movq	%rbx, %rdi
	callq	_get_next_hop_addr
	cmpq	(%r14), %rax
	je	LBB0_3
## %bb.2:
	movq	%rbx, %rdi
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	movq	-80(%rbp), %rsi                 ## 8-byte Reload
	movq	%r15, %rdx
	callq	_get_hop2_pte_addr
	movq	%rax, -88(%rbp)                 ## 8-byte Spill
	movq	(%rax), %rsi
	movq	%rbx, %rdi
	callq	_get_next_hop_addr
	cmpq	(%r14), %rax
	jne	LBB0_6
LBB0_3:
	movl	(%r13), %edi
	leaq	L_.str.3(%rip), %rsi
	xorl	%ebx, %ebx
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_4:
	subl	(%rax), %ebx
LBB0_5:
	movl	%ebx, %eax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movq	%rbx, %rdi
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movq	%rax, %rsi
	movq	%r15, %rdx
	callq	_get_hop3_pte_addr
	movq	(%rax), %rsi
	movq	_LAST_MASK@GOTPCREL(%rip), %rdi
	movl	(%rdi), %edx
	andl	%esi, %edx
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	testl	%ecx, %ecx
	je	LBB0_9
## %bb.7:
	testl	%edx, %edx
	jne	LBB0_9
## %bb.8:
	movl	(%r13), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_dev_err
	movq	_EFAULT@GOTPCREL(%rip), %rax
	jmp	LBB0_4
LBB0_9:
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	testl	%edx, %edx
	je	LBB0_11
## %bb.10:
	xorl	%r8d, %r8d
	xorl	%eax, %eax
	cmpq	$0, 8(%r13)
	jne	LBB0_13
	jmp	LBB0_16
LBB0_11:
	movl	%edx, -60(%rbp)                 ## 4-byte Spill
	movq	%rbx, %rdi
	callq	_get_next_hop_addr
	cmpq	(%r14), %rax
	je	LBB0_3
## %bb.12:
	movq	%rbx, %rdi
	movq	%rax, %rsi
	movq	%r15, %rdx
	movq	%rax, %r14
	callq	_get_hop4_pte_addr
	movq	%r14, %r8
	movq	(%rax), %rsi
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	movl	-60(%rbp), %edx                 ## 4-byte Reload
	movq	_LAST_MASK@GOTPCREL(%rip), %rdi
	cmpq	$0, 8(%r13)
	je	LBB0_16
LBB0_13:
	testl	%ecx, %ecx
	je	LBB0_16
## %bb.14:
	movq	_PTE_PHYS_ADDR_MASK@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	andq	16(%r13), %rdx
	orq	(%rdi), %rdx
	movq	_PAGE_PRESENT_MASK@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	orq	%rax, %rdx
	cmpq	%rdx, %rsi
	jne	LBB0_20
## %bb.15:
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_29
LBB0_16:
	movq	_PAGE_PRESENT_MASK@GOTPCREL(%rip), %rcx
	testq	%rsi, (%rcx)
	je	LBB0_3
## %bb.17:
	movl	%edx, %r14d
	movq	%rbx, %rdi
	testq	%r8, %r8
	je	LBB0_22
## %bb.18:
	movq	%rax, %rsi
	movq	%r8, %r15
	callq	_clear_pte
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	_put_pte
	testl	%r14d, %r14d
	jne	LBB0_23
## %bb.19:
	testq	%rax, %rax
	jne	LBB0_27
	jmp	LBB0_23
LBB0_20:
	testq	%rsi, %rax
	je	LBB0_28
## %bb.21:
	movq	%rbx, %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	callq	_write_final_pte
	movq	%rbx, %rdi
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	callq	_put_pte
	jmp	LBB0_27
LBB0_22:
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	callq	_clear_pte
	testl	%r14d, %r14d
	je	LBB0_27
LBB0_23:
	movq	%rbx, %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	callq	_clear_pte
	movq	%rbx, %rdi
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	callq	_put_pte
	testq	%rax, %rax
	jne	LBB0_27
## %bb.24:
	movq	%rbx, %rdi
	movq	-88(%rbp), %rsi                 ## 8-byte Reload
	callq	_clear_pte
	movq	%rbx, %rdi
	movq	-80(%rbp), %rsi                 ## 8-byte Reload
	callq	_put_pte
	testq	%rax, %rax
	jne	LBB0_27
## %bb.25:
	movq	%rbx, %rdi
	movq	-96(%rbp), %rsi                 ## 8-byte Reload
	callq	_clear_pte
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	_put_pte
	testq	%rax, %rax
	jne	LBB0_27
## %bb.26:
	movq	%rbx, %rdi
	movq	-104(%rbp), %rsi                ## 8-byte Reload
	callq	_clear_pte
LBB0_27:
	movq	%rbx, %rdi
	callq	_flush
	xorl	%ebx, %ebx
	jmp	LBB0_5
LBB0_28:
	leaq	L_.str.2(%rip), %rsi
LBB0_29:
	movl	(%r13), %edi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_3
	.cfi_endproc
                                        ## -- End function
	.comm	_PAGE_SIZE_2MB,4,2              ## @PAGE_SIZE_2MB
	.comm	_ULLONG_MAX,8,3                 ## @ULLONG_MAX
	.comm	_LAST_MASK,8,3                  ## @LAST_MASK
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"DRAM unmapping should use huge pages only\n"

	.comm	_EFAULT,4,2                     ## @EFAULT
	.comm	_PTE_PHYS_ADDR_MASK,8,3         ## @PTE_PHYS_ADDR_MASK
	.comm	_PAGE_PRESENT_MASK,8,3          ## @PAGE_PRESENT_MASK
L_.str.1:                               ## @.str.1
	.asciz	"DRAM: hop3 PTE points to zero page, can't unmap, va: 0x%llx\n"

L_.str.2:                               ## @.str.2
	.asciz	"DRAM: hop3 PTE is cleared! can't unmap, va: 0x%llx\n"

L_.str.3:                               ## @.str.3
	.asciz	"virt addr 0x%llx is not mapped to phys addr\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	__hl_mmu_unmap
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function _hl_mmu_unmap
__hl_mmu_unmap:                         ; @_hl_mmu_unmap
	.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
	mov	x21, x1
	mov	x19, x0
	ldr	x28, [x0]
Lloh0:
	adrp	x8, _PAGE_SIZE_2MB@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PAGE_SIZE_2MB@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	ldp	w3, w2, [x28, #24]
	mov	x0, x21
	bl	_hl_mem_area_inside_range
	mov	x26, x0
	mov	x0, x19
	bl	_get_hop0_addr
	mov	x1, x0
	mov	x0, x19
	mov	x2, x21
	bl	_get_hop0_pte_addr
	mov	x20, x0
	ldr	x1, [x0]
	mov	x0, x19
	bl	_get_next_hop_addr
Lloh3:
	adrp	x27, _ULLONG_MAX@GOTPAGE
Lloh4:
	ldr	x27, [x27, _ULLONG_MAX@GOTPAGEOFF]
	ldr	x8, [x27]
	cmp	x0, x8
	b.eq	LBB0_3
; %bb.1:
	mov	x22, x0
	mov	x0, x19
	mov	x1, x22
	mov	x2, x21
	bl	_get_hop1_pte_addr
	mov	x23, x0
	ldr	x1, [x0]
	mov	x0, x19
	bl	_get_next_hop_addr
	ldr	x8, [x27]
	cmp	x0, x8
	b.eq	LBB0_3
; %bb.2:
	mov	x24, x0
	mov	x0, x19
	mov	x1, x24
	mov	x2, x21
	bl	_get_hop2_pte_addr
	str	x0, [sp, #24]                   ; 8-byte Folded Spill
	ldr	x1, [x0]
	mov	x0, x19
	bl	_get_next_hop_addr
	ldr	x8, [x27]
	cmp	x0, x8
	b.ne	LBB0_6
LBB0_3:
	ldr	w0, [x28]
	str	x21, [sp]
Lloh5:
	adrp	x1, l_.str.3@PAGE
Lloh6:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_dev_err
Lloh7:
	adrp	x8, _EINVAL@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_4:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_5:
	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
LBB0_6:
	mov	x25, x0
	mov	x0, x19
	mov	x1, x25
	mov	x2, x21
	bl	_get_hop3_pte_addr
	ldr	x1, [x0]
Lloh9:
	adrp	x11, _LAST_MASK@GOTPAGE
Lloh10:
	ldr	x11, [x11, _LAST_MASK@GOTPAGEOFF]
	ldr	w8, [x11]
	and	w10, w8, w1
	cbz	w26, LBB0_9
; %bb.7:
	cbnz	w10, LBB0_9
; %bb.8:
	ldr	w0, [x28]
Lloh11:
	adrp	x1, l_.str@PAGE
Lloh12:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
Lloh13:
	adrp	x8, _EFAULT@GOTPAGE
Lloh14:
	ldr	x8, [x8, _EFAULT@GOTPAGEOFF]
	b	LBB0_4
LBB0_9:
	str	x0, [sp, #16]                   ; 8-byte Folded Spill
	cbz	w10, LBB0_11
; %bb.10:
	mov	x27, #0
	mov	x8, #0
	ldr	x9, [x28, #8]
	cbnz	x9, LBB0_13
	b	LBB0_16
LBB0_11:
	str	w10, [sp, #12]                  ; 4-byte Folded Spill
	mov	x0, x19
	bl	_get_next_hop_addr
	ldr	x8, [x27]
	cmp	x0, x8
	b.eq	LBB0_3
; %bb.12:
	mov	x27, x0
	mov	x0, x19
	mov	x1, x27
	mov	x2, x21
	bl	_get_hop4_pte_addr
	mov	x8, x0
	ldr	x1, [x0]
	ldr	w10, [sp, #12]                  ; 4-byte Folded Reload
Lloh15:
	adrp	x11, _LAST_MASK@GOTPAGE
Lloh16:
	ldr	x11, [x11, _LAST_MASK@GOTPAGEOFF]
	ldr	x9, [x28, #8]
	cbz	x9, LBB0_16
LBB0_13:
	cbz	w26, LBB0_16
; %bb.14:
	ldr	x8, [x28, #16]
Lloh17:
	adrp	x9, _PTE_PHYS_ADDR_MASK@GOTPAGE
Lloh18:
	ldr	x9, [x9, _PTE_PHYS_ADDR_MASK@GOTPAGEOFF]
Lloh19:
	ldr	x9, [x9]
	and	x8, x9, x8
	ldr	x9, [x11]
	orr	x9, x8, x9
Lloh20:
	adrp	x8, _PAGE_PRESENT_MASK@GOTPAGE
Lloh21:
	ldr	x8, [x8, _PAGE_PRESENT_MASK@GOTPAGEOFF]
Lloh22:
	ldr	x8, [x8]
	orr	x2, x9, x8
	cmp	x1, x2
	b.ne	LBB0_19
; %bb.15:
Lloh23:
	adrp	x1, l_.str.1@PAGE
Lloh24:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_28
LBB0_16:
Lloh25:
	adrp	x9, _PAGE_PRESENT_MASK@GOTPAGE
Lloh26:
	ldr	x9, [x9, _PAGE_PRESENT_MASK@GOTPAGEOFF]
Lloh27:
	ldr	x9, [x9]
	tst	x9, x1
	b.eq	LBB0_3
; %bb.17:
	mov	x26, x10
	mov	x0, x19
	cbz	x27, LBB0_21
; %bb.18:
	mov	x1, x8
	bl	_clear_pte
	mov	x0, x19
	mov	x1, x27
	bl	_put_pte
	cmp	w26, #0
	ccmp	x0, #0, #4, eq
	b.eq	LBB0_22
	b	LBB0_26
LBB0_19:
	tst	x8, x1
	b.eq	LBB0_27
; %bb.20:
	mov	x0, x19
	ldr	x1, [sp, #16]                   ; 8-byte Folded Reload
	bl	_write_final_pte
	mov	x0, x19
	mov	x1, x25
	bl	_put_pte
	b	LBB0_26
LBB0_21:
	ldr	x1, [sp, #16]                   ; 8-byte Folded Reload
	bl	_clear_pte
	cbz	w26, LBB0_26
LBB0_22:
	mov	x0, x19
	ldr	x1, [sp, #16]                   ; 8-byte Folded Reload
	bl	_clear_pte
	mov	x0, x19
	mov	x1, x25
	bl	_put_pte
	cbnz	x0, LBB0_26
; %bb.23:
	mov	x0, x19
	ldr	x1, [sp, #24]                   ; 8-byte Folded Reload
	bl	_clear_pte
	mov	x0, x19
	mov	x1, x24
	bl	_put_pte
	cbnz	x0, LBB0_26
; %bb.24:
	mov	x0, x19
	mov	x1, x23
	bl	_clear_pte
	mov	x0, x19
	mov	x1, x22
	bl	_put_pte
	cbnz	x0, LBB0_26
; %bb.25:
	mov	x0, x19
	mov	x1, x20
	bl	_clear_pte
LBB0_26:
	mov	x0, x19
	bl	_flush
	mov	w0, #0
	b	LBB0_5
LBB0_27:
Lloh28:
	adrp	x1, l_.str.2@PAGE
Lloh29:
	add	x1, x1, l_.str.2@PAGEOFF
LBB0_28:
	ldr	w0, [x28]
	str	x21, [sp]
	bl	_dev_err
	b	LBB0_3
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpAdd	Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_PAGE_SIZE_2MB,4,2              ; @PAGE_SIZE_2MB
	.comm	_ULLONG_MAX,8,3                 ; @ULLONG_MAX
	.comm	_LAST_MASK,8,3                  ; @LAST_MASK
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"DRAM unmapping should use huge pages only\n"

	.comm	_EFAULT,4,2                     ; @EFAULT
	.comm	_PTE_PHYS_ADDR_MASK,8,3         ; @PTE_PHYS_ADDR_MASK
	.comm	_PAGE_PRESENT_MASK,8,3          ; @PAGE_PRESENT_MASK
l_.str.1:                               ; @.str.1
	.asciz	"DRAM: hop3 PTE points to zero page, can't unmap, va: 0x%llx\n"

l_.str.2:                               ; @.str.2
	.asciz	"DRAM: hop3 PTE is cleared! can't unmap, va: 0x%llx\n"

l_.str.3:                               ; @.str.3
	.asciz	"virt addr 0x%llx is not mapped to phys addr\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	__hl_mmu_unmap
.subsections_via_symbols
