	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function pwc_video_close
_pwc_video_close:                       ## @pwc_video_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	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	(%rdi), %rbx
	leaq	L_.str(%rip), %rdi
	movq	%rbx, %rsi
	callq	_PWC_DEBUG_OPEN
	movq	%rbx, %rdi
	callq	_video_get_drvdata
	movq	%rax, %rbx
	leaq	4(%rax), %r14
	movq	%r14, %rdi
	callq	_mutex_lock
	cmpq	$0, 8(%rbx)
	jne	LBB0_2
## %bb.1:
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_PWC_DEBUG_MODULE
LBB0_2:
	movl	(%rbx), %esi
	cmpl	$21, %esi
	jl	LBB0_4
## %bb.3:
	movl	24(%rbx), %ecx
	movl	28(%rbx), %edx
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_PWC_DEBUG_MODULE
LBB0_4:
	movl	20(%rbx), %edi
	callq	_DEVICE_USE_CODEC1
	testq	%rax, %rax
	je	LBB0_6
## %bb.5:
	xorl	%eax, %eax
	callq	_pwc_dec1_exit
	jmp	LBB0_7
LBB0_6:
	xorl	%eax, %eax
	callq	_pwc_dec23_exit
LBB0_7:
	movq	%rbx, %rdi
	callq	_pwc_isoc_cleanup
	movq	%rbx, %rdi
	callq	_pwc_free_buffers
	cmpl	$0, 16(%rbx)
	je	LBB0_8
## %bb.14:
	movq	%rbx, %rdi
	callq	_pwc_cleanup
	movq	_MAX_DEV_HINTS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jle	LBB0_26
## %bb.15:
	cmpl	$1, %eax
	jne	LBB0_17
## %bb.16:
	xorl	%ecx, %ecx
LBB0_23:
	testb	$1, %al
	je	LBB0_26
## %bb.24:
	movq	_device_hint@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	%rbx, (%rax,%rcx,8)
	jne	LBB0_26
## %bb.25:
	movq	$0, (%rax,%rcx,8)
	jmp	LBB0_26
LBB0_8:
	movq	%rbx, %rdi
	xorl	%esi, %esi
	xorl	%edx, %edx
	callq	_pwc_set_leds
	testq	%rax, %rax
	jns	LBB0_10
## %bb.9:
	leaq	L_.str.3(%rip), %rdi
	xorl	%eax, %eax
	callq	_PWC_DEBUG_MODULE
LBB0_10:
	movq	_power_save@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_13
## %bb.11:
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_pwc_camera_power
	testl	%eax, %eax
	jns	LBB0_13
## %bb.12:
	leaq	L_.str.4(%rip), %rdi
	movl	%eax, %esi
	callq	_PWC_ERROR
LBB0_13:
	movq	8(%rbx), %rsi
	addq	$-4, %rsi
	movq	%rsi, 8(%rbx)
	leaq	L_.str.5(%rip), %rdi
	callq	_PWC_DEBUG_OPEN
LBB0_26:
	movq	%r14, %rdi
	callq	_mutex_unlock
	xorl	%eax, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_17:
	movl	%eax, %edx
	andl	$-2, %edx
	xorl	%ecx, %ecx
	movq	_device_hint@GOTPCREL(%rip), %rsi
	jmp	LBB0_18
	.p2align	4, 0x90
LBB0_22:                                ##   in Loop: Header=BB0_18 Depth=1
	addq	$2, %rcx
	cmpq	%rcx, %rdx
	je	LBB0_23
LBB0_18:                                ## =>This Inner Loop Header: Depth=1
	movq	(%rsi), %rdi
	cmpq	%rbx, (%rdi,%rcx,8)
	jne	LBB0_20
## %bb.19:                              ##   in Loop: Header=BB0_18 Depth=1
	movq	$0, (%rdi,%rcx,8)
LBB0_20:                                ##   in Loop: Header=BB0_18 Depth=1
	movq	(%rsi), %rdi
	cmpq	%rbx, 8(%rdi,%rcx,8)
	jne	LBB0_22
## %bb.21:                              ##   in Loop: Header=BB0_18 Depth=1
	movq	$0, 8(%rdi,%rcx,8)
	jmp	LBB0_22
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	">> video_close called(vdev = 0x%p).\n"

L_.str.1:                               ## @.str.1
	.asciz	"video_close() called on closed device?\n"

L_.str.2:                               ## @.str.2
	.asciz	"Closing video device: %d frames received, dumped %d frames, %d frames with errors.\n"

L_.str.3:                               ## @.str.3
	.asciz	"Failed to set LED on/off time.\n"

	.comm	_power_save,8,3                 ## @power_save
L_.str.4:                               ## @.str.4
	.asciz	"Failed to power down camera (%d)\n"

L_.str.5:                               ## @.str.5
	.asciz	"<< video_close() vopen=%d\n"

	.comm	_MAX_DEV_HINTS,4,2              ## @MAX_DEV_HINTS
	.comm	_device_hint,8,3                ## @device_hint
	.no_dead_strip	_pwc_video_close
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function pwc_video_close
_pwc_video_close:                       ; @pwc_video_close
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	ldr	x19, [x0]
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x19
	bl	_PWC_DEBUG_OPEN
	mov	x0, x19
	bl	_video_get_drvdata
	mov	x20, x0
	add	x19, x0, #4
	mov	x0, x19
	bl	_mutex_lock
	ldr	x8, [x20, #8]
	cbnz	x8, LBB0_2
; %bb.1:
Lloh2:
	adrp	x0, l_.str.1@PAGE
Lloh3:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_PWC_DEBUG_MODULE
LBB0_2:
	ldr	w8, [x20]
	cmp	w8, #21
	b.lt	LBB0_4
; %bb.3:
	ldp	w10, w9, [x20, #24]
	stp	x9, x10, [sp, #8]
	str	x8, [sp]
Lloh4:
	adrp	x0, l_.str.2@PAGE
Lloh5:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_PWC_DEBUG_MODULE
LBB0_4:
	ldr	w0, [x20, #20]
	bl	_DEVICE_USE_CODEC1
	cbz	x0, LBB0_6
; %bb.5:
	bl	_pwc_dec1_exit
	b	LBB0_7
LBB0_6:
	bl	_pwc_dec23_exit
LBB0_7:
	mov	x0, x20
	bl	_pwc_isoc_cleanup
	mov	x0, x20
	bl	_pwc_free_buffers
	ldr	w8, [x20, #16]
	cbz	w8, LBB0_13
; %bb.8:
	mov	x0, x20
	bl	_pwc_cleanup
Lloh6:
	adrp	x8, _MAX_DEV_HINTS@GOTPAGE
Lloh7:
	ldr	x8, [x8, _MAX_DEV_HINTS@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x8]
	cmp	w9, #1
	b.lt	LBB0_19
; %bb.9:
	mov	x8, #0
	lsl	x9, x9, #3
Lloh9:
	adrp	x10, _device_hint@GOTPAGE
Lloh10:
	ldr	x10, [x10, _device_hint@GOTPAGEOFF]
	b	LBB0_11
LBB0_10:                                ;   in Loop: Header=BB0_11 Depth=1
	add	x8, x8, #8
	cmp	x9, x8
	b.eq	LBB0_19
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	ldr	x11, [x10]
	ldr	x12, [x11, x8]
	cmp	x12, x20
	b.ne	LBB0_10
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	str	xzr, [x11, x8]
	b	LBB0_10
LBB0_13:
	mov	x0, x20
	mov	w1, #0
	mov	w2, #0
	bl	_pwc_set_leds
	tbz	x0, #63, LBB0_15
; %bb.14:
Lloh11:
	adrp	x0, l_.str.3@PAGE
Lloh12:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_PWC_DEBUG_MODULE
LBB0_15:
Lloh13:
	adrp	x8, _power_save@GOTPAGE
Lloh14:
	ldr	x8, [x8, _power_save@GOTPAGEOFF]
Lloh15:
	ldr	x8, [x8]
	cbz	x8, LBB0_18
; %bb.16:
	mov	x0, x20
	mov	w1, #0
	bl	_pwc_camera_power
	tbz	w0, #31, LBB0_18
; %bb.17:
	mov	x1, x0
Lloh16:
	adrp	x0, l_.str.4@PAGE
Lloh17:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_PWC_ERROR
LBB0_18:
	ldr	x8, [x20, #8]
	sub	x1, x8, #4
	str	x1, [x20, #8]
Lloh18:
	adrp	x0, l_.str.5@PAGE
Lloh19:
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_PWC_DEBUG_OPEN
LBB0_19:
	mov	x0, x19
	bl	_mutex_unlock
	mov	w0, #0
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	">> video_close called(vdev = 0x%p).\n"

l_.str.1:                               ; @.str.1
	.asciz	"video_close() called on closed device?\n"

l_.str.2:                               ; @.str.2
	.asciz	"Closing video device: %d frames received, dumped %d frames, %d frames with errors.\n"

l_.str.3:                               ; @.str.3
	.asciz	"Failed to set LED on/off time.\n"

	.comm	_power_save,8,3                 ; @power_save
l_.str.4:                               ; @.str.4
	.asciz	"Failed to power down camera (%d)\n"

l_.str.5:                               ; @.str.5
	.asciz	"<< video_close() vopen=%d\n"

	.comm	_MAX_DEV_HINTS,4,2              ; @MAX_DEV_HINTS
	.comm	_device_hint,8,3                ; @device_hint
	.no_dead_strip	_pwc_video_close
.subsections_via_symbols
