	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function wlc_lcnphy_calc_rx_iq_comp
_wlc_lcnphy_calc_rx_iq_comp:            ## @wlc_lcnphy_calc_rx_iq_comp
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r12
	movq	%rdi, %rbx
	xorps	%xmm0, %xmm0
	movaps	%xmm0, -96(%rbp)
	movaps	%xmm0, -112(%rbp)
	movq	$0, -80(%rbp)
	movq	(%rdi), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movl	$1605, %esi                     ## imm = 0x645
	callq	_read_phy_reg
	movl	%eax, %r14d
	movq	%rbx, %rdi
	movl	$1606, %esi                     ## imm = 0x646
	callq	_read_phy_reg
	movl	%eax, %r15d
	xorl	%r13d, %r13d
	movq	%rbx, %rdi
	movl	$1745, %esi                     ## imm = 0x6D1
	movl	$4, %edx
	xorl	%ecx, %ecx
	callq	_mod_phy_reg
	movq	%rbx, %rdi
	movl	$1611, %esi                     ## imm = 0x64B
	movl	$64, %edx
	movl	$64, %ecx
	callq	_mod_phy_reg
	movq	%rbx, %rdi
	xorl	%esi, %esi
	xorl	%edx, %edx
	callq	_wlc_lcnphy_set_rx_iq_comp
	leaq	-112(%rbp), %rcx
	movq	%rbx, %rdi
	movq	%r12, %rsi
	movl	$32, %edx
	callq	_wlc_lcnphy_rx_iq_est
	testl	%eax, %eax
	je	LBB0_11
## %bb.1:
	movq	-112(%rbp), %r12
	movq	-104(%rbp), %rdx
	leaq	(%rdx,%r12), %rcx
	cmpq	$2, %rcx
	jl	LBB0_11
## %bb.2:
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	-96(%rbp), %rax
	movslq	%eax, %r14
	movq	%r14, %rdi
	movq	%rdx, %r13
	callq	_wlc_phy_nbits
	movl	%eax, %r15d
	movq	%r13, -56(%rbp)                 ## 8-byte Spill
	movq	%r13, %rdi
	callq	_wlc_phy_nbits
	movl	%eax, %esi
	movb	$30, %cl
	subb	%r15b, %cl
	shll	%cl, %r14d
	movl	%r15d, %edx
	addl	$-20, %edx
	js	LBB0_5
## %bb.3:
	leal	-19(%r15), %ecx
	movq	%r12, %rax
                                        ## kill: def $cl killed $cl killed $ecx
	sarq	%cl, %rax
	movq	%r12, %rdi
	movl	%edx, %ecx
	sarq	%cl, %rdi
	testl	%edi, %edi
	jne	LBB0_6
	jmp	LBB0_4
LBB0_5:
	movb	$19, %cl
	subb	%r15b, %cl
	movq	%r12, %rax
	shlq	%cl, %rax
	movb	$20, %cl
	subb	%r15b, %cl
	movq	%r12, %rdi
	shlq	%cl, %rdi
	testl	%edi, %edi
	je	LBB0_4
LBB0_6:
	subl	%r14d, %eax
                                        ## kill: def $eax killed $eax killed $rax
	cltd
	idivl	%edi
	movl	%eax, %r14d
	cmpl	$11, %esi
	jl	LBB0_9
## %bb.7:
	leal	-11(%rsi), %ecx
                                        ## kill: def $cl killed $cl killed $ecx
	sarq	%cl, %r12
	testl	%r12d, %r12d
	jne	LBB0_10
LBB0_4:
	xorl	%r13d, %r13d
	jmp	LBB0_12
LBB0_9:
	movb	$11, %cl
	subb	%sil, %cl
	shlq	%cl, %r12
	testl	%r12d, %r12d
	je	LBB0_4
LBB0_10:
	movb	$31, %cl
	subb	%sil, %cl
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	shlq	%cl, %rax
                                        ## kill: def $eax killed $eax killed $rax
	cltd
	idivl	%r12d
	movl	%r14d, %ecx
	imull	%r14d, %ecx
	subl	%ecx, %eax
	movslq	%eax, %rdi
	callq	_int_sqrt
	movq	%rax, %r15
	addl	$-1024, %r15d                   ## imm = 0xFC00
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, %r13d
LBB0_11:
	andl	$1023, %r14d                    ## imm = 0x3FF
	andl	$1023, %r15d                    ## imm = 0x3FF
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movq	%r15, %rdx
	callq	_wlc_lcnphy_set_rx_iq_comp
	movq	%rbx, %rdi
	movl	$1611, %esi                     ## imm = 0x64B
	movl	$1, %edx
	movl	$1, %ecx
	callq	_mod_phy_reg
	movq	%rbx, %rdi
	movl	$1611, %esi                     ## imm = 0x64B
	movl	$8, %edx
	movl	$8, %ecx
	callq	_mod_phy_reg
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movq	%r14, 8(%rax)
	movq	%r15, (%rax)
LBB0_12:
	movl	%r13d, %eax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_LCNPHY_MIN_RXIQ_PWR,8,3        ## @LCNPHY_MIN_RXIQ_PWR
	.no_dead_strip	_wlc_lcnphy_calc_rx_iq_comp
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function wlc_lcnphy_calc_rx_iq_comp
_wlc_lcnphy_calc_rx_iq_comp:            ; @wlc_lcnphy_calc_rx_iq_comp
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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	x20, x1
	mov	x19, x0
	str	xzr, [sp, #32]
	movi.2d	v0, #0000000000000000
	stp	q0, q0, [sp]
	ldr	x24, [x0]
	mov	w1, #1605
	bl	_read_phy_reg
	mov	x21, x0
	mov	x0, x19
	mov	w1, #1606
	bl	_read_phy_reg
	mov	x23, x0
	mov	x0, x19
	mov	w1, #1745
	mov	w2, #4
	mov	w3, #0
	bl	_mod_phy_reg
	mov	x0, x19
	mov	w1, #1611
	mov	w2, #64
	mov	w3, #64
	bl	_mod_phy_reg
	mov	x0, x19
	mov	x1, #0
	mov	x2, #0
	bl	_wlc_lcnphy_set_rx_iq_comp
	mov	x3, sp
	mov	x0, x19
	mov	x1, x20
	mov	w2, #32
	bl	_wlc_lcnphy_rx_iq_est
	mov	x20, x0
	cbz	w0, LBB0_11
; %bb.1:
	ldp	x25, x22, [sp]
	add	x8, x22, x25
	cmp	x8, #2
	b.ge	LBB0_3
; %bb.2:
	mov	w20, #0
	b	LBB0_11
LBB0_3:
	ldr	x23, [sp, #16]
	sxtw	x0, w23
	bl	_wlc_phy_nbits
	mov	x21, x0
	mov	x0, x22
	bl	_wlc_phy_nbits
	subs	w8, w21, #20
	b.mi	LBB0_7
; %bb.4:
	asr	x8, x25, x8
	cbz	w8, LBB0_13
; %bb.5:
	sub	w9, w21, #19
	asr	x9, x25, x9
	subs	w10, w0, #11
	b.lt	LBB0_9
LBB0_6:
	asr	x10, x25, x10
	cbnz	w10, LBB0_10
	b	LBB0_13
LBB0_7:
	mov	w8, #20
	sub	w8, w8, w21
	lsl	x8, x25, x8
                                        ; kill: def $w8 killed $w8 killed $x8 def $x8
	cbz	w8, LBB0_13
; %bb.8:
	mov	w9, #19
	sub	w9, w9, w21
	lsl	x9, x25, x9
	subs	w10, w0, #11
	b.ge	LBB0_6
LBB0_9:
	mov	w10, #11
	sub	w10, w10, w0
	lsl	x11, x25, x10
	mov	x10, x11
	cbz	w11, LBB0_13
LBB0_10:
	mov	w11, #30
	sub	w11, w11, w21
	lsl	w11, w23, w11
	sub	w9, w9, w11
	sdiv	w21, w9, w8
	mov	w8, #31
	sub	w8, w8, w0
	lsl	x8, x22, x8
	sdiv	w8, w8, w10
	msub	w8, w21, w21, w8
	sxtw	x0, w8
	bl	_int_sqrt
	sub	w23, w0, #1024
LBB0_11:
	and	w21, w21, #0x3ff
	and	w22, w23, #0x3ff
	mov	x0, x19
	mov	x1, x21
	mov	x2, x22
	bl	_wlc_lcnphy_set_rx_iq_comp
	mov	x0, x19
	mov	w1, #1611
	mov	w2, #1
	mov	w3, #1
	bl	_mod_phy_reg
	mov	x0, x19
	mov	w1, #1611
	mov	w2, #8
	mov	w3, #8
	bl	_mod_phy_reg
	stp	x22, x21, [x24]
LBB0_12:
	mov	x0, x20
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_13:
	mov	w20, #0
	b	LBB0_12
	.cfi_endproc
                                        ; -- End function
	.comm	_LCNPHY_MIN_RXIQ_PWR,8,3        ; @LCNPHY_MIN_RXIQ_PWR
	.no_dead_strip	_wlc_lcnphy_calc_rx_iq_comp
.subsections_via_symbols
