	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ivtv_v4l2_close                ## -- Begin function ivtv_v4l2_close
	.p2align	4, 0x90
_ivtv_v4l2_close:                       ## @ivtv_v4l2_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	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	(%rdi), %r12
	movq	%r12, %rdi
	callq	_fh2id
	movq	%rax, %r15
	movq	(%rax), %r14
	movq	16(%rax), %r13
	movq	24(%r13), %rax
	shlq	$5, %r14
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movl	24(%rax,%r14), %esi
	leaq	L_.str(%rip), %rdi
	callq	_IVTV_DEBUG_FILE
	leaq	16(%r13), %rdi
	movq	%rdi, -64(%rbp)                 ## 8-byte Spill
	callq	_mutex_lock
	movq	(%r15), %rax
	movq	_IVTV_ENC_STREAM_TYPE_RAD@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_7
## %bb.1:
	movq	%rbx, %rdi
	callq	_v4l2_fh_is_singular_file
	testq	%rax, %rax
	je	LBB0_7
## %bb.2:
	movq	%r13, %rdi
	callq	_ivtv_mute
	movq	_IVTV_F_I_RADIO_USER@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	48(%r13), %rsi
	callq	_clear_bit
	movq	_video@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	_s_std@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	44(%r13), %ecx
	movq	%r13, %rdi
	callq	_ivtv_call_all
	movq	%r13, %rdi
	callq	_ivtv_audio_set_io
	movq	_IVTV_HW_SAA711X@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	testl	%esi, (%r13)
	je	LBB0_4
## %bb.3:
	movl	(%rbx), %edx
	movq	_s_crystal_freq@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	_SAA7115_FREQ_32_11_MHZ@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	%r13, %rdi
	xorl	%r9d, %r9d
	callq	_ivtv_call_hw
LBB0_4:
	leaq	40(%r13), %rdi
	callq	_atomic_read
	testq	%rax, %rax
	jle	LBB0_6
## %bb.5:
	movq	_CX2341X_ENC_MUTE_VIDEO@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	36(%r13), %edi
	callq	_v4l2_ctrl_g_ctrl
	movl	%eax, %ebx
	movl	32(%r13), %edi
	callq	_v4l2_ctrl_g_ctrl
	shll	$8, %eax
	orl	%eax, %ebx
	movq	%r13, %rdi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movl	$1, %edx
	movl	%ebx, %ecx
	callq	_ivtv_vapi
LBB0_6:
	movq	%r13, %rdi
	callq	_ivtv_unmute
LBB0_7:
	movq	%r12, %rdi
	callq	_v4l2_fh_del
	movq	%r12, %rdi
	callq	_v4l2_fh_exit
	movq	%r15, %rax
	addq	$8, %rax
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	cmpq	%rax, 16(%rcx,%r14)
	jne	LBB0_13
## %bb.8:
	movq	%rcx, %rax
	movq	(%rcx,%r14), %rax
	movq	_IVTV_DEC_STREAM_TYPE_MPG@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jge	LBB0_9
## %bb.12:
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	_ivtv_stop_capture
	jmp	LBB0_13
LBB0_9:
	movq	24(%r13), %r14
	movq	_IVTV_DEC_STREAM_TYPE_VOUT@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
	movq	_V4L2_DEC_CMD_STOP_TO_BLACK@GOTPCREL(%rip), %rax
	movq	_V4L2_DEC_CMD_STOP_IMMEDIATELY@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	orl	(%rax), %esi
	movq	%r15, %rdi
	xorl	%edx, %edx
	callq	_ivtv_stop_decoding
	movq	8(%r13), %rax
	movq	_OUT_NONE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_13
## %bb.10:
	movq	_IVTV_F_S_APPL_IO@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	shlq	$5, %rbx
	leaq	(%r14,%rbx), %rsi
	addq	$8, %rsi
	callq	_test_bit
	testl	%eax, %eax
	jne	LBB0_13
## %bb.11:
	movq	%r13, %rdi
	callq	_ivtv_disable_cc
LBB0_13:
	movq	%r15, %rdi
	callq	_kfree
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_mutex_unlock
	xorl	%eax, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"close %s\n"

	.comm	_IVTV_ENC_STREAM_TYPE_RAD,8,3   ## @IVTV_ENC_STREAM_TYPE_RAD
	.comm	_IVTV_F_I_RADIO_USER,4,2        ## @IVTV_F_I_RADIO_USER
	.comm	_video,4,2                      ## @video
	.comm	_s_std,4,2                      ## @s_std
	.comm	_IVTV_HW_SAA711X,4,2            ## @IVTV_HW_SAA711X
	.comm	_s_crystal_freq,4,2             ## @s_crystal_freq
	.comm	_SAA7115_FREQ_32_11_MHZ,4,2     ## @SAA7115_FREQ_32_11_MHZ
	.comm	_CX2341X_ENC_MUTE_VIDEO,4,2     ## @CX2341X_ENC_MUTE_VIDEO
	.comm	_IVTV_DEC_STREAM_TYPE_MPG,8,3   ## @IVTV_DEC_STREAM_TYPE_MPG
	.comm	_IVTV_DEC_STREAM_TYPE_VOUT,8,3  ## @IVTV_DEC_STREAM_TYPE_VOUT
	.comm	_V4L2_DEC_CMD_STOP_TO_BLACK,4,2 ## @V4L2_DEC_CMD_STOP_TO_BLACK
	.comm	_V4L2_DEC_CMD_STOP_IMMEDIATELY,4,2 ## @V4L2_DEC_CMD_STOP_IMMEDIATELY
	.comm	_OUT_NONE,8,3                   ## @OUT_NONE
	.comm	_IVTV_F_S_APPL_IO,4,2           ## @IVTV_F_S_APPL_IO
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ivtv_v4l2_close                ; -- Begin function ivtv_v4l2_close
	.p2align	2
_ivtv_v4l2_close:                       ; @ivtv_v4l2_close
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x23, x0
	ldr	x22, [x0]
	mov	x0, x22
	bl	_fh2id
	mov	x19, x0
	ldr	x21, [x0, #16]
	ldr	x25, [x21, #24]
	ldr	x26, [x0]
	add	x27, x25, x26, lsl #5
	ldr	w1, [x27, #24]
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_IVTV_DEBUG_FILE
	add	x20, x21, #16
	mov	x0, x20
	bl	_mutex_lock
	ldr	x8, [x19]
Lloh2:
	adrp	x9, _IVTV_ENC_STREAM_TYPE_RAD@GOTPAGE
Lloh3:
	ldr	x9, [x9, _IVTV_ENC_STREAM_TYPE_RAD@GOTPAGEOFF]
Lloh4:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_7
; %bb.1:
	mov	x0, x23
	bl	_v4l2_fh_is_singular_file
	cbz	x0, LBB0_7
; %bb.2:
	mov	x0, x21
	bl	_ivtv_mute
Lloh5:
	adrp	x8, _IVTV_F_I_RADIO_USER@GOTPAGE
Lloh6:
	ldr	x8, [x8, _IVTV_F_I_RADIO_USER@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x8]
	add	x1, x21, #48
	bl	_clear_bit
Lloh8:
	adrp	x23, _video@GOTPAGE
Lloh9:
	ldr	x23, [x23, _video@GOTPAGEOFF]
	ldr	w1, [x23]
Lloh10:
	adrp	x8, _s_std@GOTPAGE
Lloh11:
	ldr	x8, [x8, _s_std@GOTPAGEOFF]
Lloh12:
	ldr	w2, [x8]
	ldr	w3, [x21, #44]
	mov	x0, x21
	bl	_ivtv_call_all
	mov	x0, x21
	bl	_ivtv_audio_set_io
	ldr	w8, [x21]
Lloh13:
	adrp	x9, _IVTV_HW_SAA711X@GOTPAGE
Lloh14:
	ldr	x9, [x9, _IVTV_HW_SAA711X@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x9]
	tst	w1, w8
	b.eq	LBB0_4
; %bb.3:
	ldr	w2, [x23]
Lloh16:
	adrp	x8, _s_crystal_freq@GOTPAGE
Lloh17:
	ldr	x8, [x8, _s_crystal_freq@GOTPAGEOFF]
Lloh18:
	ldr	w3, [x8]
Lloh19:
	adrp	x8, _SAA7115_FREQ_32_11_MHZ@GOTPAGE
Lloh20:
	ldr	x8, [x8, _SAA7115_FREQ_32_11_MHZ@GOTPAGEOFF]
Lloh21:
	ldr	w4, [x8]
	mov	x0, x21
	mov	w5, #0
	bl	_ivtv_call_hw
LBB0_4:
	add	x0, x21, #40
	bl	_atomic_read
	cmp	x0, #1
	b.lt	LBB0_6
; %bb.5:
Lloh22:
	adrp	x8, _CX2341X_ENC_MUTE_VIDEO@GOTPAGE
Lloh23:
	ldr	x8, [x8, _CX2341X_ENC_MUTE_VIDEO@GOTPAGEOFF]
Lloh24:
	ldr	w23, [x8]
	ldr	w0, [x21, #36]
	bl	_v4l2_ctrl_g_ctrl
	mov	x24, x0
	ldr	w0, [x21, #32]
	bl	_v4l2_ctrl_g_ctrl
	orr	w3, w24, w0, lsl #8
	mov	x0, x21
	mov	x1, x23
	mov	w2, #1
	bl	_ivtv_vapi
LBB0_6:
	mov	x0, x21
	bl	_ivtv_unmute
LBB0_7:
	mov	x0, x22
	bl	_v4l2_fh_del
	mov	x0, x22
	bl	_v4l2_fh_exit
	ldr	x8, [x27, #16]
	add	x9, x19, #8
	cmp	x8, x9
	b.ne	LBB0_13
; %bb.8:
	lsl	x8, x26, #5
	ldr	x8, [x25, x8]
Lloh25:
	adrp	x9, _IVTV_DEC_STREAM_TYPE_MPG@GOTPAGE
Lloh26:
	ldr	x9, [x9, _IVTV_DEC_STREAM_TYPE_MPG@GOTPAGEOFF]
Lloh27:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ge	LBB0_10
; %bb.9:
	mov	x0, x19
	mov	w1, #0
	bl	_ivtv_stop_capture
	b	LBB0_13
LBB0_10:
	ldr	x22, [x21, #24]
Lloh28:
	adrp	x8, _IVTV_DEC_STREAM_TYPE_VOUT@GOTPAGE
Lloh29:
	ldr	x8, [x8, _IVTV_DEC_STREAM_TYPE_VOUT@GOTPAGEOFF]
Lloh30:
	adrp	x9, _V4L2_DEC_CMD_STOP_TO_BLACK@GOTPAGE
Lloh31:
	ldr	x9, [x9, _V4L2_DEC_CMD_STOP_TO_BLACK@GOTPAGEOFF]
Lloh32:
	ldr	x23, [x8]
Lloh33:
	ldr	w8, [x9]
Lloh34:
	adrp	x9, _V4L2_DEC_CMD_STOP_IMMEDIATELY@GOTPAGE
Lloh35:
	ldr	x9, [x9, _V4L2_DEC_CMD_STOP_IMMEDIATELY@GOTPAGEOFF]
Lloh36:
	ldr	w9, [x9]
	orr	w1, w9, w8
	mov	x0, x19
	mov	w2, #0
	bl	_ivtv_stop_decoding
	ldr	x8, [x21, #8]
Lloh37:
	adrp	x9, _OUT_NONE@GOTPAGE
Lloh38:
	ldr	x9, [x9, _OUT_NONE@GOTPAGEOFF]
Lloh39:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_13
; %bb.11:
Lloh40:
	adrp	x8, _IVTV_F_S_APPL_IO@GOTPAGE
Lloh41:
	ldr	x8, [x8, _IVTV_F_S_APPL_IO@GOTPAGEOFF]
Lloh42:
	ldr	w0, [x8]
	add	x8, x22, x23, lsl #5
	add	x1, x8, #8
	bl	_test_bit
	cbnz	w0, LBB0_13
; %bb.12:
	mov	x0, x21
	bl	_ivtv_disable_cc
LBB0_13:
	mov	x0, x19
	bl	_kfree
	mov	x0, x20
	bl	_mutex_unlock
	mov	w0, #0
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh33
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh32
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh42
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"close %s\n"

	.comm	_IVTV_ENC_STREAM_TYPE_RAD,8,3   ; @IVTV_ENC_STREAM_TYPE_RAD
	.comm	_IVTV_F_I_RADIO_USER,4,2        ; @IVTV_F_I_RADIO_USER
	.comm	_video,4,2                      ; @video
	.comm	_s_std,4,2                      ; @s_std
	.comm	_IVTV_HW_SAA711X,4,2            ; @IVTV_HW_SAA711X
	.comm	_s_crystal_freq,4,2             ; @s_crystal_freq
	.comm	_SAA7115_FREQ_32_11_MHZ,4,2     ; @SAA7115_FREQ_32_11_MHZ
	.comm	_CX2341X_ENC_MUTE_VIDEO,4,2     ; @CX2341X_ENC_MUTE_VIDEO
	.comm	_IVTV_DEC_STREAM_TYPE_MPG,8,3   ; @IVTV_DEC_STREAM_TYPE_MPG
	.comm	_IVTV_DEC_STREAM_TYPE_VOUT,8,3  ; @IVTV_DEC_STREAM_TYPE_VOUT
	.comm	_V4L2_DEC_CMD_STOP_TO_BLACK,4,2 ; @V4L2_DEC_CMD_STOP_TO_BLACK
	.comm	_V4L2_DEC_CMD_STOP_IMMEDIATELY,4,2 ; @V4L2_DEC_CMD_STOP_IMMEDIATELY
	.comm	_OUT_NONE,8,3                   ; @OUT_NONE
	.comm	_IVTV_F_S_APPL_IO,4,2           ; @IVTV_F_S_APPL_IO
.subsections_via_symbols
