	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amdgpu_device_fini             ## -- Begin function amdgpu_device_fini
	.p2align	4, 0x90
_amdgpu_device_fini:                    ## @amdgpu_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	_amdgpu_irq_disable_all
	cmpq	$0, 88(%rbx)
	je	LBB0_4
## %bb.1:
	movq	%rbx, %rdi
	callq	_amdgpu_device_has_dc_support
	movl	80(%rbx), %edi
	testl	%eax, %eax
	je	LBB0_2
## %bb.3:
	callq	_drm_atomic_helper_shutdown
	jmp	LBB0_4
LBB0_2:
	callq	_drm_helper_force_disable_all
LBB0_4:
	movq	%rbx, %rdi
	callq	_amdgpu_fence_driver_fini
	movq	%rbx, %rdi
	callq	_amdgpu_pm_sysfs_fini
	movq	%rbx, %rdi
	callq	_amdgpu_fbdev_fini
	movq	%rbx, %rdi
	callq	_amdgpu_device_ip_fini
	movq	72(%rbx), %rdi
	testq	%rdi, %rdi
	je	LBB0_6
## %bb.5:
	callq	_release_firmware
	movq	$0, 72(%rbx)
LBB0_6:
	movl	$0, 4(%rbx)
	leaq	64(%rbx), %rdi
	callq	_cancel_delayed_work_sync
	movq	%rbx, %rdi
	callq	_amdgpu_device_has_dc_support
	testl	%eax, %eax
	jne	LBB0_8
## %bb.7:
	movq	%rbx, %rdi
	callq	_amdgpu_i2c_fini
LBB0_8:
	movq	_amdgpu_emu_mode@GOTPCREL(%rip), %rax
	cmpl	$1, (%rax)
	je	LBB0_10
## %bb.9:
	movq	%rbx, %rdi
	callq	_amdgpu_atombios_fini
LBB0_10:
	movq	56(%rbx), %rdi
	callq	_kfree
	movq	$0, 56(%rbx)
	movl	48(%rbx), %edi
	callq	_pci_is_thunderbolt_attached
	testl	%eax, %eax
	jne	LBB0_12
## %bb.11:
	movl	48(%rbx), %edi
	callq	_vga_switcheroo_unregister_client
LBB0_12:
	movq	_AMD_IS_PX@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 8(%rbx)
	je	LBB0_14
## %bb.13:
	movl	24(%rbx), %edi
	callq	_vga_switcheroo_fini_domain_pm_ops
LBB0_14:
	movl	48(%rbx), %edi
	xorl	%esi, %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	_vga_client_register
	movq	40(%rbx), %rsi
	testq	%rsi, %rsi
	je	LBB0_16
## %bb.15:
	movl	48(%rbx), %edi
	callq	_pci_iounmap
LBB0_16:
	movq	$0, 40(%rbx)
	movq	32(%rbx), %rdi
	callq	_iounmap
	movq	$0, 32(%rbx)
	movq	%rbx, %rdi
	callq	_amdgpu_device_doorbell_fini
	movq	%rbx, %rdi
	callq	_amdgpu_sriov_vf
	testq	%rax, %rax
	je	LBB0_19
## %bb.17:
	movq	%rbx, %rdi
	callq	_amdgim_is_hwperf
	testq	%rax, %rax
	je	LBB0_19
## %bb.18:
	movq	%rbx, %rdi
	callq	_amdgpu_pm_virt_sysfs_fini
LBB0_19:
	movq	%rbx, %rdi
	callq	_amdgpu_debugfs_regs_cleanup
	movl	24(%rbx), %edi
	movq	_dev_attr_pcie_replay_count@GOTPCREL(%rip), %rsi
	callq	_device_remove_file
	movq	%rbx, %rdi
	callq	_amdgpu_ucode_sysfs_fini
	movq	_CONFIG_PERF_EVENTS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_IS_ENABLED
	testq	%rax, %rax
	je	LBB0_21
## %bb.20:
	movq	%rbx, %rdi
	callq	_amdgpu_pmu_fini
LBB0_21:
	movq	%rbx, %rdi
	callq	_amdgpu_debugfs_preempt_cleanup
	movq	_amdgpu_discovery@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_23
## %bb.22:
	movq	16(%rbx), %rax
	movq	_CHIP_NAVI10@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jge	LBB0_24
LBB0_23:
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
LBB0_24:
	movq	%rbx, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	jmp	_amdgpu_discovery_fini          ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"amdgpu: finishing device.\n"

	.comm	_amdgpu_emu_mode,4,2            ## @amdgpu_emu_mode
	.comm	_AMD_IS_PX,4,2                  ## @AMD_IS_PX
	.comm	_dev_attr_pcie_replay_count,4,2 ## @dev_attr_pcie_replay_count
	.comm	_CONFIG_PERF_EVENTS,4,2         ## @CONFIG_PERF_EVENTS
	.comm	_amdgpu_discovery,8,3           ## @amdgpu_discovery
	.comm	_CHIP_NAVI10,8,3                ## @CHIP_NAVI10
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amdgpu_device_fini             ; -- Begin function amdgpu_device_fini
	.p2align	2
_amdgpu_device_fini:                    ; @amdgpu_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	_amdgpu_irq_disable_all
	ldr	x8, [x19, #88]
	cbz	x8, LBB0_4
; %bb.1:
	mov	x0, x19
	bl	_amdgpu_device_has_dc_support
	mov	x8, x0
	ldr	w0, [x19, #80]
	cbz	w8, LBB0_3
; %bb.2:
	bl	_drm_atomic_helper_shutdown
	b	LBB0_4
LBB0_3:
	bl	_drm_helper_force_disable_all
LBB0_4:
	mov	x0, x19
	bl	_amdgpu_fence_driver_fini
	mov	x0, x19
	bl	_amdgpu_pm_sysfs_fini
	mov	x0, x19
	bl	_amdgpu_fbdev_fini
	mov	x0, x19
	bl	_amdgpu_device_ip_fini
	ldr	x0, [x19, #72]
	cbz	x0, LBB0_6
; %bb.5:
	bl	_release_firmware
	str	xzr, [x19, #72]
LBB0_6:
	str	wzr, [x19, #4]
	add	x0, x19, #64
	bl	_cancel_delayed_work_sync
	mov	x0, x19
	bl	_amdgpu_device_has_dc_support
	cbnz	w0, LBB0_8
; %bb.7:
	mov	x0, x19
	bl	_amdgpu_i2c_fini
LBB0_8:
Lloh2:
	adrp	x8, _amdgpu_emu_mode@GOTPAGE
Lloh3:
	ldr	x8, [x8, _amdgpu_emu_mode@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	cmp	w8, #1
	b.eq	LBB0_10
; %bb.9:
	mov	x0, x19
	bl	_amdgpu_atombios_fini
LBB0_10:
	ldr	x0, [x19, #56]
	bl	_kfree
	str	xzr, [x19, #56]
	ldr	w0, [x19, #48]
	bl	_pci_is_thunderbolt_attached
	cbnz	w0, LBB0_12
; %bb.11:
	ldr	w0, [x19, #48]
	bl	_vga_switcheroo_unregister_client
LBB0_12:
	ldr	w8, [x19, #8]
Lloh5:
	adrp	x9, _AMD_IS_PX@GOTPAGE
Lloh6:
	ldr	x9, [x9, _AMD_IS_PX@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_14
; %bb.13:
	ldr	w0, [x19, #24]
	bl	_vga_switcheroo_fini_domain_pm_ops
LBB0_14:
	ldr	w0, [x19, #48]
	mov	x1, #0
	mov	x2, #0
	mov	x3, #0
	bl	_vga_client_register
	ldr	x1, [x19, #40]
	cbz	x1, LBB0_16
; %bb.15:
	ldr	w0, [x19, #48]
	bl	_pci_iounmap
LBB0_16:
	str	xzr, [x19, #40]
	ldr	x0, [x19, #32]
	bl	_iounmap
	str	xzr, [x19, #32]
	mov	x0, x19
	bl	_amdgpu_device_doorbell_fini
	mov	x0, x19
	bl	_amdgpu_sriov_vf
	cbz	x0, LBB0_19
; %bb.17:
	mov	x0, x19
	bl	_amdgim_is_hwperf
	cbz	x0, LBB0_19
; %bb.18:
	mov	x0, x19
	bl	_amdgpu_pm_virt_sysfs_fini
LBB0_19:
	mov	x0, x19
	bl	_amdgpu_debugfs_regs_cleanup
	ldr	w0, [x19, #24]
Lloh8:
	adrp	x1, _dev_attr_pcie_replay_count@GOTPAGE
Lloh9:
	ldr	x1, [x1, _dev_attr_pcie_replay_count@GOTPAGEOFF]
	bl	_device_remove_file
	mov	x0, x19
	bl	_amdgpu_ucode_sysfs_fini
Lloh10:
	adrp	x8, _CONFIG_PERF_EVENTS@GOTPAGE
Lloh11:
	ldr	x8, [x8, _CONFIG_PERF_EVENTS@GOTPAGEOFF]
Lloh12:
	ldr	w0, [x8]
	bl	_IS_ENABLED
	cbz	x0, LBB0_21
; %bb.20:
	mov	x0, x19
	bl	_amdgpu_pmu_fini
LBB0_21:
	mov	x0, x19
	bl	_amdgpu_debugfs_preempt_cleanup
Lloh13:
	adrp	x8, _amdgpu_discovery@GOTPAGE
Lloh14:
	ldr	x8, [x8, _amdgpu_discovery@GOTPAGEOFF]
Lloh15:
	ldr	x8, [x8]
	cbz	x8, LBB0_23
; %bb.22:
	ldr	x8, [x19, #16]
Lloh16:
	adrp	x9, _CHIP_NAVI10@GOTPAGE
Lloh17:
	ldr	x9, [x9, _CHIP_NAVI10@GOTPAGEOFF]
Lloh18:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ge	LBB0_24
LBB0_23:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_24:
	mov	x0, x19
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_amdgpu_discovery_fini
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"amdgpu: finishing device.\n"

	.comm	_amdgpu_emu_mode,4,2            ; @amdgpu_emu_mode
	.comm	_AMD_IS_PX,4,2                  ; @AMD_IS_PX
	.comm	_dev_attr_pcie_replay_count,4,2 ; @dev_attr_pcie_replay_count
	.comm	_CONFIG_PERF_EVENTS,4,2         ; @CONFIG_PERF_EVENTS
	.comm	_amdgpu_discovery,8,3           ; @amdgpu_discovery
	.comm	_CHIP_NAVI10,8,3                ; @CHIP_NAVI10
.subsections_via_symbols
