	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function stb0899_dvbs2_set_btr_loopbw
_stb0899_dvbs2_set_btr_loopbw:          ## @stb0899_dvbs2_set_btr_loopbw
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	(%rdi), %r15
	movl	8(%rdi), %eax
	addl	%eax, %eax
	movl	12(%rdi), %ecx
	leal	(%rcx,%rcx,4), %ecx
	cltd
	idivl	%ecx
	testl	%eax, %eax
	movl	$1, %r13d
	cmovel	%r13d, %eax
	movl	%eax, %edi
	callq	_Log2Int
	movb	(%r15), %cl
	movl	$1, %edx
	shll	%cl, %edx
	movl	%eax, %ecx
	movslq	8(%r14), %rax
	imulq	$274877907, %rax, %rsi          ## imm = 0x10624DD3
	movq	%rsi, %rax
	shrq	$63, %rax
	sarq	$38, %rsi
	addl	%eax, %esi
	movl	%edx, %eax
	cltd
	idivl	%esi
	movslq	12(%r14), %rdx
	imulq	$1125899907, %rdx, %rsi         ## imm = 0x431BDE83
	movq	%rsi, %rdx
	shrq	$63, %rdx
	sarq	$50, %rsi
	addl	%edx, %esi
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %esi
	imull	%eax, %esi
	testl	%esi, %esi
	je	LBB0_1
## %bb.2:
	movl	$13248000, %eax                 ## imm = 0xCA2600
	xorl	%edx, %edx
	idivl	%esi
	movl	%eax, %ecx
	movl	$90000, %eax                    ## imm = 0x15F90
	xorl	%edx, %edx
	idivl	%ecx
	movl	%eax, %r12d
	movl	$-424200, %eax                  ## imm = 0xFFF986F8
	cltd
	idivl	%ecx
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	imull	$100, %eax, %r14d
	movl	%r14d, %edi
	callq	_Log2Int
	movl	%eax, %ebx
	movl	$10000, %edi                    ## imm = 0x2710
	callq	_Log2Int
	subl	%eax, %ebx
	movl	4(%r15), %eax
	subl	%ebx, %eax
	addl	$2, %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	addb	$-2, %bl
	movl	%ebx, %ecx
	shll	%cl, %r13d
	movl	%r14d, %eax
	cltd
	idivl	%r13d
	cltq
	imulq	$1759218605, %rax, %r13         ## imm = 0x68DB8BAD
	movq	%r13, %rax
	shrq	$63, %rax
	sarq	$44, %r13
	addl	%eax, %r13d
	leal	15(%r12), %edi
	callq	_Log2Int
	movl	$20, %ecx
	subl	%eax, %ecx
	movl	4(%r15), %eax
	leal	(%rcx,%rax), %edx
	shll	%cl, %r12d
	movslq	%r12d, %rsi
	imulq	$1125899907, %rsi, %r14         ## imm = 0x431BDE83
	movq	%r14, %rsi
	shrq	$63, %rsi
	sarq	$50, %r14
	addl	%esi, %r14d
	cmpl	$16, %edx
	leal	-15(%rcx,%rax), %r12d
	movl	$0, %eax
	cmovll	%eax, %r12d
	cmpl	$15, %edx
	movl	$15, %r15d
	cmovll	%edx, %r15d
	movq	_STB0899_S2DEMOD@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_BTR_LOOP_GAIN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_STB0899_READ_S2REG
	movl	%eax, %ebx
	movq	_KBTR0_RSHFT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	%ebx, %esi
	movl	%r15d, %edx
	callq	_STB0899_SETFIELD_VAL
	movq	_KBTR0@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	%ebx, %esi
	movl	%r14d, %edx
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	callq	_STB0899_SETFIELD_VAL
	movq	_KBTR1_RSHFT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	%ebx, %esi
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	callq	_STB0899_SETFIELD_VAL
	movq	_KBTR1@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	%ebx, %esi
	movl	%r13d, %edx
	callq	_STB0899_SETFIELD_VAL
	movq	_KBTR2_RSHFT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	%ebx, %esi
	movl	%r12d, %edx
	callq	_STB0899_SETFIELD_VAL
	jmp	LBB0_3
LBB0_1:
	movl	$805967, %ebx                   ## imm = 0xC4C4F
LBB0_3:
	movq	_STB0899_S2DEMOD@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_STB0899_BASE_BTR_LOOP_GAIN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_STB0899_OFF0_BTR_LOOP_GAIN@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r14, %rdi
	movl	%ebx, %r8d
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_stb0899_write_s2reg            ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_STB0899_S2DEMOD,4,2            ## @STB0899_S2DEMOD
	.comm	_BTR_LOOP_GAIN,4,2              ## @BTR_LOOP_GAIN
	.comm	_KBTR0_RSHFT,4,2                ## @KBTR0_RSHFT
	.comm	_KBTR0,4,2                      ## @KBTR0
	.comm	_KBTR1_RSHFT,4,2                ## @KBTR1_RSHFT
	.comm	_KBTR1,4,2                      ## @KBTR1
	.comm	_KBTR2_RSHFT,4,2                ## @KBTR2_RSHFT
	.comm	_STB0899_BASE_BTR_LOOP_GAIN,4,2 ## @STB0899_BASE_BTR_LOOP_GAIN
	.comm	_STB0899_OFF0_BTR_LOOP_GAIN,4,2 ## @STB0899_OFF0_BTR_LOOP_GAIN
	.no_dead_strip	_stb0899_dvbs2_set_btr_loopbw
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function stb0899_dvbs2_set_btr_loopbw
_stb0899_dvbs2_set_btr_loopbw:          ; @stb0899_dvbs2_set_btr_loopbw
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x19, x0
	ldr	x23, [x0]
	ldp	w8, w9, [x0, #8]
	lsl	w8, w8, #1
	add	w9, w9, w9, lsl #2
	sdiv	w8, w8, w9
	cmp	w8, #0
	csinc	w0, w8, wzr, ne
	bl	_Log2Int
	ldr	w8, [x23]
	mov	w9, #19923
	movk	w9, #4194, lsl #16
	ldpsw	x10, x11, [x19, #8]
	mul	x9, x10, x9
	lsr	x10, x9, #63
	asr	x9, x9, #38
	add	w9, w9, w10
	mov	w22, #1
	lsl	w8, w22, w8
	sdiv	w8, w8, w9
	mov	w9, #56963
	movk	w9, #17179, lsl #16
	mul	x9, x11, x9
	lsr	x10, x9, #63
	asr	x9, x9, #50
	add	w9, w9, w10
	lsl	w9, w9, w0
	mul	w8, w9, w8
Lloh0:
	adrp	x26, _STB0899_S2DEMOD@GOTPAGE
Lloh1:
	ldr	x26, [x26, _STB0899_S2DEMOD@GOTPAGEOFF]
	cbz	w8, LBB0_2
; %bb.1:
	mov	w25, #16960
	movk	w25, #15, lsl #16
	mov	w9, #9728
	movk	w9, #202, lsl #16
	sdiv	w8, w9, w8
	mov	w9, #24464
	movk	w9, #1, lsl #16
	mov	w10, #34552
	movk	w10, #65529, lsl #16
	sdiv	w10, w10, w8
	mov	w11, #100
	mul	w20, w10, w11
	sdiv	w24, w9, w8
	mov	x0, x20
	bl	_Log2Int
	mov	x21, x0
	mov	w0, #10000
	bl	_Log2Int
	ldr	w8, [x23, #4]
	sub	w9, w21, w0
	sub	w8, w8, w9
	sub	w9, w9, #2
	add	w21, w8, #2
	lsl	w8, w22, w9
	sdiv	w8, w20, w8
	mov	w9, #35757
	movk	w9, #26843, lsl #16
	smull	x8, w8, w9
	lsr	x9, x8, #63
	asr	x8, x8, #44
	add	w22, w8, w9
	add	w0, w24, #15
	bl	_Log2Int
	mov	w8, #20
	ldr	w9, [x23, #4]
	sub	w8, w8, w0
	add	w9, w8, w9
	lsl	w8, w24, w8
	subs	w10, w9, #15
	csel	w23, w10, wzr, gt
	mov	w10, #15
	csel	w24, w9, w10, lt
	ldr	w0, [x26]
Lloh2:
	adrp	x9, _BTR_LOOP_GAIN@GOTPAGE
Lloh3:
	ldr	x9, [x9, _BTR_LOOP_GAIN@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x9]
	sdiv	w25, w8, w25
	bl	_STB0899_READ_S2REG
	mov	x20, x0
Lloh5:
	adrp	x8, _KBTR0_RSHFT@GOTPAGE
Lloh6:
	ldr	x8, [x8, _KBTR0_RSHFT@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x8]
	mov	x1, x20
	mov	x2, x24
	bl	_STB0899_SETFIELD_VAL
Lloh8:
	adrp	x8, _KBTR0@GOTPAGE
Lloh9:
	ldr	x8, [x8, _KBTR0@GOTPAGEOFF]
Lloh10:
	ldr	w0, [x8]
	mov	x1, x20
	mov	x2, x25
	bl	_STB0899_SETFIELD_VAL
Lloh11:
	adrp	x8, _KBTR1_RSHFT@GOTPAGE
Lloh12:
	ldr	x8, [x8, _KBTR1_RSHFT@GOTPAGEOFF]
Lloh13:
	ldr	w0, [x8]
	mov	x1, x20
	mov	x2, x21
	bl	_STB0899_SETFIELD_VAL
Lloh14:
	adrp	x8, _KBTR1@GOTPAGE
Lloh15:
	ldr	x8, [x8, _KBTR1@GOTPAGEOFF]
Lloh16:
	ldr	w0, [x8]
	mov	x1, x20
	mov	x2, x22
	bl	_STB0899_SETFIELD_VAL
Lloh17:
	adrp	x8, _KBTR2_RSHFT@GOTPAGE
Lloh18:
	ldr	x8, [x8, _KBTR2_RSHFT@GOTPAGEOFF]
Lloh19:
	ldr	w0, [x8]
	mov	x1, x20
	mov	x2, x23
	bl	_STB0899_SETFIELD_VAL
	b	LBB0_3
LBB0_2:
	mov	w20, #19535
	movk	w20, #12, lsl #16
LBB0_3:
	ldr	w1, [x26]
Lloh20:
	adrp	x8, _STB0899_BASE_BTR_LOOP_GAIN@GOTPAGE
Lloh21:
	ldr	x8, [x8, _STB0899_BASE_BTR_LOOP_GAIN@GOTPAGEOFF]
Lloh22:
	ldr	w2, [x8]
Lloh23:
	adrp	x8, _STB0899_OFF0_BTR_LOOP_GAIN@GOTPAGE
Lloh24:
	ldr	x8, [x8, _STB0899_OFF0_BTR_LOOP_GAIN@GOTPAGEOFF]
Lloh25:
	ldr	w3, [x8]
	mov	x0, x19
	mov	x4, x20
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	b	_stb0899_write_s2reg
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_STB0899_S2DEMOD,4,2            ; @STB0899_S2DEMOD
	.comm	_BTR_LOOP_GAIN,4,2              ; @BTR_LOOP_GAIN
	.comm	_KBTR0_RSHFT,4,2                ; @KBTR0_RSHFT
	.comm	_KBTR0,4,2                      ; @KBTR0
	.comm	_KBTR1_RSHFT,4,2                ; @KBTR1_RSHFT
	.comm	_KBTR1,4,2                      ; @KBTR1
	.comm	_KBTR2_RSHFT,4,2                ; @KBTR2_RSHFT
	.comm	_STB0899_BASE_BTR_LOOP_GAIN,4,2 ; @STB0899_BASE_BTR_LOOP_GAIN
	.comm	_STB0899_OFF0_BTR_LOOP_GAIN,4,2 ; @STB0899_OFF0_BTR_LOOP_GAIN
	.no_dead_strip	_stb0899_dvbs2_set_btr_loopbw
.subsections_via_symbols
