	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_radeon_gem_object_close        ## -- Begin function radeon_gem_object_close
	.p2align	4, 0x90
_radeon_gem_object_close:               ## @radeon_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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	callq	_gem_to_radeon_bo
	movq	%rax, %rbx
	movq	(%rax), %r14
	movq	(%r14), %rax
	movq	_CHIP_CAYMAN@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jge	LBB0_1
## %bb.6:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	movq	(%r15), %r15
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_radeon_bo_reserve
	testl	%eax, %eax
	je	LBB0_2
## %bb.7:
	movl	8(%r14), %edi
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edx
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_dev_err                        ## TAILCALL
LBB0_2:
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_radeon_vm_bo_find
	testq	%rax, %rax
	je	LBB0_5
## %bb.3:
	decq	(%rax)
	jne	LBB0_5
## %bb.4:
	movq	%r14, %rdi
	movq	%rax, %rsi
	callq	_radeon_vm_bo_rmv
LBB0_5:
	movq	%rbx, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_radeon_bo_unreserve            ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_CHIP_CAYMAN,8,3                ## @CHIP_CAYMAN
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"leaking bo va because we fail to reserve bo (%d)\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_radeon_gem_object_close        ; -- Begin function radeon_gem_object_close
	.p2align	2
_radeon_gem_object_close:               ; @radeon_gem_object_close
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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_radeon_bo
	ldr	x20, [x0]
	ldr	x8, [x20]
Lloh0:
	adrp	x9, _CHIP_CAYMAN@GOTPAGE
Lloh1:
	ldr	x9, [x9, _CHIP_CAYMAN@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ge	LBB0_2
; %bb.1:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_2:
	mov	x19, x0
	ldr	x21, [x21]
	mov	w1, #1
	bl	_radeon_bo_reserve
	cbz	w0, LBB0_4
; %bb.3:
	mov	x2, x0
	ldr	w0, [x20, #8]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_dev_err
LBB0_4:
	mov	x0, x21
	mov	x1, x19
	bl	_radeon_vm_bo_find
	cbz	x0, LBB0_7
; %bb.5:
	mov	x1, x0
	ldr	x8, [x0]
	subs	x8, x8, #1
	str	x8, [x0]
	b.ne	LBB0_7
; %bb.6:
	mov	x0, x20
	bl	_radeon_vm_bo_rmv
LBB0_7:
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_radeon_bo_unreserve
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.comm	_CHIP_CAYMAN,8,3                ; @CHIP_CAYMAN
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"leaking bo va because we fail to reserve bo (%d)\n"

.subsections_via_symbols
