	.file	"extr_tvmodesnv17.c_nv17_ctv_update_rescaler.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	nv17_ctv_update_rescaler
	.type	nv17_ctv_update_rescaler, @function
nv17_ctv_update_rescaler:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	mov	r15, rdi
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	sub	rsp, 24
	.cfi_def_cfa_offset 80
	mov	r12, QWORD PTR 8[rdi]
	call	to_tv_enc@PLT
	mov	rdi, QWORD PTR [r15]
	mov	r14, rax
	call	nouveau_crtc@PLT
	mov	rdi, r12
	mov	r13d, DWORD PTR [rax]
	call	nv04_display@PLT
	mov	rdi, r15
	mov	r8, rax
	movsx	rax, r13d
	lea	rdx, [rax+rax*2]
	mov	rax, QWORD PTR [r8]
	mov	r8, QWORD PTR [r15]
	lea	rbp, [rax+rdx*8]
	mov	QWORD PTR [rsp], r8
	call	get_tv_norm@PLT
	mov	r8, QWORD PTR [rsp]
	mov	ecx, 100
	mov	rbx, rax
	mov	eax, DWORD PTR [rax]
	test	DWORD PTR DRM_MODE_FLAG_INTERLACE[rip], eax
	jne	.L2
	mov	ecx, DWORD PTR [r14]
.L2:
	movsx	rsi, DWORD PTR 4[rbx]
	mov	r14d, DWORD PTR 8[rbx]
	mov	QWORD PTR 8[rsp], r8
	sub	r14d, DWORD PTR 8[r8]
	mov	DWORD PTR [rsp], ecx
	mov	edx, esi
	sub	edx, DWORD PTR 4[r8]
	mov	rax, rsi
	mov	r15d, edx
	imul	rsi, rsi, 1717986919
	sar	eax, 31
	shr	r15d, 31
	add	r15d, edx
	mov	edx, r14d
	sar	r15d
	sar	rsi, 35
	shr	edx, 31
	sub	esi, eax
	mov	edi, r15d
	add	r14d, edx
	call	min@PLT
	mov	ecx, DWORD PTR [rsp]
	mov	edx, r15d
	xor	edi, edi
	mov	esi, eax
	sar	r14d
	call	interpolate@PLT
	movsx	rsi, DWORD PTR 8[rbx]
	mov	edi, r14d
	mov	r15d, eax
	mov	rax, rsi
	imul	rsi, rsi, 1717986919
	sar	eax, 31
	sar	rsi, 35
	sub	esi, eax
	call	min@PLT
	mov	ecx, DWORD PTR [rsp]
	mov	edx, r14d
	xor	edi, edi
	mov	esi, eax
	call	interpolate@PLT
	mov	r8, QWORD PTR 8[rsp]
	mov	esi, DWORD PTR 4[rbx]
	lea	edx, [r15+r15]
	mov	ecx, eax
	mov	eax, DWORD PTR 4[r8]
	sub	esi, edx
	sal	eax, 11
	cdq
	idiv	esi
	mov	esi, DWORD PTR 8[rbx]
	lea	edx, [rcx+rcx]
	sub	esi, edx
	mov	r14d, eax
	mov	eax, DWORD PTR 8[r8]
	sal	eax, 11
	cdq
	idiv	esi
	mov	rsi, QWORD PTR FP_VALID_START[rip]
	mov	rdx, QWORD PTR FP_VALID_END[rip]
	and	eax, -4
	mov	edi, eax
	mov	rax, QWORD PTR 0[rbp]
	mov	DWORD PTR [rax+rsi*4], r15d
	not	r15d
	add	r15d, DWORD PTR 4[rbx]
	mov	DWORD PTR [rax+rdx*4], r15d
	mov	rax, QWORD PTR 8[rbp]
	mov	DWORD PTR [rax+rsi*4], ecx
	not	ecx
	add	ecx, DWORD PTR 8[rbx]
	xor	esi, esi
	mov	DWORD PTR [rax+rdx*4], ecx
	mov	edx, DWORD PTR NV_PRAMDAC_FP_DEBUG_1_YSCALE_VALUE[rip]
	call	XLATE@PLT
	mov	edx, DWORD PTR NV_PRAMDAC_FP_DEBUG_1_XSCALE_VALUE[rip]
	mov	edi, r14d
	xor	esi, esi
	mov	ebx, DWORD PTR NV_PRAMDAC_FP_DEBUG_1_YSCALE_TESTMODE_ENABLE[rip]
	or	ebx, DWORD PTR NV_PRAMDAC_FP_DEBUG_1_XSCALE_TESTMODE_ENABLE[rip]
	or	ebx, eax
	call	XLATE@PLT
	mov	rdx, QWORD PTR FP_VALID_START[rip]
	mov	esi, r13d
	mov	rdi, r12
	or	ebx, eax
	mov	rax, QWORD PTR 0[rbp]
	mov	DWORD PTR 16[rbp], ebx
	mov	ecx, DWORD PTR [rax+rdx*4]
	mov	edx, DWORD PTR NV_PRAMDAC_FP_HVALID_START[rip]
	call	NVWriteRAMDAC@PLT
	mov	rax, QWORD PTR 0[rbp]
	mov	esi, r13d
	mov	rdi, r12
	mov	rdx, QWORD PTR FP_VALID_END[rip]
	mov	ecx, DWORD PTR [rax+rdx*4]
	mov	edx, DWORD PTR NV_PRAMDAC_FP_HVALID_END[rip]
	call	NVWriteRAMDAC@PLT
	mov	rax, QWORD PTR 8[rbp]
	mov	esi, r13d
	mov	rdi, r12
	mov	rdx, QWORD PTR FP_VALID_START[rip]
	mov	ecx, DWORD PTR [rax+rdx*4]
	mov	edx, DWORD PTR NV_PRAMDAC_FP_VVALID_START[rip]
	call	NVWriteRAMDAC@PLT
	mov	rax, QWORD PTR 8[rbp]
	mov	esi, r13d
	mov	rdi, r12
	mov	rdx, QWORD PTR FP_VALID_END[rip]
	mov	ecx, DWORD PTR [rax+rdx*4]
	mov	edx, DWORD PTR NV_PRAMDAC_FP_VVALID_END[rip]
	call	NVWriteRAMDAC@PLT
	mov	ecx, DWORD PTR 16[rbp]
	mov	esi, r13d
	mov	rdi, r12
	mov	edx, DWORD PTR NV_PRAMDAC_FP_DEBUG_1[rip]
	add	rsp, 24
	.cfi_def_cfa_offset 56
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	jmp	NVWriteRAMDAC@PLT
	.cfi_endproc
.LFE0:
	.size	nv17_ctv_update_rescaler, .-nv17_ctv_update_rescaler
	.comm	NV_PRAMDAC_FP_VVALID_START,4,4
	.comm	NV_PRAMDAC_FP_VVALID_END,4,4
	.comm	NV_PRAMDAC_FP_HVALID_START,4,4
	.comm	NV_PRAMDAC_FP_HVALID_END,4,4
	.comm	NV_PRAMDAC_FP_DEBUG_1_YSCALE_VALUE,4,4
	.comm	NV_PRAMDAC_FP_DEBUG_1_YSCALE_TESTMODE_ENABLE,4,4
	.comm	NV_PRAMDAC_FP_DEBUG_1_XSCALE_VALUE,4,4
	.comm	NV_PRAMDAC_FP_DEBUG_1_XSCALE_TESTMODE_ENABLE,4,4
	.comm	NV_PRAMDAC_FP_DEBUG_1,4,4
	.comm	FP_VALID_START,8,8
	.comm	FP_VALID_END,8,8
	.comm	DRM_MODE_FLAG_INTERLACE,4,4
	.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_tvmodesnv17.c_nv17_ctv_update_rescaler.c"
	.text
	.global	__aeabi_idiv
	.align	2
	.global	nv17_ctv_update_rescaler
	.syntax unified
	.arm
	.fpu softvfp
	.type	nv17_ctv_update_rescaler, %function
nv17_ctv_update_rescaler:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	sub	sp, sp, #20
	ldr	r8, [r0, #4]
	mov	r4, r0
	bl	to_tv_enc
	mov	r5, r0
	ldr	r0, [r4]
	bl	nouveau_crtc
	mov	r3, r0
	mov	r0, r8
	ldr	r7, [r3]
	bl	nv04_display
	add	r6, r7, r7, lsl #1
	ldr	r10, [r0]
	lsl	r3, r6, #2
	mov	r0, r4
	ldr	fp, [r4]
	str	r3, [sp, #4]
	bl	get_tv_norm
	ldr	r3, .L6
	ldr	r2, [r0]
	ldr	r3, [r3]
	ldr	r1, [r0, #4]
	tst	r2, r3
	movne	r3, #100
	ldreq	r3, [r5]
	ldr	r9, .L6+4
	ldr	r2, [fp, #4]
	str	r3, [sp, #8]
	smull	r3, ip, r9, r1
	sub	r2, r1, r2
	mov	r4, r0
	ldr	r5, [r0, #8]
	add	r2, r2, r2, lsr #31
	ldr	r0, [fp, #8]
	asr	r2, r2, #1
	asr	r1, r1, #31
	rsb	r1, r1, ip, asr #3
	sub	r5, r5, r0
	mov	r0, r2
	str	r2, [sp, #12]
	bl	min
	ldr	r3, [sp, #8]
	mov	r1, r0
	ldr	r2, [sp, #12]
	mov	r0, #0
	bl	interpolate
	mov	ip, r0
	ldr	r2, [r4, #8]
	add	r5, r5, r5, lsr #31
	smull	r3, r1, r9, r2
	asr	r5, r5, #1
	asr	r2, r2, #31
	rsb	r1, r2, r1, asr #3
	mov	r0, r5
	mov	r9, ip
	bl	min
	mov	r2, r5
	mov	r1, r0
	ldr	r3, [sp, #8]
	mov	r0, #0
	bl	interpolate
	ldr	r3, [fp, #4]
	ldr	r1, [r4, #4]
	mov	r5, r0
	sub	r1, r1, r9, lsl #1
	lsl	r0, r3, #11
	bl	__aeabi_idiv
	mov	r3, r0
	ldr	r1, [r4, #8]
	ldr	r0, [fp, #8]
	sub	r1, r1, r5, lsl #1
	lsl	r0, r0, #11
	str	r5, [sp, #8]
	str	r3, [sp, #12]
	bl	__aeabi_idiv
	ldr	fp, .L6+8
	ldr	r2, [sp, #4]
	ldr	r5, .L6+12
	ldr	lr, [r10, r2]
	ldr	r2, [fp]
	add	r6, r10, r6, lsl #2
	str	r9, [lr, r2, lsl #2]
	ldr	r1, [r4, #4]
	ldr	ip, [r5]
	ldr	r3, [sp, #8]
	sub	r9, r1, r9
	ldr	r1, [r6, #4]
	sub	r9, r9, #1
	str	r9, [lr, ip, lsl #2]
	str	r3, [r1, r2, lsl #2]
	ldr	r4, [r4, #8]
	ldr	lr, .L6+16
	sub	r2, r4, r3
	sub	r2, r2, #1
	str	r2, [r1, ip, lsl #2]
	ldr	r2, [lr]
	mov	r1, #0
	bic	r0, r0, #3
	bl	XLATE
	mov	ip, r0
	ldr	r1, .L6+20
	ldr	r2, .L6+24
	ldr	r3, [sp, #12]
	ldr	r4, [r1]
	ldr	r1, [r2]
	ldr	r2, .L6+28
	mov	r0, r3
	ldr	r2, [r2]
	orr	r4, r4, r1
	mov	r1, #0
	orr	r4, r4, ip
	bl	XLATE
	ldr	r9, [sp, #4]
	ldr	r1, [fp]
	ldr	r3, [r10, r9]
	orr	r4, r4, r0
	ldr	r2, .L6+32
	str	r4, [r6, #8]
	ldr	r3, [r3, r1, lsl #2]
	mov	r0, r8
	mov	r1, r7
	ldr	r2, [r2]
	bl	NVWriteRAMDAC
	ldr	r1, [r5]
	ldr	r3, [r10, r9]
	ldr	r2, .L6+36
	ldr	r3, [r3, r1, lsl #2]
	mov	r0, r8
	mov	r1, r7
	ldr	r2, [r2]
	bl	NVWriteRAMDAC
	ldr	r1, [fp]
	ldr	r3, [r6, #4]
	ldr	r2, .L6+40
	ldr	r3, [r3, r1, lsl #2]
	mov	r0, r8
	mov	r1, r7
	ldr	r2, [r2]
	bl	NVWriteRAMDAC
	ldr	r1, [r5]
	ldr	r3, [r6, #4]
	ldr	r2, .L6+44
	ldr	r3, [r3, r1, lsl #2]
	mov	r0, r8
	mov	r1, r7
	ldr	r2, [r2]
	bl	NVWriteRAMDAC
	mov	r1, r7
	mov	r0, r8
	ldr	r2, .L6+48
	ldr	r3, [r6, #8]
	ldr	r2, [r2]
	add	sp, sp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	b	NVWriteRAMDAC
.L7:
	.align	2
.L6:
	.word	DRM_MODE_FLAG_INTERLACE
	.word	1717986919
	.word	FP_VALID_START
	.word	FP_VALID_END
	.word	NV_PRAMDAC_FP_DEBUG_1_YSCALE_VALUE
	.word	NV_PRAMDAC_FP_DEBUG_1_YSCALE_TESTMODE_ENABLE
	.word	NV_PRAMDAC_FP_DEBUG_1_XSCALE_TESTMODE_ENABLE
	.word	NV_PRAMDAC_FP_DEBUG_1_XSCALE_VALUE
	.word	NV_PRAMDAC_FP_HVALID_START
	.word	NV_PRAMDAC_FP_HVALID_END
	.word	NV_PRAMDAC_FP_VVALID_START
	.word	NV_PRAMDAC_FP_VVALID_END
	.word	NV_PRAMDAC_FP_DEBUG_1
	.size	nv17_ctv_update_rescaler, .-nv17_ctv_update_rescaler
	.comm	NV_PRAMDAC_FP_VVALID_START,4,4
	.comm	NV_PRAMDAC_FP_VVALID_END,4,4
	.comm	NV_PRAMDAC_FP_HVALID_START,4,4
	.comm	NV_PRAMDAC_FP_HVALID_END,4,4
	.comm	NV_PRAMDAC_FP_DEBUG_1_YSCALE_VALUE,4,4
	.comm	NV_PRAMDAC_FP_DEBUG_1_YSCALE_TESTMODE_ENABLE,4,4
	.comm	NV_PRAMDAC_FP_DEBUG_1_XSCALE_VALUE,4,4
	.comm	NV_PRAMDAC_FP_DEBUG_1_XSCALE_TESTMODE_ENABLE,4,4
	.comm	NV_PRAMDAC_FP_DEBUG_1,4,4
	.comm	FP_VALID_START,4,4
	.comm	FP_VALID_END,4,4
	.comm	DRM_MODE_FLAG_INTERLACE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
