	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cx18_init_on_first_open        ## -- Begin function cx18_init_on_first_open
	.p2align	4, 0x90
_cx18_init_on_first_open:               ## @cx18_init_on_first_open
	.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, %r12
	movq	%rdi, -64(%rbp)
	movq	_CX18_F_I_FAILED@GOTPCREL(%rip), %r13
	movl	(%r13), %edi
	leaq	16(%r12), %r14
	movq	%r14, %rsi
	callq	_test_bit
	testq	%rax, %rax
	je	LBB0_2
LBB0_1:
	movq	_ENXIO@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_15
LBB0_2:
	movq	_CX18_F_I_INITED@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r14, %rsi
	callq	_test_and_set_bit
	xorl	%ebx, %ebx
	testq	%rax, %rax
	je	LBB0_3
LBB0_15:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	movq	%r12, %rdi
	callq	_cx18_firmware_init
	testq	%rax, %rax
	je	LBB0_6
## %bb.4:
	leaq	L_.str(%rip), %rdi
	callq	_CX18_WARN
	movq	%r12, %rdi
	callq	_cx18_firmware_init
	testq	%rax, %rax
	jne	LBB0_5
LBB0_6:
	movq	_CX18_F_I_LOADED_FW@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r14, %rsi
	callq	_set_bit
	movq	_CX18_APU_START@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_CX18_APU_ENCODING_METHOD_MPEG@GOTPCREL(%rip), %rbx
	movl	$185, %r15d
	movl	(%rbx), %ecx
	orl	%r15d, %ecx
	movq	%r12, %rdi
	movl	$2, %edx
	xorl	%r8d, %r8d
	xorl	%eax, %eax
	callq	_cx18_vapi
	movq	_CX18_APU_RESETAI@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	xorl	%edx, %edx
	xorl	%eax, %eax
	callq	_cx18_vapi
	movq	_CX18_APU_STOP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%rbx), %ecx
	movq	%r12, %rdi
	movl	$1, %edx
	xorl	%eax, %eax
	callq	_cx18_vapi
	movq	%r12, %rdi
	callq	_cx18_firmware_init
	testq	%rax, %rax
	je	LBB0_8
## %bb.7:
	leaq	L_.str(%rip), %rdi
	callq	_CX18_WARN
	movq	%r12, %rdi
	callq	_cx18_firmware_init
	testq	%rax, %rax
	je	LBB0_8
LBB0_5:
	movl	(%r13), %edi
	movq	%r14, %rsi
	callq	_set_bit
	jmp	LBB0_1
LBB0_8:
	movq	_CX18_APU_START@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	orl	(%rbx), %r15d
	movq	%r12, %rdi
	movl	$2, %edx
	movl	%r15d, %ecx
	xorl	%r8d, %r8d
	xorl	%eax, %eax
	callq	_cx18_vapi
	movq	_CX18_APU_RESETAI@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	xorl	%edx, %edx
	xorl	%eax, %eax
	callq	_cx18_vapi
	movq	_CX18_APU_STOP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%rbx), %ecx
	movq	%r12, %rdi
	movl	$1, %edx
	xorl	%eax, %eax
	callq	_cx18_vapi
	movl	12(%r12), %edi
	movq	_core@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_load_fw@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_v4l2_subdev_call
	movq	$0, -48(%rbp)
	movq	_V4L2_TUNER_ANALOG_TV@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -52(%rbp)
	movl	$6400, -56(%rbp)                ## imm = 0x1900
	movl	(%r12), %eax
	movq	_V4L2_STD_NTSC_M_JP@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_10
## %bb.9:
	movl	$1460, -56(%rbp)                ## imm = 0x5B4
	jmp	LBB0_12
LBB0_10:
	movq	_V4L2_STD_NTSC_M@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_12
## %bb.11:
	movl	$1076, -56(%rbp)                ## imm = 0x434
LBB0_12:
	movl	4(%r12), %edx
	leal	1(%rdx), %eax
	movl	%eax, 4(%r12)
	xorl	%ebx, %ebx
	leaq	-64(%rbp), %r14
	xorl	%edi, %edi
	movq	%r14, %rsi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_cx18_s_input
	incl	(%r12)
	movl	8(%r12), %edx
	movq	_V4L2_STD_ALL@GOTPCREL(%rip), %rax
	cmpl	(%rax), %edx
	jne	LBB0_14
## %bb.13:
	movq	_V4L2_STD_NTSC_M@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
LBB0_14:
	xorl	%edi, %edi
	movq	%r14, %rsi
	callq	_cx18_s_std
	leaq	-56(%rbp), %rdx
	xorl	%edi, %edi
	movq	%r14, %rsi
	callq	_cx18_s_frequency
	jmp	LBB0_15
	.cfi_endproc
                                        ## -- End function
	.comm	_CX18_F_I_FAILED,4,2            ## @CX18_F_I_FAILED
	.comm	_ENXIO,4,2                      ## @ENXIO
	.comm	_CX18_F_I_INITED,4,2            ## @CX18_F_I_INITED
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Retry loading firmware\n"

	.comm	_CX18_F_I_LOADED_FW,4,2         ## @CX18_F_I_LOADED_FW
	.comm	_CX18_APU_START,4,2             ## @CX18_APU_START
	.comm	_CX18_APU_ENCODING_METHOD_MPEG,4,2 ## @CX18_APU_ENCODING_METHOD_MPEG
	.comm	_CX18_APU_RESETAI,4,2           ## @CX18_APU_RESETAI
	.comm	_CX18_APU_STOP,4,2              ## @CX18_APU_STOP
	.comm	_core,4,2                       ## @core
	.comm	_load_fw,4,2                    ## @load_fw
	.comm	_V4L2_TUNER_ANALOG_TV,4,2       ## @V4L2_TUNER_ANALOG_TV
	.comm	_V4L2_STD_NTSC_M_JP,4,2         ## @V4L2_STD_NTSC_M_JP
	.comm	_V4L2_STD_NTSC_M,4,2            ## @V4L2_STD_NTSC_M
	.comm	_V4L2_STD_ALL,4,2               ## @V4L2_STD_ALL
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cx18_init_on_first_open        ; -- Begin function cx18_init_on_first_open
	.p2align	2
_cx18_init_on_first_open:               ; @cx18_init_on_first_open
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	mov	x19, x0
	str	x0, [sp, #24]
Lloh0:
	adrp	x21, _CX18_F_I_FAILED@GOTPAGE
Lloh1:
	ldr	x21, [x21, _CX18_F_I_FAILED@GOTPAGEOFF]
	ldr	w0, [x21]
	add	x20, x19, #16
	mov	x1, x20
	bl	_test_bit
	cbz	x0, LBB0_2
LBB0_1:
Lloh2:
	adrp	x8, _ENXIO@GOTPAGE
Lloh3:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_4
LBB0_2:
Lloh5:
	adrp	x8, _CX18_F_I_INITED@GOTPAGE
Lloh6:
	ldr	x8, [x8, _CX18_F_I_INITED@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x8]
	mov	x1, x20
	bl	_test_and_set_bit
	cbz	x0, LBB0_5
LBB0_3:
	mov	w0, #0
LBB0_4:
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_5:
	mov	x0, x19
	bl	_cx18_firmware_init
	cbz	x0, LBB0_7
; %bb.6:
Lloh8:
	adrp	x0, l_.str@PAGE
Lloh9:
	add	x0, x0, l_.str@PAGEOFF
	bl	_CX18_WARN
	mov	x0, x19
	bl	_cx18_firmware_init
	cbnz	x0, LBB0_9
LBB0_7:
Lloh10:
	adrp	x8, _CX18_F_I_LOADED_FW@GOTPAGE
Lloh11:
	ldr	x8, [x8, _CX18_F_I_LOADED_FW@GOTPAGEOFF]
Lloh12:
	ldr	w0, [x8]
	mov	x1, x20
	bl	_set_bit
Lloh13:
	adrp	x23, _CX18_APU_START@GOTPAGE
Lloh14:
	ldr	x23, [x23, _CX18_APU_START@GOTPAGEOFF]
	ldr	w1, [x23]
Lloh15:
	adrp	x22, _CX18_APU_ENCODING_METHOD_MPEG@GOTPAGE
Lloh16:
	ldr	x22, [x22, _CX18_APU_ENCODING_METHOD_MPEG@GOTPAGEOFF]
	ldr	w8, [x22]
	mov	w24, #185
	orr	w8, w8, w24
	stp	x8, xzr, [sp]
	mov	x0, x19
	mov	w2, #2
	bl	_cx18_vapi
Lloh17:
	adrp	x25, _CX18_APU_RESETAI@GOTPAGE
Lloh18:
	ldr	x25, [x25, _CX18_APU_RESETAI@GOTPAGEOFF]
	ldr	w1, [x25]
	mov	x0, x19
	mov	w2, #0
	bl	_cx18_vapi
Lloh19:
	adrp	x26, _CX18_APU_STOP@GOTPAGE
Lloh20:
	ldr	x26, [x26, _CX18_APU_STOP@GOTPAGEOFF]
	ldr	w1, [x26]
	ldr	w8, [x22]
	str	x8, [sp]
	mov	x0, x19
	mov	w2, #1
	bl	_cx18_vapi
	mov	x0, x19
	bl	_cx18_firmware_init
	cbz	x0, LBB0_10
; %bb.8:
Lloh21:
	adrp	x0, l_.str@PAGE
Lloh22:
	add	x0, x0, l_.str@PAGEOFF
	bl	_CX18_WARN
	mov	x0, x19
	bl	_cx18_firmware_init
	cbz	x0, LBB0_10
LBB0_9:
	ldr	w0, [x21]
	mov	x1, x20
	bl	_set_bit
	b	LBB0_1
LBB0_10:
	ldr	w1, [x23]
	ldr	w8, [x22]
	orr	w8, w8, w24
	stp	x8, xzr, [sp]
	mov	x0, x19
	mov	w2, #2
	bl	_cx18_vapi
	ldr	w1, [x25]
	mov	x0, x19
	mov	w2, #0
	bl	_cx18_vapi
	ldr	w1, [x26]
	ldr	w8, [x22]
	str	x8, [sp]
	mov	x0, x19
	mov	w2, #1
	bl	_cx18_vapi
	ldr	w0, [x19, #12]
Lloh23:
	adrp	x8, _core@GOTPAGE
Lloh24:
	ldr	x8, [x8, _core@GOTPAGEOFF]
Lloh25:
	ldr	w1, [x8]
Lloh26:
	adrp	x8, _load_fw@GOTPAGE
Lloh27:
	ldr	x8, [x8, _load_fw@GOTPAGEOFF]
Lloh28:
	ldr	w2, [x8]
	bl	_v4l2_subdev_call
Lloh29:
	adrp	x8, _V4L2_TUNER_ANALOG_TV@GOTPAGE
Lloh30:
	ldr	x8, [x8, _V4L2_TUNER_ANALOG_TV@GOTPAGEOFF]
	str	xzr, [sp, #40]
Lloh31:
	ldr	w8, [x8]
	mov	w9, #6400
	stp	w9, w8, [sp, #32]
	ldr	w8, [x19]
Lloh32:
	adrp	x9, _V4L2_STD_NTSC_M_JP@GOTPAGE
Lloh33:
	ldr	x9, [x9, _V4L2_STD_NTSC_M_JP@GOTPAGEOFF]
Lloh34:
	ldr	w9, [x9]
Lloh35:
	adrp	x20, _V4L2_STD_NTSC_M@GOTPAGE
Lloh36:
	ldr	x20, [x20, _V4L2_STD_NTSC_M@GOTPAGEOFF]
	cmp	w8, w9
	b.ne	LBB0_12
; %bb.11:
	mov	w8, #1460
	b	LBB0_14
LBB0_12:
	ldr	w9, [x20]
	tst	w9, w8
	b.eq	LBB0_15
; %bb.13:
	mov	w8, #1076
LBB0_14:
	str	w8, [sp, #32]
LBB0_15:
	ldr	w2, [x19, #4]
	add	w8, w2, #1
	str	w8, [x19, #4]
	add	x1, sp, #24
	mov	x0, #0
	bl	_cx18_s_input
	ldr	w8, [x19]
	add	w8, w8, #1
	str	w8, [x19]
	ldr	w8, [x19, #8]
Lloh37:
	adrp	x9, _V4L2_STD_ALL@GOTPAGE
Lloh38:
	ldr	x9, [x9, _V4L2_STD_ALL@GOTPAGEOFF]
Lloh39:
	ldr	w9, [x9]
	ldr	w10, [x20]
	cmp	w8, w9
	csel	w2, w10, w8, eq
	add	x1, sp, #24
	mov	x0, #0
	bl	_cx18_s_std
	add	x1, sp, #24
	add	x2, sp, #32
	mov	x0, #0
	bl	_cx18_s_frequency
	b	LBB0_3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.cfi_endproc
                                        ; -- End function
	.comm	_CX18_F_I_FAILED,4,2            ; @CX18_F_I_FAILED
	.comm	_ENXIO,4,2                      ; @ENXIO
	.comm	_CX18_F_I_INITED,4,2            ; @CX18_F_I_INITED
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Retry loading firmware\n"

	.comm	_CX18_F_I_LOADED_FW,4,2         ; @CX18_F_I_LOADED_FW
	.comm	_CX18_APU_START,4,2             ; @CX18_APU_START
	.comm	_CX18_APU_ENCODING_METHOD_MPEG,4,2 ; @CX18_APU_ENCODING_METHOD_MPEG
	.comm	_CX18_APU_RESETAI,4,2           ; @CX18_APU_RESETAI
	.comm	_CX18_APU_STOP,4,2              ; @CX18_APU_STOP
	.comm	_core,4,2                       ; @core
	.comm	_load_fw,4,2                    ; @load_fw
	.comm	_V4L2_TUNER_ANALOG_TV,4,2       ; @V4L2_TUNER_ANALOG_TV
	.comm	_V4L2_STD_NTSC_M_JP,4,2         ; @V4L2_STD_NTSC_M_JP
	.comm	_V4L2_STD_NTSC_M,4,2            ; @V4L2_STD_NTSC_M
	.comm	_V4L2_STD_ALL,4,2               ; @V4L2_STD_ALL
.subsections_via_symbols
