	.file	"extr_stv090x.c_stv090x_get_agc2_min_level.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"I/O error"
	.text
	.p2align 4
	.type	stv090x_get_agc2_min_level, @function
stv090x_get_agc2_min_level:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	mov	edx, 56
	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
	mov	r12, rdi
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	sub	rsp, 40
	.cfi_def_cfa_offset 96
	mov	esi, DWORD PTR AGC2REF[rip]
	call	STV090x_WRITE_DEMOD@PLT
	test	rax, rax
	js	.L2
	mov	esi, DWORD PTR DMDCFGMD[rip]
	mov	rdi, r12
	call	STV090x_READ_DEMOD@PLT
	mov	esi, DWORD PTR SCAN_ENABLE_FIELD[rip]
	xor	edx, edx
	mov	edi, eax
	mov	r13d, eax
	call	STV090x_SETFIELD_Px@PLT
	mov	esi, DWORD PTR CFR_AUTOSCAN_FIELD[rip]
	xor	edx, edx
	mov	edi, r13d
	call	STV090x_SETFIELD_Px@PLT
	mov	esi, DWORD PTR DMDCFGMD[rip]
	mov	edx, r13d
	mov	rdi, r12
	call	STV090x_WRITE_DEMOD@PLT
	test	rax, rax
	js	.L2
	mov	esi, DWORD PTR SFRUP1[rip]
	mov	edx, 131
	mov	rdi, r12
	call	STV090x_WRITE_DEMOD@PLT
	test	rax, rax
	js	.L2
	mov	esi, DWORD PTR SFRUP0[rip]
	mov	edx, 192
	mov	rdi, r12
	call	STV090x_WRITE_DEMOD@PLT
	test	rax, rax
	js	.L2
	mov	esi, DWORD PTR SFRLOW1[rip]
	mov	edx, 130
	mov	rdi, r12
	call	STV090x_WRITE_DEMOD@PLT
	test	rax, rax
	js	.L2
	mov	esi, DWORD PTR SFRLOW0[rip]
	mov	edx, 160
	mov	rdi, r12
	call	STV090x_WRITE_DEMOD@PLT
	test	rax, rax
	js	.L2
	mov	esi, DWORD PTR DMDTOM[rip]
	xor	edx, edx
	mov	rdi, r12
	call	STV090x_WRITE_DEMOD@PLT
	test	rax, rax
	js	.L2
	mov	esi, 1000000
	mov	rdi, r12
	call	stv090x_set_srate@PLT
	test	rax, rax
	js	.L2
	mov	rax, QWORD PTR 8[r12]
	mov	esi, DWORD PTR [r12]
	mov	DWORD PTR 24[rsp], 1
	mov	eax, DWORD PTR [rax]
	test	eax, eax
	lea	ecx, 255[rax]
	cmovns	ecx, eax
	mov	eax, 256000000
	cdq
	sar	ecx, 8
	idiv	ecx
	mov	DWORD PTR 28[rsp], eax
	cmp	esi, 999999
	jg	.L14
.L3:
	mov	DWORD PTR 20[rsp], 1
	xor	r15d, r15d
	xor	r14d, r14d
	mov	DWORD PTR 12[rsp], 0
	mov	DWORD PTR 16[rsp], 65535
	.p2align 4,,10
	.p2align 3
.L7:
	mov	ecx, DWORD PTR 20[rsp]
	lea	eax, [r14+r15]
	sub	r14d, r15d
	mov	edx, 92
	mov	esi, DWORD PTR DMDISTATE[rip]
	mov	rdi, r12
	cmp	ecx, 1
	cmove	r14d, eax
	neg	ecx
	mov	DWORD PTR 20[rsp], ecx
	call	STV090x_WRITE_DEMOD@PLT
	test	rax, rax
	js	.L2
	mov	eax, r14d
	mov	esi, DWORD PTR CFRINIT1[rip]
	mov	rdi, r12
	movzx	edx, ah
	call	STV090x_WRITE_DEMOD@PLT
	test	rax, rax
	js	.L2
	mov	esi, DWORD PTR CFRINIT0[rip]
	movzx	edx, r14b
	mov	rdi, r12
	call	STV090x_WRITE_DEMOD@PLT
	test	rax, rax
	js	.L2
	mov	esi, DWORD PTR DMDISTATE[rip]
	mov	edx, 88
	mov	rdi, r12
	call	STV090x_WRITE_DEMOD@PLT
	test	rax, rax
	js	.L2
	mov	edi, 10
	mov	ebp, 10
	xor	r13d, r13d
	call	msleep@PLT
	.p2align 4,,10
	.p2align 3
.L6:
	mov	esi, DWORD PTR AGC2I1[rip]
	mov	rdi, r12
	call	STV090x_READ_DEMOD@PLT
	mov	esi, DWORD PTR AGC2I0[rip]
	mov	rdi, r12
	mov	ebx, eax
	call	STV090x_READ_DEMOD@PLT
	sal	ebx, 8
	or	ebx, eax
	add	r13d, ebx
	sub	ebp, 1
	jne	.L6
	movsx	rax, r13d
	mov	ecx, DWORD PTR 16[rsp]
	sar	r13d, 31
	imul	rax, rax, 1717986919
	sar	rax, 34
	sub	eax, r13d
	cmp	ecx, eax
	cmovle	eax, ecx
	add	DWORD PTR 12[rsp], 1
	add	r15d, DWORD PTR 28[rsp]
	mov	DWORD PTR 16[rsp], eax
	mov	eax, DWORD PTR 12[rsp]
	cmp	eax, DWORD PTR 24[rsp]
	jl	.L7
.L1:
	mov	eax, DWORD PTR 16[rsp]
	add	rsp, 40
	.cfi_remember_state
	.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
	ret
.L2:
	.cfi_restore_state
	mov	edi, DWORD PTR FE_ERROR[rip]
	lea	rdx, .LC0[rip]
	mov	esi, 1
	call	dprintk@PLT
	mov	DWORD PTR 16[rsp], -1
	jmp	.L1
.L14:
	movsx	rax, esi
	sar	esi, 31
	imul	rax, rax, 1125899907
	sar	rax, 50
	sub	eax, esi
	mov	DWORD PTR 24[rsp], eax
	jmp	.L3
	.cfi_endproc
.LFE0:
	.size	stv090x_get_agc2_min_level, .-stv090x_get_agc2_min_level
	.comm	SFRUP1,4,4
	.comm	SFRUP0,4,4
	.comm	SFRLOW1,4,4
	.comm	SFRLOW0,4,4
	.comm	SCAN_ENABLE_FIELD,4,4
	.comm	FE_ERROR,4,4
	.comm	DMDTOM,4,4
	.comm	DMDISTATE,4,4
	.comm	DMDCFGMD,4,4
	.comm	CFR_AUTOSCAN_FIELD,4,4
	.comm	CFRINIT1,4,4
	.comm	CFRINIT0,4,4
	.comm	AGC2REF,4,4
	.comm	AGC2I1,4,4
	.comm	AGC2I0,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_stv090x.c_stv090x_get_agc2_min_level.c"
	.text
	.global	__aeabi_idiv
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"I/O error\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	stv090x_get_agc2_min_level, %function
stv090x_get_agc2_min_level:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	ldr	r3, .L14
	mov	r2, #56
	ldr	r1, [r3]
	sub	sp, sp, #28
	mov	r5, r0
	bl	STV090x_WRITE_DEMOD
	cmp	r0, #0
	blt	.L2
	ldr	r6, .L14+4
	mov	r0, r5
	ldr	r1, [r6]
	bl	STV090x_READ_DEMOD
	mov	r4, r0
	ldr	r3, .L14+8
	mov	r2, #0
	ldr	r1, [r3]
	bl	STV090x_SETFIELD_Px
	ldr	r3, .L14+12
	mov	r2, #0
	ldr	r1, [r3]
	mov	r0, r4
	bl	STV090x_SETFIELD_Px
	mov	r2, r4
	mov	r0, r5
	ldr	r1, [r6]
	bl	STV090x_WRITE_DEMOD
	cmp	r0, #0
	blt	.L2
	ldr	r3, .L14+16
	mov	r2, #131
	mov	r0, r5
	ldr	r1, [r3]
	bl	STV090x_WRITE_DEMOD
	cmp	r0, #0
	blt	.L2
	ldr	r3, .L14+20
	mov	r2, #192
	mov	r0, r5
	ldr	r1, [r3]
	bl	STV090x_WRITE_DEMOD
	cmp	r0, #0
	blt	.L2
	ldr	r3, .L14+24
	mov	r2, #130
	mov	r0, r5
	ldr	r1, [r3]
	bl	STV090x_WRITE_DEMOD
	cmp	r0, #0
	blt	.L2
	ldr	r3, .L14+28
	mov	r2, #160
	mov	r0, r5
	ldr	r1, [r3]
	bl	STV090x_WRITE_DEMOD
	cmp	r0, #0
	blt	.L2
	ldr	r3, .L14+32
	mov	r2, #0
	mov	r0, r5
	ldr	r1, [r3]
	bl	STV090x_WRITE_DEMOD
	cmp	r0, #0
	blt	.L2
	ldr	r6, .L14+36
	mov	r0, r5
	mov	r1, r6
	bl	stv090x_set_srate
	cmp	r0, #0
	blt	.L2
	ldr	r3, [r5, #4]
	ldr	r0, .L14+40
	ldr	r1, [r3]
	ldr	r4, [r5]
	add	r3, r1, #255
	cmp	r1, #0
	movlt	r1, r3
	asr	r1, r1, #8
	bl	__aeabi_idiv
	cmp	r4, r6
	mov	r8, #0
	movlt	r3, #1
	mov	r9, #1
	ldrge	r2, .L14+44
	asrge	r3, r4, #31
	smullge	r1, r4, r2, r4
	ldr	fp, .L14+48
	rsbge	r3, r3, r4, asr #18
	ldr	r7, .L14+52
	ldr	r6, .L14+56
	str	r0, [sp, #16]
	str	r3, [sp, #20]
	str	r8, [sp, #4]
	str	r8, [sp, #12]
	str	fp, [sp, #8]
.L7:
	ldr	r4, .L14+60
	ldr	r3, [sp, #4]
	cmp	r9, #1
	mov	r2, #92
	mov	r0, r5
	ldr	r1, [r4]
	addeq	r8, r8, r3
	subne	r8, r8, r3
	bl	STV090x_WRITE_DEMOD
	cmp	r0, #0
	rsb	r9, r9, #0
	blt	.L2
	ldr	r3, .L14+64
	asr	r2, r8, #8
	mov	r0, r5
	ldr	r1, [r3]
	and	r2, r2, #255
	bl	STV090x_WRITE_DEMOD
	cmp	r0, #0
	blt	.L2
	ldr	r3, .L14+68
	mov	r0, r5
	ldr	r1, [r3]
	and	r2, r8, #255
	bl	STV090x_WRITE_DEMOD
	cmp	r0, #0
	blt	.L2
	mov	r2, #88
	mov	r0, r5
	ldr	r1, [r4]
	bl	STV090x_WRITE_DEMOD
	cmp	r0, #0
	blt	.L2
	mov	r0, #10
	bl	msleep
	mov	fp, #10
	mov	r10, #0
.L6:
	ldr	r1, [r7]
	mov	r0, r5
	bl	STV090x_READ_DEMOD
	ldr	r1, [r6]
	mov	r4, r0
	mov	r0, r5
	bl	STV090x_READ_DEMOD
	subs	fp, fp, #1
	orr	r0, r0, r4, lsl #8
	add	r10, r10, r0
	bne	.L6
	ldr	r3, .L14+72
	ldr	r1, [sp, #8]
	smull	r2, r3, r10, r3
	asr	r2, r10, #31
	rsb	r2, r2, r3, asr #2
	cmp	r1, r2
	movlt	r2, r1
	ldr	r3, [sp, #12]
	str	r2, [sp, #8]
	ldr	r2, [sp, #20]
	add	r3, r3, #1
	cmp	r3, r2
	str	r3, [sp, #12]
	ldr	r2, [sp, #16]
	ldr	r3, [sp, #4]
	add	r3, r3, r2
	str	r3, [sp, #4]
	blt	.L7
	ldr	fp, [sp, #8]
	mov	r0, fp
	add	sp, sp, #28
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L2:
	mvn	fp, #0
	ldr	r3, .L14+76
	mov	r1, #1
	ldr	r2, .L14+80
	ldr	r0, [r3]
	bl	dprintk
	mov	r0, fp
	add	sp, sp, #28
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L15:
	.align	2
.L14:
	.word	AGC2REF
	.word	DMDCFGMD
	.word	SCAN_ENABLE_FIELD
	.word	CFR_AUTOSCAN_FIELD
	.word	SFRUP1
	.word	SFRUP0
	.word	SFRLOW1
	.word	SFRLOW0
	.word	DMDTOM
	.word	1000000
	.word	256000000
	.word	1125899907
	.word	65535
	.word	AGC2I1
	.word	AGC2I0
	.word	DMDISTATE
	.word	CFRINIT1
	.word	CFRINIT0
	.word	1717986919
	.word	FE_ERROR
	.word	.LC0
	.size	stv090x_get_agc2_min_level, .-stv090x_get_agc2_min_level
	.comm	SFRUP1,4,4
	.comm	SFRUP0,4,4
	.comm	SFRLOW1,4,4
	.comm	SFRLOW0,4,4
	.comm	SCAN_ENABLE_FIELD,4,4
	.comm	FE_ERROR,4,4
	.comm	DMDTOM,4,4
	.comm	DMDISTATE,4,4
	.comm	DMDCFGMD,4,4
	.comm	CFR_AUTOSCAN_FIELD,4,4
	.comm	CFRINIT1,4,4
	.comm	CFRINIT0,4,4
	.comm	AGC2REF,4,4
	.comm	AGC2I1,4,4
	.comm	AGC2I0,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
