	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pvr2_hdw_destroy               ## -- Begin function pvr2_hdw_destroy
	.p2align	4, 0x90
_pvr2_hdw_destroy:                      ## @pvr2_hdw_destroy
	.cfi_startproc
## %bb.0:
	testq	%rdi, %rdi
	je	LBB0_9
## %bb.1:
	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
	movq	_PVR2_TRACE_INIT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	movq	%rbx, %rdx
	callq	_pvr2_trace
	leaq	64(%rbx), %rdi
	callq	_flush_work
	leaq	60(%rbx), %rdi
	callq	_del_timer_sync
	leaq	56(%rbx), %rdi
	callq	_del_timer_sync
	leaq	52(%rbx), %rdi
	callq	_del_timer_sync
	leaq	48(%rbx), %rdi
	callq	_del_timer_sync
	movq	40(%rbx), %rdi
	testq	%rdi, %rdi
	je	LBB0_3
## %bb.2:
	callq	_kfree
	movq	$0, 40(%rbx)
LBB0_3:
	movq	32(%rbx), %rdi
	testq	%rdi, %rdi
	je	LBB0_5
## %bb.4:
	callq	_pvr2_stream_destroy
	movq	$0, 32(%rbx)
LBB0_5:
	movq	%rbx, %rdi
	callq	_pvr2_i2c_core_done
	leaq	24(%rbx), %rdi
	callq	_v4l2_device_unregister
	movq	%rbx, %rdi
	callq	_pvr2_hdw_remove_usb_stuff
	movq	_pvr2_unit_mtx@GOTPCREL(%rip), %rdi
	callq	_mutex_lock
	movq	(%rbx), %rax
	movq	_PVR_NUM@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jae	LBB0_8
## %bb.6:
	movq	_unit_pointers@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	%rbx, (%rcx,%rax,8)
	jne	LBB0_8
## %bb.7:
	movq	$0, (%rcx,%rax,8)
LBB0_8:
	movq	_pvr2_unit_mtx@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
	movq	16(%rbx), %rdi
	callq	_kfree
	movq	8(%rbx), %rdi
	callq	_kfree
	movq	%rbx, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	jmp	_kfree                          ## TAILCALL
LBB0_9:
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PVR2_TRACE_INIT,4,2            ## @PVR2_TRACE_INIT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"pvr2_hdw_destroy: hdw=%p"

	.comm	_pvr2_unit_mtx,4,2              ## @pvr2_unit_mtx
	.comm	_PVR_NUM,8,3                    ## @PVR_NUM
	.comm	_unit_pointers,8,3              ## @unit_pointers
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pvr2_hdw_destroy               ; -- Begin function pvr2_hdw_destroy
	.p2align	2
_pvr2_hdw_destroy:                      ; @pvr2_hdw_destroy
	.cfi_startproc
; %bb.0:
	cbz	x0, LBB0_9
; %bb.1:
	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	x8, _PVR2_TRACE_INIT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PVR2_TRACE_INIT@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x19
	bl	_pvr2_trace
	add	x0, x19, #64
	bl	_flush_work
	add	x0, x19, #60
	bl	_del_timer_sync
	add	x0, x19, #56
	bl	_del_timer_sync
	add	x0, x19, #52
	bl	_del_timer_sync
	add	x0, x19, #48
	bl	_del_timer_sync
	ldr	x0, [x19, #40]
	cbz	x0, LBB0_3
; %bb.2:
	bl	_kfree
	str	xzr, [x19, #40]
LBB0_3:
	ldr	x0, [x19, #32]
	cbz	x0, LBB0_5
; %bb.4:
	bl	_pvr2_stream_destroy
	str	xzr, [x19, #32]
LBB0_5:
	mov	x0, x19
	bl	_pvr2_i2c_core_done
	add	x0, x19, #24
	bl	_v4l2_device_unregister
	mov	x0, x19
	bl	_pvr2_hdw_remove_usb_stuff
Lloh5:
	adrp	x0, _pvr2_unit_mtx@GOTPAGE
Lloh6:
	ldr	x0, [x0, _pvr2_unit_mtx@GOTPAGEOFF]
	bl	_mutex_lock
	ldr	x8, [x19]
Lloh7:
	adrp	x9, _PVR_NUM@GOTPAGE
Lloh8:
	ldr	x9, [x9, _PVR_NUM@GOTPAGEOFF]
Lloh9:
	ldr	x9, [x9]
	cmp	x8, x9
	b.hs	LBB0_8
; %bb.6:
Lloh10:
	adrp	x9, _unit_pointers@GOTPAGE
Lloh11:
	ldr	x9, [x9, _unit_pointers@GOTPAGEOFF]
Lloh12:
	ldr	x9, [x9]
	ldr	x10, [x9, x8, lsl #3]
	cmp	x10, x19
	b.ne	LBB0_8
; %bb.7:
	str	xzr, [x9, x8, lsl #3]
LBB0_8:
Lloh13:
	adrp	x0, _pvr2_unit_mtx@GOTPAGE
Lloh14:
	ldr	x0, [x0, _pvr2_unit_mtx@GOTPAGEOFF]
	bl	_mutex_unlock
	ldr	x0, [x19, #16]
	bl	_kfree
	ldr	x0, [x19, #8]
	bl	_kfree
	mov	x0, x19
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_kfree
LBB0_9:
	.cfi_def_cfa wsp, 0
	.cfi_same_value w30
	.cfi_same_value w29
	.cfi_same_value w19
	.cfi_same_value w20
	ret
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_PVR2_TRACE_INIT,4,2            ; @PVR2_TRACE_INIT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"pvr2_hdw_destroy: hdw=%p"

	.comm	_pvr2_unit_mtx,4,2              ; @pvr2_unit_mtx
	.comm	_PVR_NUM,8,3                    ; @PVR_NUM
	.comm	_unit_pointers,8,3              ; @unit_pointers
.subsections_via_symbols
