	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_medusa_video_init              ## -- Begin function medusa_video_init
	.p2align	4, 0x90
_medusa_video_init:                     ## @medusa_video_init
	.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
	subq	$16, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %r14
	movl	$0, -20(%rbp)
	movq	8(%rdi), %rdi
	movq	_MON_A_CTRL@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	leaq	-20(%rbp), %rdx
	callq	_cx25821_i2c_read
	andl	$-3841, %eax                    ## imm = 0xF0FF
	movq	8(%r14), %rdi
	movl	(%rbx), %esi
	movl	%eax, %edx
	callq	_cx25821_i2c_write
	testl	%eax, %eax
	js	LBB0_10
## %bb.1:
	movq	8(%r14), %rdi
	movl	(%rbx), %esi
	leaq	-20(%rbp), %rdx
	callq	_cx25821_i2c_read
	andl	$-33, %eax
	movq	8(%r14), %rdi
	movl	(%rbx), %esi
	movl	%eax, %edx
	callq	_cx25821_i2c_write
	testl	%eax, %eax
	js	LBB0_10
## %bb.2:
	cmpl	$0, (%r14)
	jle	LBB0_5
## %bb.3:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r14, %rdi
	movl	%ebx, %esi
	xorl	%edx, %edx
	callq	_medusa_set_decoderduration
	incl	%ebx
	cmpl	(%r14), %ebx
	jl	LBB0_4
LBB0_5:
	movq	8(%r14), %rdi
	movq	_DENC_AB_CTRL@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	leaq	-20(%rbp), %rdx
	callq	_cx25821_i2c_read
                                        ## kill: def $eax killed $eax def $rax
	andl	$-9371792, %eax                 ## imm = 0xFF70FF70
	leal	589832(%rax), %edx
	movq	8(%r14), %rdi
	movl	(%rbx), %esi
	callq	_cx25821_i2c_write
	testl	%eax, %eax
	js	LBB0_10
## %bb.6:
	movq	8(%r14), %rdi
	movq	_BYP_AB_CTRL@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	leaq	-20(%rbp), %rdx
	callq	_cx25821_i2c_read
	orl	$262400, %eax                   ## imm = 0x40100
	movq	8(%r14), %rdi
	movl	(%rbx), %esi
	movl	%eax, %edx
	callq	_cx25821_i2c_write
	testl	%eax, %eax
	js	LBB0_10
## %bb.7:
	movq	8(%r14), %rdi
	movq	_AFE_AB_DIAG_CTRL@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	leaq	-20(%rbp), %rdx
	callq	_cx25821_i2c_read
                                        ## kill: def $eax killed $eax def $rax
	andl	$-2080374785, %eax              ## imm = 0x83FFFFFF
	movq	8(%r14), %rdi
	movl	(%rbx), %esi
	leal	268435456(%rax), %edx
	callq	_cx25821_i2c_write
	testl	%eax, %eax
	js	LBB0_10
## %bb.8:
	movq	8(%r14), %rdi
	movq	_PIN_OE_CTRL@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	leaq	-20(%rbp), %rdx
	callq	_cx25821_i2c_read
                                        ## kill: def $eax killed $eax def $rax
	andl	$-17760768, %eax                ## imm = 0xFEF0FE00
	movl	(%r14), %ecx
	movq	_MAX_DECODERS@GOTPCREL(%rip), %rdx
	cmpl	(%rdx), %ecx
	movl	$16777720, %ecx                 ## imm = 0x10001F8
	movl	$17760520, %edx                 ## imm = 0x10F0108
	cmovel	%ecx, %edx
	addl	%eax, %edx
	addl	$7, %edx
	movq	8(%r14), %rdi
	movl	(%rbx), %esi
	callq	_cx25821_i2c_write
	testl	%eax, %eax
	js	LBB0_10
## %bb.9:
	movq	%r14, %rdi
	callq	_medusa_set_videostandard
LBB0_10:
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MON_A_CTRL,4,2                 ## @MON_A_CTRL
	.comm	_DENC_AB_CTRL,4,2               ## @DENC_AB_CTRL
	.comm	_BYP_AB_CTRL,4,2                ## @BYP_AB_CTRL
	.comm	_AFE_AB_DIAG_CTRL,4,2           ## @AFE_AB_DIAG_CTRL
	.comm	_PIN_OE_CTRL,4,2                ## @PIN_OE_CTRL
	.comm	_MAX_DECODERS,4,2               ## @MAX_DECODERS
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_medusa_video_init              ; -- Begin function medusa_video_init
	.p2align	2
_medusa_video_init:                     ; @medusa_video_init
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.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
	mov	x19, x0
	str	wzr, [sp, #12]
	ldr	x0, [x0, #8]
Lloh0:
	adrp	x20, _MON_A_CTRL@GOTPAGE
Lloh1:
	ldr	x20, [x20, _MON_A_CTRL@GOTPAGEOFF]
	ldr	w1, [x20]
	add	x2, sp, #12
	bl	_cx25821_i2c_read
	and	w2, w0, #0xfffff0ff
	ldr	x0, [x19, #8]
	ldr	w1, [x20]
	bl	_cx25821_i2c_write
	tbnz	w0, #31, LBB0_10
; %bb.1:
	ldr	x0, [x19, #8]
	ldr	w1, [x20]
	add	x2, sp, #12
	bl	_cx25821_i2c_read
	and	w2, w0, #0xffffffdf
	ldr	x0, [x19, #8]
	ldr	w1, [x20]
	bl	_cx25821_i2c_write
	tbnz	w0, #31, LBB0_10
; %bb.2:
	ldr	w8, [x19]
	cmp	w8, #1
	b.lt	LBB0_5
; %bb.3:
	mov	w20, #0
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	mov	x1, x20
	mov	w2, #0
	bl	_medusa_set_decoderduration
	add	w20, w20, #1
	ldr	w8, [x19]
	cmp	w20, w8
	b.lt	LBB0_4
LBB0_5:
	ldr	x0, [x19, #8]
Lloh2:
	adrp	x20, _DENC_AB_CTRL@GOTPAGE
Lloh3:
	ldr	x20, [x20, _DENC_AB_CTRL@GOTPAGEOFF]
	ldr	w1, [x20]
	add	x2, sp, #12
	bl	_cx25821_i2c_read
	mov	w8, #65392
	movk	w8, #65392, lsl #16
	and	w8, w0, w8
	mov	w9, #8
	movk	w9, #9, lsl #16
	orr	w2, w8, w9
	ldr	x0, [x19, #8]
	ldr	w1, [x20]
	bl	_cx25821_i2c_write
	tbnz	w0, #31, LBB0_10
; %bb.6:
	ldr	x0, [x19, #8]
Lloh4:
	adrp	x20, _BYP_AB_CTRL@GOTPAGE
Lloh5:
	ldr	x20, [x20, _BYP_AB_CTRL@GOTPAGEOFF]
	ldr	w1, [x20]
	add	x2, sp, #12
	bl	_cx25821_i2c_read
	mov	w8, #256
	movk	w8, #4, lsl #16
	orr	w2, w0, w8
	ldr	x0, [x19, #8]
	ldr	w1, [x20]
	bl	_cx25821_i2c_write
	tbnz	w0, #31, LBB0_10
; %bb.7:
	ldr	x0, [x19, #8]
Lloh6:
	adrp	x20, _AFE_AB_DIAG_CTRL@GOTPAGE
Lloh7:
	ldr	x20, [x20, _AFE_AB_DIAG_CTRL@GOTPAGEOFF]
	ldr	w1, [x20]
	add	x2, sp, #12
	bl	_cx25821_i2c_read
	and	w8, w0, #0x83ffffff
	ldr	x0, [x19, #8]
	ldr	w1, [x20]
	orr	w2, w8, #0x10000000
	bl	_cx25821_i2c_write
	tbnz	w0, #31, LBB0_10
; %bb.8:
	ldr	x0, [x19, #8]
Lloh8:
	adrp	x20, _PIN_OE_CTRL@GOTPAGE
Lloh9:
	ldr	x20, [x20, _PIN_OE_CTRL@GOTPAGEOFF]
	ldr	w1, [x20]
	add	x2, sp, #12
	bl	_cx25821_i2c_read
	mov	w8, #65024
	movk	w8, #65264, lsl #16
	and	w8, w0, w8
	ldr	w9, [x19]
Lloh10:
	adrp	x10, _MAX_DECODERS@GOTPAGE
Lloh11:
	ldr	x10, [x10, _MAX_DECODERS@GOTPAGEOFF]
Lloh12:
	ldr	w10, [x10]
	mov	w11, #264
	movk	w11, #271, lsl #16
	mov	w12, #504
	movk	w12, #256, lsl #16
	cmp	w9, w10
	csel	w9, w12, w11, eq
	orr	w8, w8, w9
	orr	w2, w8, #0x7
	ldr	x0, [x19, #8]
	ldr	w1, [x20]
	bl	_cx25821_i2c_write
	tbnz	w0, #31, LBB0_10
; %bb.9:
	mov	x0, x19
	bl	_medusa_set_videostandard
LBB0_10:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_MON_A_CTRL,4,2                 ; @MON_A_CTRL
	.comm	_DENC_AB_CTRL,4,2               ; @DENC_AB_CTRL
	.comm	_BYP_AB_CTRL,4,2                ; @BYP_AB_CTRL
	.comm	_AFE_AB_DIAG_CTRL,4,2           ; @AFE_AB_DIAG_CTRL
	.comm	_PIN_OE_CTRL,4,2                ; @PIN_OE_CTRL
	.comm	_MAX_DECODERS,4,2               ; @MAX_DECODERS
.subsections_via_symbols
