	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function stv0297_set_initialdemodfreq
_stv0297_set_initialdemodfreq:          ## @stv0297_set_initialdemodfreq
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %r14
	xorl	%eax, %eax
	cmpq	$10001, %rsi                    ## imm = 0x2711
	movq	_STV0297_CLOCK_KHZ@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmovgeq	%rcx, %rax
	subq	%rax, %rsi
	imulq	$1000, %rcx, %rax               ## imm = 0x3E8
	leaq	65535(%rax), %rcx
	testq	%rax, %rax
	cmovnsq	%rax, %rcx
	sarq	$16, %rcx
	imulq	$1000, %rsi, %rax               ## imm = 0x3E8
	movq	%rax, %rdx
	orq	%rcx, %rdx
	shrq	$32, %rdx
	je	LBB0_1
## %bb.2:
	cqto
	idivq	%rcx
	jmp	LBB0_3
LBB0_1:
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $eax killed $eax def $rax
LBB0_3:
	cmpq	$65535, %rax                    ## imm = 0xFFFF
	movl	$65535, %ebx                    ## imm = 0xFFFF
	cmovlq	%rax, %rbx
	movq	%r14, %rdi
	movl	$37, %esi
	movl	$128, %edx
	movl	$128, %ecx
	callq	_stv0297_writereg_mask
	movq	%rbx, %rdx
	sarq	$8, %rdx
	movq	%r14, %rdi
	movl	$33, %esi
	callq	_stv0297_writereg
	movq	%r14, %rdi
	movl	$32, %esi
	movq	%rbx, %rdx
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_stv0297_writereg               ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_STV0297_CLOCK_KHZ,8,3          ## @STV0297_CLOCK_KHZ
	.no_dead_strip	_stv0297_set_initialdemodfreq
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function stv0297_set_initialdemodfreq
_stv0297_set_initialdemodfreq:          ; @stv0297_set_initialdemodfreq
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
Lloh0:
	adrp	x8, _STV0297_CLOCK_KHZ@GOTPAGE
Lloh1:
	ldr	x8, [x8, _STV0297_CLOCK_KHZ@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	mov	w9, #10000
	cmp	x1, x9
	csel	x9, x8, xzr, gt
	sub	x9, x1, x9
	mov	w10, #1000
	mul	x8, x8, x10
	mov	w11, #65535
	add	x12, x8, x11
	cmp	x8, #0
	csel	x8, x12, x8, lt
	asr	x8, x8, #16
	mul	x9, x9, x10
	sdiv	x8, x9, x8
	cmp	x8, x11
	csel	x20, x8, x11, lt
	mov	w1, #37
	mov	w2, #128
	mov	w3, #128
	bl	_stv0297_writereg_mask
	asr	x2, x20, #8
	mov	x0, x19
	mov	w1, #33
	bl	_stv0297_writereg
	mov	x0, x19
	mov	w1, #32
	mov	x2, x20
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_stv0297_writereg
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_STV0297_CLOCK_KHZ,8,3          ; @STV0297_CLOCK_KHZ
	.no_dead_strip	_stv0297_set_initialdemodfreq
.subsections_via_symbols
