	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function lgdt3305_read_snr
_lgdt3305_read_snr:                     ## @lgdt3305_read_snr
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	movq	(%rdi), %r15
	movl	(%r15), %eax
	leal	-129(%rax), %ecx
	cmpl	$2, %ecx
	jae	LBB0_1
## %bb.4:
	movq	_LGDT3305_CR_MSE_1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_read_reg
	movl	%eax, %ebx
	shll	$8, %ebx
	movq	_LGDT3305_CR_MSE_2@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_read_reg
	movzbl	%al, %r13d
	orl	%ebx, %r13d
	cmpl	$129, (%r15)
	movl	$97939837, %eax                 ## imm = 0x5D6717D
	movl	$98026066, %esi                 ## imm = 0x5D7C252
	cmovel	%eax, %esi
	jmp	LBB0_5
LBB0_1:
	cmpl	$128, %eax
	jne	LBB0_3
## %bb.2:
	movq	_LGDT3305_EQ_MSE_1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_read_reg
	movl	%eax, %ebx
	andl	$15, %ebx
	shll	$16, %ebx
	movq	_LGDT3305_EQ_MSE_2@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_read_reg
	movl	%eax, %r12d
	shll	$8, %r12d
	orl	%ebx, %r12d
	movq	_LGDT3305_EQ_MSE_3@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_read_reg
	movzbl	%al, %r13d
	orl	%r12d, %r13d
	movl	$73957994, %esi                 ## imm = 0x468826A
LBB0_5:
	movl	%r13d, %edi
	callq	_calculate_snr
	movl	%eax, 4(%r15)
	cltq
	imulq	$-1610611775, %rax, %rcx        ## imm = 0xA00003C1
	shrq	$32, %rcx
	addl	%ecx, %eax
	movl	%eax, %ecx
	shrl	$31, %ecx
	sarl	$20, %eax
	addl	%ecx, %eax
	movl	%eax, (%r14)
	movl	4(%r15), %eax
	movl	%eax, %edx
	sarl	$24, %edx
	shrl	$8, %eax
	movzwl	%ax, %eax
	imull	$100, %eax, %ecx
	shrl	$16, %ecx
	leaq	L_.str(%rip), %rdi
	movl	%r13d, %esi
	callq	_lg_dbg
	xorl	%eax, %eax
	jmp	LBB0_6
LBB0_3:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_6:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_LGDT3305_EQ_MSE_1,4,2          ## @LGDT3305_EQ_MSE_1
	.comm	_LGDT3305_EQ_MSE_2,4,2          ## @LGDT3305_EQ_MSE_2
	.comm	_LGDT3305_EQ_MSE_3,4,2          ## @LGDT3305_EQ_MSE_3
	.comm	_LGDT3305_CR_MSE_1,4,2          ## @LGDT3305_CR_MSE_1
	.comm	_LGDT3305_CR_MSE_2,4,2          ## @LGDT3305_CR_MSE_2
	.comm	_EINVAL,4,2                     ## @EINVAL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"noise = 0x%08x, snr = %d.%02d dB\n"

	.comm	_LGDT3305_PT_MSE_1,4,2          ## @LGDT3305_PT_MSE_1
	.comm	_LGDT3305_PT_MSE_2,4,2          ## @LGDT3305_PT_MSE_2
	.comm	_LGDT3305_PT_MSE_3,4,2          ## @LGDT3305_PT_MSE_3
	.no_dead_strip	_lgdt3305_read_snr
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function lgdt3305_read_snr
_lgdt3305_read_snr:                     ; @lgdt3305_read_snr
	.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	x19, x1
	ldr	x20, [x0]
	ldr	w8, [x20]
	sub	w9, w8, #129
	cmp	w9, #2
	b.hs	LBB0_2
; %bb.1:
Lloh0:
	adrp	x8, _LGDT3305_CR_MSE_1@GOTPAGE
Lloh1:
	ldr	x8, [x8, _LGDT3305_CR_MSE_1@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_read_reg
	mov	x22, x0
Lloh3:
	adrp	x8, _LGDT3305_CR_MSE_2@GOTPAGE
Lloh4:
	ldr	x8, [x8, _LGDT3305_CR_MSE_2@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_read_reg
	mov	x21, x0
	bfi	w21, w22, #8, #24
	ldr	w8, [x20]
	mov	w9, #49746
	movk	w9, #1495, lsl #16
	mov	w10, #29053
	movk	w10, #1494, lsl #16
	cmp	w8, #129
	csel	w1, w10, w9, eq
	b	LBB0_4
LBB0_2:
	cmp	w8, #128
	b.ne	LBB0_5
; %bb.3:
Lloh6:
	adrp	x8, _LGDT3305_EQ_MSE_1@GOTPAGE
Lloh7:
	ldr	x8, [x8, _LGDT3305_EQ_MSE_1@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_read_reg
	ubfiz	w21, w0, #16, #4
Lloh9:
	adrp	x8, _LGDT3305_EQ_MSE_2@GOTPAGE
Lloh10:
	ldr	x8, [x8, _LGDT3305_EQ_MSE_2@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_read_reg
	orr	w21, w21, w0, lsl #8
Lloh12:
	adrp	x8, _LGDT3305_EQ_MSE_3@GOTPAGE
Lloh13:
	ldr	x8, [x8, _LGDT3305_EQ_MSE_3@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_read_reg
	bfxil	w21, w0, #0, #8
	mov	w1, #33386
	movk	w1, #1128, lsl #16
LBB0_4:
	mov	x0, x21
	bl	_calculate_snr
	str	w0, [x20, #4]
	mov	w8, #961
	movk	w8, #40960, lsl #16
	smull	x8, w0, w8
	lsr	x8, x8, #32
	add	w8, w8, w0
	asr	w9, w8, #20
	add	w8, w9, w8, lsr #31
	str	w8, [x19]
	ldr	w8, [x20, #4]
	asr	w2, w8, #24
	ubfx	w8, w8, #8, #16
	mov	w9, #100
	mul	w8, w8, w9
	lsr	w3, w8, #16
Lloh15:
	adrp	x0, l_.str@PAGE
Lloh16:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x21
	bl	_lg_dbg
	mov	w0, #0
	b	LBB0_6
LBB0_5:
Lloh17:
	adrp	x8, _EINVAL@GOTPAGE
Lloh18:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_6:
	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	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_LGDT3305_EQ_MSE_1,4,2          ; @LGDT3305_EQ_MSE_1
	.comm	_LGDT3305_EQ_MSE_2,4,2          ; @LGDT3305_EQ_MSE_2
	.comm	_LGDT3305_EQ_MSE_3,4,2          ; @LGDT3305_EQ_MSE_3
	.comm	_LGDT3305_CR_MSE_1,4,2          ; @LGDT3305_CR_MSE_1
	.comm	_LGDT3305_CR_MSE_2,4,2          ; @LGDT3305_CR_MSE_2
	.comm	_EINVAL,4,2                     ; @EINVAL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"noise = 0x%08x, snr = %d.%02d dB\n"

	.comm	_LGDT3305_PT_MSE_1,4,2          ; @LGDT3305_PT_MSE_1
	.comm	_LGDT3305_PT_MSE_2,4,2          ; @LGDT3305_PT_MSE_2
	.comm	_LGDT3305_PT_MSE_3,4,2          ; @LGDT3305_PT_MSE_3
	.no_dead_strip	_lgdt3305_read_snr
.subsections_via_symbols
