	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cx18_vbi_setup
_cx18_vbi_setup:                        ## @cx18_vbi_setup
	.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	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -40(%rbp)
	movq	8(%rdi), %rbx
	movq	%rbx, %rdi
	callq	_cx18_raw_vbi
	movl	%eax, %r12d
	movq	_CX2341X_MBOX_MAX_DATA@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	shlq	$2, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r14
	cmpq	$0, (%rbx)
	je	LBB0_2
## %bb.1:
	movl	$12, 8(%rbx)
	movq	16(%rbx), %rax
	movl	$10, (%rax)
	movl	$273, %ecx                      ## imm = 0x111
	jmp	LBB0_3
LBB0_2:
	movl	$18, 8(%rbx)
	movq	16(%rbx), %rax
	movl	$6, (%rax)
	movl	$318, %ecx                      ## imm = 0x13E
LBB0_3:
	movl	%ecx, 4(%rax)
	movl	32(%rbx), %edi
	movq	_vbi@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	testl	%r12d, %r12d
	je	LBB0_5
## %bb.4:
	movq	_s_raw_fmt@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	28(%rbx), %rcx
	callq	_v4l2_subdev_call
	movl	8(%rbx), %eax
	movl	(%r15), %esi
	movl	%esi, (%r14)
	movl	%eax, %edx
	shll	$16, %edx
	orl	%eax, %edx
	movq	_VBI_ACTIVE_SAMPLES@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	$812683472, %eax                ## imm = 0x307090D0
	movl	$543170656, %r9d                ## imm = 0x20602060
	jmp	LBB0_6
LBB0_5:
	movq	_s_sliced_fmt@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	24(%rbx), %rcx
	callq	_v4l2_subdev_call
	cmpq	$0, (%rbx)
	movl	(%r15), %esi
	movl	$1441814, %eax                  ## imm = 0x160016
	movl	$1179666, %edx                  ## imm = 0x120012
	cmovel	%eax, %edx
	movq	_VBI_HBLANK_SAMPLES_60HZ@GOTPCREL(%rip), %rax
	cmoveq	_VBI_HBLANK_SAMPLES_50HZ@GOTPCREL(%rip), %rax
	movl	%esi, (%r14)
	movl	(%rax), %ecx
	movl	$-1595891488, %eax              ## imm = 0xA0E0A0E0
	movl	$-1326403344, %r9d              ## imm = 0xB0F0B0F0
LBB0_6:
	movl	%edx, 4(%r14)
	movl	%ecx, 8(%r14)
	movl	$1, 12(%r14)
	movl	%r9d, 16(%r14)
	movl	%eax, 20(%r14)
	subq	$8, %rsp
	leaq	L_.str(%rip), %rdi
	movl	$1, %r8d
	pushq	%rax
	callq	_CX18_DEBUG_INFO
	addq	$16, %rsp
	movq	_CX18_CPU_SET_RAW_VBI_PARAM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	movl	$6, %edx
	movq	%r14, %rcx
	callq	_cx18_api
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-40(%rbp), %rax
	jne	LBB0_8
## %bb.7:
	leaq	-32(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_CX2341X_MBOX_MAX_DATA,4,2      ## @CX2341X_MBOX_MAX_DATA
	.comm	_vbi,4,2                        ## @vbi
	.comm	_s_raw_fmt,4,2                  ## @s_raw_fmt
	.comm	_s_sliced_fmt,4,2               ## @s_sliced_fmt
	.comm	_VBI_ACTIVE_SAMPLES,4,2         ## @VBI_ACTIVE_SAMPLES
	.comm	_VBI_HBLANK_SAMPLES_60HZ,4,2    ## @VBI_HBLANK_SAMPLES_60HZ
	.comm	_VBI_HBLANK_SAMPLES_50HZ,4,2    ## @VBI_HBLANK_SAMPLES_50HZ
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Setup VBI h: %d lines %x bpl %d fr %d %x %x\n"

	.comm	_CX18_CPU_SET_RAW_VBI_PARAM,4,2 ## @CX18_CPU_SET_RAW_VBI_PARAM
	.no_dead_strip	_cx18_vbi_setup
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cx18_vbi_setup
_cx18_vbi_setup:                        ; @cx18_vbi_setup
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	sub	sp, sp, #16
	mov	x21, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-40]
	ldr	x19, [x0, #8]
	mov	x0, x19
	bl	_cx18_raw_vbi
Lloh3:
	adrp	x8, _CX2341X_MBOX_MAX_DATA@GOTPAGE
Lloh4:
	ldr	x8, [x8, _CX2341X_MBOX_MAX_DATA@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	lsl	x8, x8, #2
	mov	x9, x8
Lloh6:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh7:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x8, x8, #15
	and	x8, x8, #0x7fffffff0
	sub	x20, x9, x8
	mov	sp, x20
	ldr	x8, [x19]
	cbz	x8, LBB0_2
; %bb.1:
	mov	w8, #12
	str	w8, [x19, #8]
	ldr	x8, [x19, #16]
	mov	w9, #10
	str	w9, [x8]
	mov	w9, #273
	b	LBB0_3
LBB0_2:
	mov	w8, #18
	str	w8, [x19, #8]
	ldr	x8, [x19, #16]
	mov	w9, #6
	str	w9, [x8]
	mov	w9, #318
LBB0_3:
	str	w9, [x8, #4]
	ldr	w8, [x19, #32]
Lloh8:
	adrp	x9, _vbi@GOTPAGE
Lloh9:
	ldr	x9, [x9, _vbi@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x9]
	cbz	w0, LBB0_5
; %bb.4:
Lloh11:
	adrp	x9, _s_raw_fmt@GOTPAGE
Lloh12:
	ldr	x9, [x9, _s_raw_fmt@GOTPAGEOFF]
Lloh13:
	ldr	w2, [x9]
	add	x3, x19, #28
	mov	x0, x8
	bl	_v4l2_subdev_call
	ldr	w8, [x19, #8]
	ldr	w1, [x21]
	str	w1, [x20]
	orr	w2, w8, w8, lsl #16
Lloh14:
	adrp	x8, _VBI_ACTIVE_SAMPLES@GOTPAGE
Lloh15:
	ldr	x8, [x8, _VBI_ACTIVE_SAMPLES@GOTPAGEOFF]
Lloh16:
	ldr	w3, [x8]
	mov	w6, #37072
	movk	w6, #12400, lsl #16
	mov	w5, #8288
	movk	w5, #8288, lsl #16
	b	LBB0_6
LBB0_5:
Lloh17:
	adrp	x9, _s_sliced_fmt@GOTPAGE
Lloh18:
	ldr	x9, [x9, _s_sliced_fmt@GOTPAGEOFF]
Lloh19:
	ldr	w2, [x9]
	add	x3, x19, #24
	mov	x0, x8
	bl	_v4l2_subdev_call
	ldr	x8, [x19]
	ldr	w1, [x21]
	str	w1, [x20]
	mov	w9, #18
	movk	w9, #18, lsl #16
	mov	w10, #22
	movk	w10, #22, lsl #16
Lloh20:
	adrp	x11, _VBI_HBLANK_SAMPLES_60HZ@GOTPAGE
Lloh21:
	ldr	x11, [x11, _VBI_HBLANK_SAMPLES_60HZ@GOTPAGEOFF]
Lloh22:
	adrp	x12, _VBI_HBLANK_SAMPLES_50HZ@GOTPAGE
Lloh23:
	ldr	x12, [x12, _VBI_HBLANK_SAMPLES_50HZ@GOTPAGEOFF]
	cmp	x8, #0
	csel	x8, x12, x11, eq
	csel	w2, w10, w9, eq
	ldr	w3, [x8]
	mov	w6, #41184
	movk	w6, #41184, lsl #16
	mov	w5, #45296
	movk	w5, #45296, lsl #16
LBB0_6:
	stp	w2, w3, [x20, #4]
	mov	w8, #1
	stp	w8, w5, [x20, #12]
	str	w6, [x20, #20]
Lloh24:
	adrp	x0, l_.str@PAGE
Lloh25:
	add	x0, x0, l_.str@PAGEOFF
	mov	w4, #1
	bl	_CX18_DEBUG_INFO
Lloh26:
	adrp	x8, _CX18_CPU_SET_RAW_VBI_PARAM@GOTPAGE
Lloh27:
	ldr	x8, [x8, _CX18_CPU_SET_RAW_VBI_PARAM@GOTPAGEOFF]
Lloh28:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #6
	mov	x3, x20
	bl	_cx18_api
	ldur	x8, [x29, #-40]
Lloh29:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh30:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh31:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_8
; %bb.7:
	sub	sp, x29, #32
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_8:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpAdd	Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_CX2341X_MBOX_MAX_DATA,4,2      ; @CX2341X_MBOX_MAX_DATA
	.comm	_vbi,4,2                        ; @vbi
	.comm	_s_raw_fmt,4,2                  ; @s_raw_fmt
	.comm	_s_sliced_fmt,4,2               ; @s_sliced_fmt
	.comm	_VBI_ACTIVE_SAMPLES,4,2         ; @VBI_ACTIVE_SAMPLES
	.comm	_VBI_HBLANK_SAMPLES_60HZ,4,2    ; @VBI_HBLANK_SAMPLES_60HZ
	.comm	_VBI_HBLANK_SAMPLES_50HZ,4,2    ; @VBI_HBLANK_SAMPLES_50HZ
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Setup VBI h: %d lines %x bpl %d fr %d %x %x\n"

	.comm	_CX18_CPU_SET_RAW_VBI_PARAM,4,2 ; @CX18_CPU_SET_RAW_VBI_PARAM
	.no_dead_strip	_cx18_vbi_setup
.subsections_via_symbols
