	.file	"extr_cx25821-medusa-video.c_medusa_initialize_ntsc.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	medusa_initialize_ntsc, @function
medusa_initialize_ntsc:
.LFB0:
	.cfi_startproc
	endbr64
	push	r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	push	r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	push	rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	mov	rbx, rdi
	sub	rsp, 24
	.cfi_def_cfa_offset 64
	mov	edx, DWORD PTR MAX_DECODERS[rip]
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 8[rsp], rax
	xor	eax, eax
	lea	r12, 4[rsp]
	mov	DWORD PTR 4[rsp], 0
	test	edx, edx
	jle	.L2
	xor	r13d, r13d
	lea	r12, 4[rsp]
	.p2align 4,,10
	.p2align 3
.L3:
	mov	rsi, QWORD PTR MODE_CTRL[rip]
	mov	rbp, r13
	mov	rdi, QWORD PTR [rbx]
	mov	rdx, r12
	sal	rbp, 9
	add	rsi, rbp
	call	cx25821_i2c_read@PLT
	mov	rsi, QWORD PTR MODE_CTRL[rip]
	mov	rdi, QWORD PTR [rbx]
	and	eax, -16
	mov	edx, eax
	add	rsi, rbp
	or	edx, 65537
	call	cx25821_i2c_write@PLT
	mov	rsi, QWORD PTR HORIZ_TIM_CTRL[rip]
	mov	rdi, QWORD PTR [rbx]
	mov	rdx, r12
	add	rsi, rbp
	call	cx25821_i2c_read@PLT
	mov	rsi, QWORD PTR HORIZ_TIM_CTRL[rip]
	mov	rdi, QWORD PTR [rbx]
	and	eax, 12585984
	mov	edx, eax
	add	rsi, rbp
	or	edx, 1630339188
	call	cx25821_i2c_write@PLT
	mov	rsi, QWORD PTR VERT_TIM_CTRL[rip]
	mov	rdi, QWORD PTR [rbx]
	mov	rdx, r12
	add	rsi, rbp
	call	cx25821_i2c_read@PLT
	mov	rsi, QWORD PTR VERT_TIM_CTRL[rip]
	mov	rdi, QWORD PTR [rbx]
	and	eax, 12585984
	mov	edx, eax
	add	rsi, rbp
	or	edx, 471728154
	call	cx25821_i2c_write@PLT
	mov	rsi, QWORD PTR SC_STEP_SIZE[rip]
	mov	rdi, QWORD PTR [rbx]
	mov	edx, 1138753536
	add	rsi, rbp
	call	cx25821_i2c_write@PLT
	mov	rsi, QWORD PTR OUT_CTRL_NS[rip]
	mov	rdi, QWORD PTR [rbx]
	mov	rdx, r12
	add	rsi, rbp
	call	cx25821_i2c_read@PLT
	mov	rsi, QWORD PTR OUT_CTRL_NS[rip]
	mov	rdi, QWORD PTR [rbx]
	or	eax, 262144
	add	rsi, rbp
	mov	edx, eax
	call	cx25821_i2c_write@PLT
	mov	rsi, QWORD PTR OUT_CTRL1[rip]
	mov	rdi, QWORD PTR [rbx]
	mov	rdx, r12
	add	rsi, rbp
	call	cx25821_i2c_read@PLT
	mov	rsi, QWORD PTR OUT_CTRL1[rip]
	mov	rdi, QWORD PTR [rbx]
	or	eax, 262144
	add	rsi, rbp
	mov	edx, eax
	call	cx25821_i2c_write@PLT
	mov	rsi, QWORD PTR MISC_TIM_CTRL[rip]
	mov	rdi, QWORD PTR [rbx]
	mov	rdx, r12
	add	rsi, rbp
	call	cx25821_i2c_read@PLT
	mov	esi, 14
	mov	edi, eax
	call	setBitAtPos@PLT
	mov	esi, 15
	mov	edi, eax
	call	clearBitAtPos@PLT
	mov	rsi, QWORD PTR MISC_TIM_CTRL[rip]
	mov	rdi, QWORD PTR [rbx]
	mov	edx, eax
	add	rsi, rbp
	call	cx25821_i2c_write@PLT
	mov	rsi, QWORD PTR DFE_CTRL1[rip]
	mov	rdi, QWORD PTR [rbx]
	mov	rdx, r12
	add	rsi, rbp
	call	cx25821_i2c_read@PLT
	mov	esi, 29
	mov	edi, eax
	call	clearBitAtPos@PLT
	mov	rsi, QWORD PTR DFE_CTRL1[rip]
	mov	rdi, QWORD PTR [rbx]
	mov	edx, eax
	add	rsi, rbp
	call	cx25821_i2c_write@PLT
	mov	esi, r13d
	mov	edx, 1
	mov	rdi, rbx
	call	medusa_enable_bluefield_output@PLT
	add	r13, 1
	cmp	DWORD PTR MAX_DECODERS[rip], r13d
	jg	.L3
.L2:
	mov	eax, DWORD PTR MAX_ENCODERS[rip]
	test	eax, eax
	jle	.L4
	xor	r13d, r13d
	.p2align 4,,10
	.p2align 3
.L5:
	mov	rsi, QWORD PTR DENC_A_REG_1[rip]
	mov	rbp, r13
	mov	rdi, QWORD PTR [rbx]
	mov	rdx, r12
	sal	rbp, 8
	add	rsi, rbp
	call	cx25821_i2c_read@PLT
	mov	rsi, QWORD PTR DENC_A_REG_1[rip]
	mov	rdi, QWORD PTR [rbx]
	and	eax, -268370944
	mov	edx, eax
	add	rsi, rbp
	or	edx, 112460496
	call	cx25821_i2c_write@PLT
	mov	rsi, QWORD PTR DENC_A_REG_2[rip]
	mov	rdi, QWORD PTR [rbx]
	mov	rdx, r12
	add	rsi, rbp
	call	cx25821_i2c_read@PLT
	mov	rsi, QWORD PTR DENC_A_REG_2[rip]
	mov	rdi, QWORD PTR [rbx]
	and	eax, -16777216
	mov	edx, eax
	add	rsi, rbp
	or	edx, 8294484
	call	cx25821_i2c_write@PLT
	mov	rsi, QWORD PTR DENC_A_REG_3[rip]
	mov	rdi, QWORD PTR [rbx]
	mov	rdx, r12
	add	rsi, rbp
	call	cx25821_i2c_read@PLT
	mov	rsi, QWORD PTR DENC_A_REG_3[rip]
	mov	rdi, QWORD PTR [rbx]
	and	eax, -67043840
	mov	edx, eax
	add	rsi, rbp
	or	edx, 15466736
	call	cx25821_i2c_write@PLT
	mov	rsi, QWORD PTR DENC_A_REG_4[rip]
	mov	rdi, QWORD PTR [rbx]
	mov	rdx, r12
	add	rsi, rbp
	call	cx25821_i2c_read@PLT
	mov	rsi, QWORD PTR DENC_A_REG_4[rip]
	mov	rdi, QWORD PTR [rbx]
	and	eax, 16580607
	mov	edx, eax
	add	rsi, rbp
	or	edx, 318898176
	call	cx25821_i2c_write@PLT
	mov	rsi, QWORD PTR DENC_A_REG_5[rip]
	mov	rdi, QWORD PTR [rbx]
	mov	rdx, r12
	add	rsi, rbp
	call	cx25821_i2c_read@PLT
	mov	rsi, QWORD PTR DENC_A_REG_5[rip]
	mov	rdi, QWORD PTR [rbx]
	xor	ax, ax
	mov	edx, eax
	add	rsi, rbp
	or	edx, 58741
	call	cx25821_i2c_write@PLT
	mov	rsi, QWORD PTR DENC_A_REG_6[rip]
	mov	rdi, QWORD PTR [rbx]
	mov	edx, 10127809
	add	rsi, rbp
	call	cx25821_i2c_write@PLT
	mov	rsi, QWORD PTR DENC_A_REG_7[rip]
	mov	rdi, QWORD PTR [rbx]
	add	r13, 1
	mov	edx, 569408543
	add	rsi, rbp
	call	cx25821_i2c_write@PLT
	cmp	DWORD PTR MAX_ENCODERS[rip], r13d
	jg	.L5
.L4:
	mov	rsi, QWORD PTR HSCALE_CTRL[rip]
	mov	rdi, QWORD PTR [rbx]
	xor	edx, edx
	call	cx25821_i2c_write@PLT
	mov	rsi, QWORD PTR VSCALE_CTRL[rip]
	mov	rdi, QWORD PTR [rbx]
	xor	edx, edx
	call	cx25821_i2c_write@PLT
	mov	rsi, QWORD PTR BYP_AB_CTRL[rip]
	mov	rdi, QWORD PTR [rbx]
	mov	rdx, r12
	call	cx25821_i2c_read@PLT
	mov	rsi, QWORD PTR BYP_AB_CTRL[rip]
	mov	rdi, QWORD PTR [rbx]
	or	eax, 524800
	mov	edx, eax
	call	cx25821_i2c_write@PLT
	mov	rcx, QWORD PTR 8[rsp]
	xor	rcx, QWORD PTR fs:40
	jne	.L13
	add	rsp, 24
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
.L13:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	medusa_initialize_ntsc, .-medusa_initialize_ntsc
	.comm	VSCALE_CTRL,8,8
	.comm	VERT_TIM_CTRL,8,8
	.comm	SC_STEP_SIZE,8,8
	.comm	OUT_CTRL_NS,8,8
	.comm	OUT_CTRL1,8,8
	.comm	MODE_CTRL,8,8
	.comm	MISC_TIM_CTRL,8,8
	.comm	MAX_ENCODERS,4,4
	.comm	MAX_DECODERS,4,4
	.comm	HSCALE_CTRL,8,8
	.comm	HORIZ_TIM_CTRL,8,8
	.comm	DFE_CTRL1,8,8
	.comm	DENC_A_REG_7,8,8
	.comm	DENC_A_REG_6,8,8
	.comm	DENC_A_REG_5,8,8
	.comm	DENC_A_REG_4,8,8
	.comm	DENC_A_REG_3,8,8
	.comm	DENC_A_REG_2,8,8
	.comm	DENC_A_REG_1,8,8
	.comm	BYP_AB_CTRL,8,8
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_cx25821-medusa-video.c_medusa_initialize_ntsc.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	medusa_initialize_ntsc, %function
medusa_initialize_ntsc:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	mov	r7, #0
	ldr	r3, .L14
	ldr	r2, .L14+4
	ldr	r3, [r3]
	sub	sp, sp, #12
	cmp	r3, r7
	ldr	r2, [r2]
	str	r2, [sp, #4]
	mov	r2,#0
	mov	r4, r0
	movle	r6, sp
	str	r7, [sp]
	ble	.L2
	mov	r6, sp
	ldr	fp, .L14+8
	ldr	r10, .L14+12
	ldr	r9, .L14+16
	ldr	r8, .L14+20
.L3:
	ldr	r5, .L14+24
	mov	r2, r6
	ldr	r1, [r5]
	ldr	r0, [r4]
	add	r1, r1, r7, lsl #9
	bl	cx25821_i2c_read
	ldr	r1, [r5]
	bic	r2, r0, #15
	lsl	r5, r7, #9
	orr	r2, r2, #65536
	orr	r2, r2, #1
	add	r1, r5, r1
	ldr	r0, [r4]
	bl	cx25821_i2c_write
	ldr	r1, [fp]
	mov	r2, r6
	add	r1, r5, r1
	ldr	r0, [r4]
	bl	cx25821_i2c_read
	ldr	r3, .L14+28
	ldr	r1, [fp]
	and	r2, r0, r3
	orr	r2, r2, #1627389952
	orr	r2, r2, #2949120
	orr	r2, r2, #116
	add	r1, r5, r1
	ldr	r0, [r4]
	bl	cx25821_i2c_write
	ldr	r1, [r10]
	mov	r2, r6
	add	r1, r5, r1
	ldr	r0, [r4]
	bl	cx25821_i2c_read
	ldr	r3, .L14+28
	ldr	r1, [r10]
	and	r2, r0, r3
	orr	r2, r2, #469762048
	orr	r2, r2, #1966080
	orr	r2, r2, #26
	add	r1, r5, r1
	ldr	r0, [r4]
	bl	cx25821_i2c_write
	ldr	r3, .L14+32
	ldr	r2, .L14+36
	ldr	r1, [r3]
	ldr	r0, [r4]
	add	r1, r5, r1
	bl	cx25821_i2c_write
	ldr	r1, [r9]
	mov	r2, r6
	add	r1, r5, r1
	ldr	r0, [r4]
	bl	cx25821_i2c_read
	ldr	r1, [r9]
	orr	r2, r0, #262144
	add	r1, r5, r1
	ldr	r0, [r4]
	bl	cx25821_i2c_write
	ldr	r3, .L14+40
	mov	r2, r6
	ldr	r1, [r3]
	ldr	r0, [r4]
	add	r1, r5, r1
	bl	cx25821_i2c_read
	ldr	r3, .L14+40
	orr	r2, r0, #262144
	ldr	r1, [r3]
	ldr	r0, [r4]
	add	r1, r5, r1
	bl	cx25821_i2c_write
	ldr	r3, .L14+44
	mov	r2, r6
	ldr	r1, [r3]
	ldr	r0, [r4]
	add	r1, r5, r1
	bl	cx25821_i2c_read
	mov	r1, #14
	bl	setBitAtPos
	mov	r1, #15
	bl	clearBitAtPos
	ldr	r3, .L14+44
	mov	r2, r0
	ldr	r1, [r3]
	ldr	r0, [r4]
	add	r1, r5, r1
	bl	cx25821_i2c_write
	ldr	r1, [r8]
	mov	r2, r6
	add	r1, r5, r1
	ldr	r0, [r4]
	bl	cx25821_i2c_read
	mov	r1, #29
	bl	clearBitAtPos
	ldr	r1, [r8]
	mov	r2, r0
	add	r1, r5, r1
	ldr	r0, [r4]
	bl	cx25821_i2c_write
	mov	r1, r7
	mov	r2, #1
	mov	r0, r4
	bl	medusa_enable_bluefield_output
	ldr	r3, .L14
	add	r7, r7, #1
	ldr	r3, [r3]
	cmp	r3, r7
	bgt	.L3
.L2:
	ldr	r3, .L14+48
	ldr	r2, [r3]
	cmp	r2, #0
	ble	.L4
	mov	r7, #0
	ldr	fp, .L14+52
	ldr	r10, .L14+56
	ldr	r9, .L14+60
	ldr	r8, .L14+64
.L5:
	ldr	r5, .L14+68
	mov	r2, r6
	ldr	r1, [r5]
	ldr	r0, [r4]
	add	r1, r1, r7, lsl #8
	bl	cx25821_i2c_read
	ldr	r2, .L14+72
	ldr	r1, [r5]
	and	r2, r0, r2
	orr	r2, r2, #112197632
	lsl	r5, r7, #8
	orr	r2, r2, #262144
	orr	r2, r2, #720
	add	r1, r5, r1
	ldr	r0, [r4]
	bl	cx25821_i2c_write
	ldr	r1, [fp]
	mov	r2, r6
	add	r1, r5, r1
	ldr	r0, [r4]
	bl	cx25821_i2c_read
	and	r2, r0, #-16777216
	ldr	r1, [fp]
	orr	r2, r2, #8257536
	orr	r2, r2, #36864
	orr	r2, r2, #84
	add	r1, r5, r1
	ldr	r0, [r4]
	bl	cx25821_i2c_write
	ldr	r1, [r10]
	mov	r2, r6
	add	r1, r5, r1
	ldr	r0, [r4]
	bl	cx25821_i2c_read
	ldr	r2, .L14+76
	ldr	r1, [r10]
	and	r2, r0, r2
	orr	r2, r2, #15466496
	orr	r2, r2, #240
	add	r1, r5, r1
	ldr	r0, [r4]
	bl	cx25821_i2c_write
	ldr	r1, [r9]
	mov	r2, r6
	add	r1, r5, r1
	ldr	r0, [r4]
	bl	cx25821_i2c_read
	bic	r2, r0, #-16777216
	ldr	r1, [r9]
	bic	r2, r2, #196608
	orr	r2, r2, #318767104
	orr	r2, r2, #131072
	add	r1, r5, r1
	ldr	r0, [r4]
	bl	cx25821_i2c_write
	ldr	r1, [r8]
	mov	r2, r6
	add	r1, r5, r1
	ldr	r0, [r4]
	bl	cx25821_i2c_read
	lsr	r2, r0, #16
	ldr	r1, [r8]
	lsl	r2, r2, #16
	orr	r2, r2, #58624
	orr	r2, r2, #117
	add	r1, r5, r1
	ldr	r0, [r4]
	bl	cx25821_i2c_write
	ldr	r3, .L14+80
	ldr	r2, .L14+84
	ldr	r1, [r3]
	ldr	r0, [r4]
	add	r1, r5, r1
	bl	cx25821_i2c_write
	ldr	r3, .L14+88
	ldr	r2, .L14+92
	ldr	r1, [r3]
	ldr	r0, [r4]
	add	r1, r5, r1
	bl	cx25821_i2c_write
	ldr	r3, .L14+48
	add	r7, r7, #1
	ldr	r2, [r3]
	cmp	r2, r7
	bgt	.L5
.L4:
	ldr	r3, .L14+96
	mov	r2, #0
	ldr	r1, [r3]
	ldr	r0, [r4]
	bl	cx25821_i2c_write
	ldr	r3, .L14+100
	ldr	r5, .L14+104
	ldr	r1, [r3]
	mov	r2, #0
	ldr	r0, [r4]
	bl	cx25821_i2c_write
	mov	r2, r6
	ldr	r1, [r5]
	ldr	r0, [r4]
	bl	cx25821_i2c_read
	orr	r2, r0, #524288
	orr	r2, r2, #512
	ldr	r1, [r5]
	ldr	r0, [r4]
	bl	cx25821_i2c_write
	ldr	r3, .L14+4
	ldr	r2, [r3]
	ldr	r3, [sp, #4]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L13
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L13:
	bl	__stack_chk_fail
.L15:
	.align	2
.L14:
	.word	MAX_DECODERS
	.word	.LC0
	.word	HORIZ_TIM_CTRL
	.word	VERT_TIM_CTRL
	.word	OUT_CTRL_NS
	.word	DFE_CTRL1
	.word	MODE_CTRL
	.word	12585984
	.word	SC_STEP_SIZE
	.word	1138753536
	.word	OUT_CTRL1
	.word	MISC_TIM_CTRL
	.word	MAX_ENCODERS
	.word	DENC_A_REG_2
	.word	DENC_A_REG_3
	.word	DENC_A_REG_4
	.word	DENC_A_REG_5
	.word	DENC_A_REG_1
	.word	-268370944
	.word	-67043840
	.word	DENC_A_REG_6
	.word	10127809
	.word	DENC_A_REG_7
	.word	569408543
	.word	HSCALE_CTRL
	.word	VSCALE_CTRL
	.word	BYP_AB_CTRL
	.size	medusa_initialize_ntsc, .-medusa_initialize_ntsc
	.comm	VSCALE_CTRL,4,4
	.comm	VERT_TIM_CTRL,4,4
	.comm	SC_STEP_SIZE,4,4
	.comm	OUT_CTRL_NS,4,4
	.comm	OUT_CTRL1,4,4
	.comm	MODE_CTRL,4,4
	.comm	MISC_TIM_CTRL,4,4
	.comm	MAX_ENCODERS,4,4
	.comm	MAX_DECODERS,4,4
	.comm	HSCALE_CTRL,4,4
	.comm	HORIZ_TIM_CTRL,4,4
	.comm	DFE_CTRL1,4,4
	.comm	DENC_A_REG_7,4,4
	.comm	DENC_A_REG_6,4,4
	.comm	DENC_A_REG_5,4,4
	.comm	DENC_A_REG_4,4,4
	.comm	DENC_A_REG_3,4,4
	.comm	DENC_A_REG_2,4,4
	.comm	DENC_A_REG_1,4,4
	.comm	BYP_AB_CTRL,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
