	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cpia2_usb_disconnect
_cpia2_usb_disconnect:                  ## @cpia2_usb_disconnect
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %r14
	callq	_usb_get_intfdata
	movq	%rax, %rbx
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_usb_set_intfdata
	leaq	L_.str(%rip), %rdi
	callq	_DBG
	movq	%rbx, %rdi
	callq	_cpia2_usb_stream_stop
	leaq	24(%rbx), %r14
	movq	%r14, %rdi
	callq	_mutex_lock
	leaq	L_.str.1(%rip), %rdi
	callq	_DBG
	movq	%rbx, %rdi
	callq	_cpia2_unregister_camera
	movq	%rbx, %rdi
	callq	_v4l2_device_disconnect
	movq	%r14, %rdi
	callq	_mutex_unlock
	cmpq	$0, 16(%rbx)
	je	LBB0_2
## %bb.1:
	leaq	L_.str.2(%rip), %rdi
	callq	_DBG
	movq	_FRAME_READY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	8(%rbx), %rcx
	movl	%eax, 8(%rcx)
	movq	$0, (%rcx)
	movq	%rbx, %rdi
	addq	$4, %rdi
	callq	_wake_up_interruptible
LBB0_2:
	movq	%rbx, %rdi
	callq	_v4l2_device_put
	leaq	L_.str.3(%rip), %rdi
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_LOG                            ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Stopping stream\n"

L_.str.1:                               ## @.str.1
	.asciz	"Unregistering camera\n"

L_.str.2:                               ## @.str.2
	.asciz	"Wakeup waiting processes\n"

	.comm	_FRAME_READY,4,2                ## @FRAME_READY
L_.str.3:                               ## @.str.3
	.asciz	"CPiA2 camera disconnected.\n"

	.no_dead_strip	_cpia2_usb_disconnect
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cpia2_usb_disconnect
_cpia2_usb_disconnect:                  ; @cpia2_usb_disconnect
	.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	x20, x0
	bl	_usb_get_intfdata
	mov	x19, x0
	mov	x0, x20
	mov	x1, #0
	bl	_usb_set_intfdata
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DBG
	mov	x0, x19
	bl	_cpia2_usb_stream_stop
	add	x20, x19, #24
	mov	x0, x20
	bl	_mutex_lock
Lloh2:
	adrp	x0, l_.str.1@PAGE
Lloh3:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_DBG
	mov	x0, x19
	bl	_cpia2_unregister_camera
	mov	x0, x19
	bl	_v4l2_device_disconnect
	mov	x0, x20
	bl	_mutex_unlock
	ldr	x8, [x19, #16]
	cbz	x8, LBB0_2
; %bb.1:
Lloh4:
	adrp	x0, l_.str.2@PAGE
Lloh5:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_DBG
Lloh6:
	adrp	x8, _FRAME_READY@GOTPAGE
Lloh7:
	ldr	x8, [x8, _FRAME_READY@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	ldr	x9, [x19, #8]
	str	w8, [x9, #8]
	str	xzr, [x9]
	add	x0, x19, #4
	bl	_wake_up_interruptible
LBB0_2:
	mov	x0, x19
	bl	_v4l2_device_put
Lloh9:
	adrp	x0, l_.str.3@PAGE
Lloh10:
	add	x0, x0, l_.str.3@PAGEOFF
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_LOG
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Stopping stream\n"

l_.str.1:                               ; @.str.1
	.asciz	"Unregistering camera\n"

l_.str.2:                               ; @.str.2
	.asciz	"Wakeup waiting processes\n"

	.comm	_FRAME_READY,4,2                ; @FRAME_READY
l_.str.3:                               ; @.str.3
	.asciz	"CPiA2 camera disconnected.\n"

	.no_dead_strip	_cpia2_usb_disconnect
.subsections_via_symbols
