	.file	"extr_stb0899_algo.c_stb0899_dvbs2_init_calc.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	stb0899_dvbs2_init_calc, @function
stb0899_dvbs2_init_calc:
.LFB0:
	.cfi_startproc
	endbr64
	push	r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	mov	r13d, 26214
	push	r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	sub	rsp, 8
	.cfi_def_cfa_offset 48
	call	stb0899_dvbs2_config_uwp@PLT
	mov	rdi, rbp
	call	stb0899_dvbs2_config_csm_auto@PLT
	mov	rdi, rbp
	call	stb0899_dvbs2_set_srate@PLT
	mov	rdi, rbp
	call	stb0899_dvbs2_set_btr_loopbw@PLT
	mov	r8d, DWORD PTR 0[rbp]
	cmp	r8d, 14999999
	jg	.L2
	mov	r13d, 18724
	cmp	r8d, 9999999
	jle	.L11
.L2:
	movsx	rax, DWORD PTR 4[rbp]
	movsx	rdi, r8d
	sar	r8d, 31
	mov	rsi, QWORD PTR 16[rbp]
	imul	rcx, rdi, 1125899907
	mov	rdx, rax
	imul	rax, rax, 1125899907
	sar	edx, 31
	sar	rcx, 50
	sar	rax, 50
	sub	ecx, r8d
	sub	eax, edx
	imul	ecx, r13d
	lea	eax, [rax+rax*4]
	sal	eax, 18
	cdq
	idiv	ecx
	movsx	rdx, DWORD PTR 12[rbp]
	mov	rcx, rdx
	imul	rdx, rdx, 1125899907
	sar	ecx, 31
	sar	rdx, 50
	sub	edx, ecx
	add	eax, 6
	movsx	r12, eax
	sar	eax, 31
	imul	r12, r12, 1717986919
	sar	r12, 34
	sub	r12d, eax
	je	.L8
	test	r12b, 1
	jne	.L3
	imul	rax, rdi, 1801439851
	mov	rdi, rbp
	sar	rax, 55
	sub	eax, r8d
	imul	eax, DWORD PTR 8[rbp]
	cdqe
	sub	rsi, rax
	call	stb0899_dvbs2_set_carr_freq@PLT
.L4:
	mov	esi, DWORD PTR ACQ_CNTRL2[rip]
	mov	edi, DWORD PTR STB0899_S2DEMOD[rip]
	call	STB0899_READ_S2REG@PLT
	mov	edi, DWORD PTR ZIGZAG[rip]
	mov	edx, 1
	mov	esi, eax
	mov	ebx, eax
	call	STB0899_SETFIELD_VAL@PLT
	mov	edi, DWORD PTR NUM_STEPS[rip]
	mov	edx, r12d
	mov	esi, ebx
	call	STB0899_SETFIELD_VAL@PLT
	mov	edi, DWORD PTR FREQ_STEPSIZE[rip]
	mov	edx, r13d
	mov	esi, ebx
	call	STB0899_SETFIELD_VAL@PLT
	mov	ecx, DWORD PTR STB0899_OFF0_ACQ_CNTRL2[rip]
	mov	r8d, ebx
	mov	rdi, rbp
	mov	edx, DWORD PTR STB0899_BASE_ACQ_CNTRL2[rip]
	mov	esi, DWORD PTR STB0899_S2DEMOD[rip]
	add	rsp, 8
	.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
	jmp	stb0899_write_s2reg@PLT
	.p2align 4,,10
	.p2align 3
.L8:
	.cfi_restore_state
	mov	r12d, 1
.L3:
	mov	rdi, rbp
	call	stb0899_dvbs2_set_carr_freq@PLT
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L11:
	cmp	r8d, 4999999
	mov	r13d, 13107
	mov	eax, 32768
	cmovle	r13d, eax
	jmp	.L2
	.cfi_endproc
.LFE0:
	.size	stb0899_dvbs2_init_calc, .-stb0899_dvbs2_init_calc
	.comm	ZIGZAG,4,4
	.comm	STB0899_S2DEMOD,4,4
	.comm	STB0899_OFF0_ACQ_CNTRL2,4,4
	.comm	STB0899_BASE_ACQ_CNTRL2,4,4
	.comm	NUM_STEPS,4,4
	.comm	FREQ_STEPSIZE,4,4
	.comm	ACQ_CNTRL2,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_stb0899_algo.c_stb0899_dvbs2_init_calc.c"
	.text
	.global	__aeabi_idiv
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	stb0899_dvbs2_init_calc, %function
stb0899_dvbs2_init_calc:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, lr}
	mov	r4, r0
	sub	sp, sp, #12
	bl	stb0899_dvbs2_config_uwp
	mov	r0, r4
	bl	stb0899_dvbs2_config_csm_auto
	mov	r0, r4
	bl	stb0899_dvbs2_set_srate
	mov	r0, r4
	bl	stb0899_dvbs2_set_btr_loopbw
	ldr	r6, [r4]
	ldr	r3, .L12
	cmp	r6, r3
	ldrge	r7, .L12+4
	bge	.L2
	ldr	r3, .L12+8
	cmp	r6, r3
	ldrgt	r7, .L12+12
	ble	.L11
.L2:
	ldr	r9, .L12+16
	ldr	r3, [r4, #4]
	smull	r2, r1, r9, r6
	asr	r0, r3, #31
	smull	r2, r3, r9, r3
	asr	r8, r6, #31
	rsb	r0, r0, r3, asr #18
	add	r0, r0, r0, lsl #2
	rsb	r1, r8, r1, asr #18
	mul	r1, r7, r1
	lsl	r0, r0, #18
	bl	__aeabi_idiv
	ldr	r2, .L12+20
	ldr	r3, [r4, #12]
	add	r5, r0, #6
	smull	r1, r0, r2, r5
	smull	r1, r2, r9, r3
	asr	r5, r5, #31
	asr	r3, r3, #31
	rsbs	r5, r5, r0, asr #2
	ldr	r1, [r4, #16]
	rsb	r2, r3, r2, asr #18
	beq	.L8
	tst	r5, #1
	bne	.L3
	ldr	r3, .L12+24
	smull	r0, r6, r3, r6
	ldr	r3, [r4, #8]
	rsb	r6, r8, r6, asr #23
	mul	r6, r3, r6
	mov	r0, r4
	sub	r1, r1, r6
	bl	stb0899_dvbs2_set_carr_freq
.L4:
	ldr	r3, .L12+28
	ldr	r8, .L12+32
	ldr	r1, [r3]
	ldr	r0, [r8]
	bl	STB0899_READ_S2REG
	mov	r6, r0
	ldr	r3, .L12+36
	mov	r1, r0
	mov	r2, #1
	ldr	r0, [r3]
	bl	STB0899_SETFIELD_VAL
	ldr	r3, .L12+40
	mov	r2, r5
	mov	r1, r6
	ldr	r0, [r3]
	bl	STB0899_SETFIELD_VAL
	ldr	r3, .L12+44
	mov	r2, r7
	mov	r1, r6
	ldr	r0, [r3]
	bl	STB0899_SETFIELD_VAL
	ldr	r3, .L12+48
	ldr	r2, .L12+52
	str	r6, [sp]
	mov	r0, r4
	ldr	r1, [r8]
	ldr	r3, [r3]
	ldr	r2, [r2]
	bl	stb0899_write_s2reg
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, pc}
.L8:
	mov	r5, #1
.L3:
	mov	r0, r4
	bl	stb0899_dvbs2_set_carr_freq
	b	.L4
.L11:
	ldr	r3, .L12+56
	ldr	r7, .L12+60
	cmp	r6, r3
	movle	r7, #32768
	b	.L2
.L13:
	.align	2
.L12:
	.word	15000000
	.word	26214
	.word	9999999
	.word	18724
	.word	1125899907
	.word	1717986919
	.word	1801439851
	.word	ACQ_CNTRL2
	.word	STB0899_S2DEMOD
	.word	ZIGZAG
	.word	NUM_STEPS
	.word	FREQ_STEPSIZE
	.word	STB0899_OFF0_ACQ_CNTRL2
	.word	STB0899_BASE_ACQ_CNTRL2
	.word	4999999
	.word	13107
	.size	stb0899_dvbs2_init_calc, .-stb0899_dvbs2_init_calc
	.comm	ZIGZAG,4,4
	.comm	STB0899_S2DEMOD,4,4
	.comm	STB0899_OFF0_ACQ_CNTRL2,4,4
	.comm	STB0899_BASE_ACQ_CNTRL2,4,4
	.comm	NUM_STEPS,4,4
	.comm	FREQ_STEPSIZE,4,4
	.comm	ACQ_CNTRL2,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
