	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function free_device_memory
_free_device_memory:                    ## @free_device_memory
	.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
	movl	%esi, %r14d
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	movq	8(%rdi), %rbx
	leaq	8(%rbx), %r15
	movq	%r15, %rdi
	callq	_spin_lock
	leaq	12(%rbx), %r12
	movq	%r12, %rdi
	movl	%r14d, %esi
	callq	_idr_find
	testq	%rax, %rax
	je	LBB0_4
## %bb.1:
	movq	%rax, %r13
	leaq	4(%rax), %rdi
	callq	_atomic_read
	testq	%rax, %rax
	jle	LBB0_3
## %bb.2:
	movl	(%rbx), %edi
	leaq	L_.str(%rip), %rsi
	movl	%r14d, %edx
	callq	_dev_err
	movq	%r15, %rdi
	callq	_spin_unlock
	jmp	LBB0_5
LBB0_4:
	movq	%r15, %rdi
	callq	_spin_unlock
	movl	(%rbx), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%r14d, %edx
	callq	_dev_err
LBB0_5:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_6
LBB0_3:
	movq	%r12, %rdi
	movl	%r14d, %esi
	callq	_idr_remove
	movq	%r15, %rdi
	callq	_spin_unlock
	movl	(%r13), %edi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	callq	_atomic64_sub
	movl	(%r13), %edi
	leaq	4(%rbx), %rsi
	callq	_atomic64_sub
	movq	%rbx, %rdi
	movq	%r13, %rsi
	callq	_free_phys_pg_pack
	xorl	%eax, %eax
LBB0_6:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"handle %u is mapped, cannot free\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"free device memory failed, no match for handle %u\n"

	.no_dead_strip	_free_device_memory
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function free_device_memory
_free_device_memory:                    ; @free_device_memory
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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	x20, x1
	mov	x22, x0
	ldr	x19, [x0, #8]
	add	x21, x19, #8
	mov	x0, x21
	bl	_spin_lock
	add	x24, x19, #12
	mov	x0, x24
	mov	x1, x20
	bl	_idr_find
	cbz	x0, LBB0_3
; %bb.1:
	mov	x23, x0
	add	x0, x0, #4
	bl	_atomic_read
	cmp	x0, #1
	b.lt	LBB0_5
; %bb.2:
	ldr	w0, [x19]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x20
	bl	_dev_err
	mov	x0, x21
	bl	_spin_unlock
	b	LBB0_4
LBB0_3:
	mov	x0, x21
	bl	_spin_unlock
	ldr	w0, [x19]
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x20
	bl	_dev_err
LBB0_4:
Lloh4:
	adrp	x8, _EINVAL@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_6
LBB0_5:
	mov	x0, x24
	mov	x1, x20
	bl	_idr_remove
	mov	x0, x21
	bl	_spin_unlock
	ldr	w0, [x23]
	mov	x1, x22
	bl	_atomic64_sub
	ldr	w0, [x23]
	add	x1, x19, #4
	bl	_atomic64_sub
	mov	x0, x19
	mov	x1, x23
	bl	_free_phys_pg_pack
	mov	w0, #0
LBB0_6:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"handle %u is mapped, cannot free\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"free device memory failed, no match for handle %u\n"

	.no_dead_strip	_free_device_memory
.subsections_via_symbols
