	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_radeon_device_fini             ## -- Begin function radeon_device_fini
	.p2align	4, 0x90
_radeon_device_fini:                    ## @radeon_device_fini
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -24
	movq	%rdi, %rbx
	leaq	L_.str(%rip), %rdi
	callq	_DRM_INFO
	movl	$1, (%rbx)
	movq	%rbx, %rdi
	callq	_radeon_bo_evict_vram
	movq	%rbx, %rdi
	callq	_radeon_fini
	movl	32(%rbx), %edi
	callq	_pci_is_thunderbolt_attached
	testl	%eax, %eax
	jne	LBB0_2
## %bb.1:
	movl	32(%rbx), %edi
	callq	_vga_switcheroo_unregister_client
LBB0_2:
	movq	_RADEON_IS_PX@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 4(%rbx)
	je	LBB0_4
## %bb.3:
	movl	36(%rbx), %edi
	callq	_vga_switcheroo_fini_domain_pm_ops
LBB0_4:
	movl	32(%rbx), %edi
	xorl	%esi, %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	_vga_client_register
	movq	24(%rbx), %rsi
	testq	%rsi, %rsi
	je	LBB0_6
## %bb.5:
	movl	32(%rbx), %edi
	callq	_pci_iounmap
LBB0_6:
	movq	$0, 24(%rbx)
	movq	16(%rbx), %rdi
	callq	_iounmap
	movq	$0, 16(%rbx)
	movq	8(%rbx), %rax
	movq	_CHIP_BONAIRE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jge	LBB0_8
## %bb.7:
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
LBB0_8:
	movq	%rbx, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	jmp	_radeon_doorbell_fini           ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"radeon: finishing device.\n"

	.comm	_RADEON_IS_PX,4,2               ## @RADEON_IS_PX
	.comm	_CHIP_BONAIRE,8,3               ## @CHIP_BONAIRE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_radeon_device_fini             ; -- Begin function radeon_device_fini
	.p2align	2
_radeon_device_fini:                    ; @radeon_device_fini
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_INFO
	mov	w8, #1
	str	w8, [x19]
	mov	x0, x19
	bl	_radeon_bo_evict_vram
	mov	x0, x19
	bl	_radeon_fini
	ldr	w0, [x19, #32]
	bl	_pci_is_thunderbolt_attached
	cbnz	w0, LBB0_2
; %bb.1:
	ldr	w0, [x19, #32]
	bl	_vga_switcheroo_unregister_client
LBB0_2:
	ldr	w8, [x19, #4]
Lloh2:
	adrp	x9, _RADEON_IS_PX@GOTPAGE
Lloh3:
	ldr	x9, [x9, _RADEON_IS_PX@GOTPAGEOFF]
Lloh4:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_4
; %bb.3:
	ldr	w0, [x19, #36]
	bl	_vga_switcheroo_fini_domain_pm_ops
LBB0_4:
	ldr	w0, [x19, #32]
	mov	x1, #0
	mov	x2, #0
	mov	x3, #0
	bl	_vga_client_register
	ldr	x1, [x19, #24]
	cbz	x1, LBB0_6
; %bb.5:
	ldr	w0, [x19, #32]
	bl	_pci_iounmap
LBB0_6:
	str	xzr, [x19, #24]
	ldr	x0, [x19, #16]
	bl	_iounmap
	str	xzr, [x19, #16]
	ldr	x8, [x19, #8]
Lloh5:
	adrp	x9, _CHIP_BONAIRE@GOTPAGE
Lloh6:
	ldr	x9, [x9, _CHIP_BONAIRE@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ge	LBB0_8
; %bb.7:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_8:
	mov	x0, x19
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_radeon_doorbell_fini
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"radeon: finishing device.\n"

	.comm	_RADEON_IS_PX,4,2               ; @RADEON_IS_PX
	.comm	_CHIP_BONAIRE,8,3               ; @CHIP_BONAIRE
.subsections_via_symbols
