	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amdgpu_gem_object_close        ## -- Begin function amdgpu_gem_object_close
	.p2align	4, 0x90
_amdgpu_gem_object_close:               ## @amdgpu_gem_object_close
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	callq	_gem_to_amdgpu_bo
	movq	%rax, %r15
	movl	(%rax), %edi
	callq	_amdgpu_ttm_adev
	movq	%rax, %r14
	movq	(%rbx), %r12
	leaq	-64(%rbp), %rbx
	movq	%rbx, %rdi
	callq	_INIT_LIST_HEAD
	leaq	-72(%rbp), %r13
	movq	%r13, %rdi
	callq	_INIT_LIST_HEAD
	movq	%r15, -88(%rbp)
	movl	$1, -96(%rbp)
	leaq	-92(%rbp), %rdi
	movq	%rbx, %rsi
	callq	_list_add
	leaq	-80(%rbp), %rdx
	movq	%r12, %rdi
	movq	%rbx, %rsi
	callq	_amdgpu_vm_get_pd_bo
	leaq	-56(%rbp), %rdi
	movq	%rbx, %rsi
	xorl	%edx, %edx
	movq	%r13, %rcx
	xorl	%r8d, %r8d
	callq	_ttm_eu_reserve_buffers
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	movl	(%r14), %edi
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edx
	callq	_dev_err
	jmp	LBB0_10
LBB0_2:
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	_amdgpu_vm_bo_find
	testq	%rax, %rax
	je	LBB0_9
## %bb.3:
	decq	(%rax)
	jne	LBB0_9
## %bb.4:
	movq	%r14, %rdi
	movq	%rax, %rsi
	callq	_amdgpu_vm_bo_rmv
	movq	%r12, %rdi
	callq	_amdgpu_vm_ready
	testq	%rax, %rax
	je	LBB0_9
## %bb.5:
	movq	$0, -48(%rbp)
	leaq	-48(%rbp), %rdx
	movq	%r14, %rdi
	movq	%r12, %rsi
	callq	_amdgpu_vm_clear_freed
	movl	%eax, %ebx
	movl	%eax, %edi
	callq	_unlikely
	testq	%rax, %rax
	je	LBB0_7
## %bb.6:
	movl	(%r14), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%ebx, %edx
	callq	_dev_err
LBB0_7:
	movq	-48(%rbp), %rsi
	testq	%rsi, %rsi
	je	LBB0_9
## %bb.8:
	movq	%r15, %rdi
	movl	$1, %edx
	callq	_amdgpu_bo_fence
	movq	-48(%rbp), %rdi
	callq	_dma_fence_put
LBB0_9:
	leaq	-56(%rbp), %rdi
	leaq	-64(%rbp), %rsi
	callq	_ttm_eu_backoff_reservation
LBB0_10:
	addq	$56, %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	"leaking bo va because we fail to reserve bo (%d)\n"

L_.str.1:                               ## @.str.1
	.asciz	"failed to clear page tables on GEM object close (%d)\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amdgpu_gem_object_close        ; -- Begin function amdgpu_gem_object_close
	.p2align	2
_amdgpu_gem_object_close:               ; @amdgpu_gem_object_close
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	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
	mov	x21, x1
	bl	_gem_to_amdgpu_bo
	mov	x19, x0
	ldr	w0, [x0]
	bl	_amdgpu_ttm_adev
	mov	x20, x0
	ldr	x21, [x21]
	add	x0, sp, #48
	bl	_INIT_LIST_HEAD
	add	x0, sp, #40
	bl	_INIT_LIST_HEAD
	str	x19, [sp, #32]
	mov	w8, #1
	str	w8, [sp, #24]
	add	x8, sp, #24
	orr	x0, x8, #0x4
	add	x1, sp, #48
	bl	_list_add
	add	x1, sp, #48
	sub	x2, x29, #40
	mov	x0, x21
	bl	_amdgpu_vm_get_pd_bo
	add	x0, sp, #16
	add	x1, sp, #48
	add	x3, sp, #40
	mov	w2, #0
	mov	w4, #0
	bl	_ttm_eu_reserve_buffers
	cbz	w0, LBB0_2
; %bb.1:
	mov	x2, x0
	ldr	w0, [x20]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	b	LBB0_10
LBB0_2:
	mov	x0, x21
	mov	x1, x19
	bl	_amdgpu_vm_bo_find
	cbz	x0, LBB0_9
; %bb.3:
	mov	x1, x0
	ldr	x8, [x0]
	subs	x8, x8, #1
	str	x8, [x0]
	b.ne	LBB0_9
; %bb.4:
	mov	x0, x20
	bl	_amdgpu_vm_bo_rmv
	mov	x0, x21
	bl	_amdgpu_vm_ready
	cbz	x0, LBB0_9
; %bb.5:
	str	xzr, [sp, #8]
	add	x2, sp, #8
	mov	x0, x20
	mov	x1, x21
	bl	_amdgpu_vm_clear_freed
	mov	x21, x0
	bl	_unlikely
	cbz	x0, LBB0_7
; %bb.6:
	ldr	w0, [x20]
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x21
	bl	_dev_err
LBB0_7:
	ldr	x1, [sp, #8]
	cbz	x1, LBB0_9
; %bb.8:
	mov	x0, x19
	mov	w2, #1
	bl	_amdgpu_bo_fence
	ldr	x0, [sp, #8]
	bl	_dma_fence_put
LBB0_9:
	add	x0, sp, #16
	add	x1, sp, #48
	bl	_ttm_eu_backoff_reservation
LBB0_10:
	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
	add	sp, sp, #112
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"leaking bo va because we fail to reserve bo (%d)\n"

l_.str.1:                               ; @.str.1
	.asciz	"failed to clear page tables on GEM object close (%d)\n"

.subsections_via_symbols
