	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function stv090x_set_mclk
_stv090x_set_mclk:                      ## @stv090x_set_mclk
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %ebx
	movq	%rdi, %r14
	movq	8(%rdi), %r15
	movq	_STV090x_SYNTCTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_stv090x_read_reg
	movq	_SELX1RATIO_FIELD@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movl	%eax, %edi
	callq	_STV090x_GETFIELD
	xorl	%ecx, %ecx
	cmpl	$1, %eax
	setne	%cl
	leal	(%rcx,%rcx), %eax
	addl	$4, %eax
	imull	%ebx, %eax
	cltd
	idivl	(%r15)
                                        ## kill: def $eax killed $eax def $rax
	leal	-1(%rax), %r15d
	movq	_STV090x_NCOARSE@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movq	%r14, %rdi
	callq	_stv090x_read_reg
	movl	%eax, %ebx
	movq	_M_DIV_FIELD@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%ebx, %edi
	movl	%r15d, %edx
	callq	_STV090x_SETFIELD
	movl	(%r12), %esi
	movq	%r14, %rdi
	movl	%ebx, %edx
	callq	_stv090x_write_reg
	testq	%rax, %rax
	js	LBB0_3
## %bb.1:
	movq	%r14, %rdi
	callq	_stv090x_get_mclk
	movq	(%r14), %rcx
	movl	%eax, (%rcx)
	cltq
	imulq	$1599289641, %rax, %rbx         ## imm = 0x5F533929
	movq	%rbx, %rax
	shrq	$63, %rax
	sarq	$50, %rbx
	addl	%eax, %ebx
	movq	_F22TX@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	%ebx, %edx
	callq	_STV090x_WRITE_DEMOD
	testq	%rax, %rax
	js	LBB0_3
## %bb.2:
	movq	_F22RX@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	%ebx, %edx
	callq	_STV090x_WRITE_DEMOD
	movq	%rax, %rcx
	xorl	%eax, %eax
	testq	%rcx, %rcx
	jns	LBB0_4
LBB0_3:
	movq	_FE_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rdx
	movl	$1, %esi
	callq	_dprintk
	movl	$-1, %eax
LBB0_4:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_STV090x_SYNTCTRL,4,2           ## @STV090x_SYNTCTRL
	.comm	_SELX1RATIO_FIELD,4,2           ## @SELX1RATIO_FIELD
	.comm	_STV090x_NCOARSE,4,2            ## @STV090x_NCOARSE
	.comm	_M_DIV_FIELD,4,2                ## @M_DIV_FIELD
	.comm	_F22TX,4,2                      ## @F22TX
	.comm	_F22RX,4,2                      ## @F22RX
	.comm	_FE_ERROR,4,2                   ## @FE_ERROR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"I/O error"

	.no_dead_strip	_stv090x_set_mclk
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function stv090x_set_mclk
_stv090x_set_mclk:                      ; @stv090x_set_mclk
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x20, x1
	mov	x19, x0
	ldr	x21, [x0, #8]
Lloh0:
	adrp	x8, _STV090x_SYNTCTRL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _STV090x_SYNTCTRL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_stv090x_read_reg
Lloh3:
	adrp	x8, _SELX1RATIO_FIELD@GOTPAGE
Lloh4:
	ldr	x8, [x8, _SELX1RATIO_FIELD@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	bl	_STV090x_GETFIELD
	mov	w8, #6
	mov	w9, #4
	cmp	w0, #1
	csel	w8, w9, w8, eq
	mul	w8, w8, w20
	ldr	w9, [x21]
	sdiv	w8, w8, w9
	sub	w20, w8, #1
Lloh6:
	adrp	x22, _STV090x_NCOARSE@GOTPAGE
Lloh7:
	ldr	x22, [x22, _STV090x_NCOARSE@GOTPAGEOFF]
	ldr	w1, [x22]
	mov	x0, x19
	bl	_stv090x_read_reg
	mov	x21, x0
Lloh8:
	adrp	x8, _M_DIV_FIELD@GOTPAGE
Lloh9:
	ldr	x8, [x8, _M_DIV_FIELD@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	mov	x2, x20
	bl	_STV090x_SETFIELD
	ldr	w1, [x22]
	mov	x0, x19
	mov	x2, x21
	bl	_stv090x_write_reg
	tbnz	x0, #63, LBB0_4
; %bb.1:
	mov	x0, x19
	bl	_stv090x_get_mclk
	ldr	x8, [x19]
	str	w0, [x8]
	mov	w8, #14633
	movk	w8, #24403, lsl #16
	smull	x8, w0, w8
	lsr	x9, x8, #63
	asr	x8, x8, #50
	add	w20, w8, w9
Lloh11:
	adrp	x8, _F22TX@GOTPAGE
Lloh12:
	ldr	x8, [x8, _F22TX@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x20
	bl	_STV090x_WRITE_DEMOD
	tbnz	x0, #63, LBB0_4
; %bb.2:
Lloh14:
	adrp	x8, _F22RX@GOTPAGE
Lloh15:
	ldr	x8, [x8, _F22RX@GOTPAGEOFF]
Lloh16:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x20
	bl	_STV090x_WRITE_DEMOD
	tbnz	x0, #63, LBB0_4
; %bb.3:
	mov	w0, #0
	b	LBB0_5
LBB0_4:
Lloh17:
	adrp	x8, _FE_ERROR@GOTPAGE
Lloh18:
	ldr	x8, [x8, _FE_ERROR@GOTPAGEOFF]
Lloh19:
	ldr	w0, [x8]
Lloh20:
	adrp	x2, l_.str@PAGE
Lloh21:
	add	x2, x2, l_.str@PAGEOFF
	mov	w1, #1
	bl	_dprintk
	mov	w0, #-1
LBB0_5:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_STV090x_SYNTCTRL,4,2           ; @STV090x_SYNTCTRL
	.comm	_SELX1RATIO_FIELD,4,2           ; @SELX1RATIO_FIELD
	.comm	_STV090x_NCOARSE,4,2            ; @STV090x_NCOARSE
	.comm	_M_DIV_FIELD,4,2                ; @M_DIV_FIELD
	.comm	_F22TX,4,2                      ; @F22TX
	.comm	_F22RX,4,2                      ; @F22RX
	.comm	_FE_ERROR,4,2                   ; @FE_ERROR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"I/O error"

	.no_dead_strip	_stv090x_set_mclk
.subsections_via_symbols
