	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_b43legacy_calc_nrssi_threshold ## -- Begin function b43legacy_calc_nrssi_threshold
	.p2align	4, 0x90
_b43legacy_calc_nrssi_threshold:        ## @b43legacy_calc_nrssi_threshold
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movl	8(%rdi), %eax
	cmpl	$128, %eax
	je	LBB0_9
## %bb.1:
	cmpl	$129, %eax
	jne	LBB0_22
## %bb.2:
	cmpl	$8272, 12(%r14)                 ## imm = 0x2050
	jne	LBB0_23
## %bb.3:
	movq	(%r14), %rax
	movq	(%rax), %rax
	movq	_B43legacy_BFL_RSSI@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, (%rax)
	je	LBB0_23
## %bb.4:
	cmpl	$6, 16(%r14)
	movq	24(%r14), %rax
	movl	4(%rax), %edi
	jl	LBB0_6
## %bb.5:
	movl	(%rax), %eax
	subl	%eax, %edi
	shll	$5, %edi
	leal	(%rax,%rax,4), %eax
	leal	(%rdi,%rax,4), %eax
	addl	$20, %eax
	cltq
	imulq	$1717986919, %rax, %rdi         ## imm = 0x66666667
	movq	%rdi, %rax
	shrq	$63, %rax
	sarq	$36, %rdi
	addl	%eax, %edi
	jmp	LBB0_7
LBB0_9:
	cmpl	$0, 44(%r14)
	je	LBB0_11
## %bb.10:
	movq	(%r14), %rax
	movq	(%rax), %rax
	movq	_B43legacy_BFL_RSSI@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, (%rax)
	je	LBB0_11
## %bb.16:
	movl	40(%r14), %ecx
	movq	_B43legacy_RADIO_INTERFMODE_NONWLAN@GOTPCREL(%rip), %rdx
	movl	$10, %r15d
	movl	$14, %eax
	cmpl	(%rdx), %ecx
	je	LBB0_21
## %bb.17:
	cmpl	$0, 36(%r14)
	je	LBB0_18
LBB0_20:
	movl	$17, %r15d
	jmp	LBB0_21
LBB0_22:
	movl	$1, %edi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_B43legacy_BUG_ON               ## TAILCALL
LBB0_11:
	movq	%r14, %rdi
	movl	$32, %esi
	callq	_b43legacy_nrssi_hw_read
                                        ## kill: def $eax killed $eax def $rax
	leal	-64(%rax), %ebx
	cmpl	$32, %eax
	cmovll	%eax, %ebx
	movq	%r14, %rdi
	movl	$1162, %esi                     ## imm = 0x48A
	callq	_b43legacy_phy_read
	andl	$61440, %eax                    ## imm = 0xF000
	cmpl	$2, %ebx
	jg	LBB0_15
## %bb.12:
	orl	$2539, %eax                     ## imm = 0x9EB
	jmp	LBB0_13
LBB0_15:
	orl	$2797, %eax                     ## imm = 0xAED
LBB0_13:
	movq	%r14, %rdi
	movl	$1162, %esi                     ## imm = 0x48A
	movl	%eax, %edx
	jmp	LBB0_14
LBB0_6:
	addl	$-5, %edi
LBB0_7:
                                        ## kill: def $edi killed $edi killed $rdi
	xorl	%esi, %esi
	movl	$62, %edx
	callq	_clamp_val
	movl	%eax, %ebx
	movq	%r14, %rdi
	movl	$32, %esi
	callq	_b43legacy_phy_read
	shll	$8, %ebx
	orl	$28, %ebx
	movq	%r14, %rdi
	movl	$32, %esi
	movl	%ebx, %edx
	callq	_b43legacy_phy_write
	cmpl	$6, 16(%r14)
	jl	LBB0_23
## %bb.8:
	movq	%r14, %rdi
	movl	$135, %esi
	movl	$3597, %edx                     ## imm = 0xE0D
	callq	_b43legacy_phy_write
	movq	%r14, %rdi
	movl	$134, %esi
	movl	$3083, %edx                     ## imm = 0xC0B
	callq	_b43legacy_phy_write
	movq	%r14, %rdi
	movl	$133, %esi
	movl	$2569, %edx                     ## imm = 0xA09
	callq	_b43legacy_phy_write
	movq	%r14, %rdi
	movl	$132, %esi
	movl	$2056, %edx                     ## imm = 0x808
	callq	_b43legacy_phy_write
	movq	%r14, %rdi
	movl	$131, %esi
	movl	$2056, %edx                     ## imm = 0x808
	callq	_b43legacy_phy_write
	movq	%r14, %rdi
	movl	$130, %esi
	movl	$1540, %edx                     ## imm = 0x604
	callq	_b43legacy_phy_write
	movq	%r14, %rdi
	movl	$129, %esi
	movl	$770, %edx                      ## imm = 0x302
	callq	_b43legacy_phy_write
	movq	%r14, %rdi
	movl	$128, %esi
	movl	$256, %edx                      ## imm = 0x100
	jmp	LBB0_14
LBB0_23:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_18:
	cmpl	$0, 32(%r14)
	je	LBB0_20
## %bb.19:
	movl	$18, %r15d
	movl	$19, %eax
LBB0_21:
	movq	24(%r14), %rcx
	movl	(%rcx), %edi
	movl	4(%rcx), %ecx
	subl	%edi, %ecx
	imull	%eax, %ecx
	shll	$6, %edi
	addl	%ecx, %edi
	xorl	%eax, %eax
	cmpl	$32, %edi
	setl	%al
	subl	%eax, %edi
	addl	$32, %edi
	sarl	$6, %edi
	movl	$-31, %esi
	movl	$31, %edx
	callq	_clamp_val
	movl	%eax, %ebx
	movq	24(%r14), %rax
	movl	(%rax), %edi
	movl	4(%rax), %eax
	subl	%edi, %eax
	imull	%r15d, %eax
	shll	$6, %edi
	addl	%eax, %edi
	xorl	%eax, %eax
	cmpl	$32, %edi
	setl	%al
	subl	%eax, %edi
	addl	$32, %edi
	sarl	$6, %edi
	movl	$-31, %esi
	movl	$31, %edx
	callq	_clamp_val
	movl	%eax, %r15d
	movq	%r14, %rdi
	movl	$1162, %esi                     ## imm = 0x48A
	callq	_b43legacy_phy_read
	andl	$61440, %eax                    ## imm = 0xF000
	andl	$63, %r15d
	andl	$63, %ebx
	shll	$6, %ebx
	orl	%r15d, %ebx
	orl	%eax, %ebx
	movq	%r14, %rdi
	movl	$1162, %esi                     ## imm = 0x48A
	movl	%ebx, %edx
LBB0_14:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_b43legacy_phy_write            ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_B43legacy_BFL_RSSI,4,2         ## @B43legacy_BFL_RSSI
	.comm	_B43legacy_RADIO_INTERFMODE_NONWLAN,4,2 ## @B43legacy_RADIO_INTERFMODE_NONWLAN
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_b43legacy_calc_nrssi_threshold ; -- Begin function b43legacy_calc_nrssi_threshold
	.p2align	2
_b43legacy_calc_nrssi_threshold:        ; @b43legacy_calc_nrssi_threshold
	.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, x0
	ldr	w8, [x0, #8]
	cmp	w8, #128
	b.eq	LBB0_6
; %bb.1:
	cmp	w8, #129
	b.ne	LBB0_10
; %bb.2:
	ldr	w8, [x19, #12]
	mov	w9, #8272
	cmp	w8, w9
	b.ne	LBB0_24
; %bb.3:
	ldr	x8, [x19]
	ldr	x8, [x8]
	ldr	w8, [x8]
Lloh0:
	adrp	x9, _B43legacy_BFL_RSSI@GOTPAGE
Lloh1:
	ldr	x9, [x9, _B43legacy_BFL_RSSI@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_24
; %bb.4:
	ldr	w10, [x19, #16]
	ldr	x9, [x19, #24]
	ldr	w8, [x9, #4]
	cmp	w10, #6
	b.lt	LBB0_21
; %bb.5:
	ldr	w9, [x9]
	sub	w8, w8, w9
	mov	w10, #20
	mul	w9, w9, w10
	add	w8, w9, w8, lsl #5
	add	w8, w8, #20
	mov	w9, #26215
	movk	w9, #26214, lsl #16
	smull	x8, w8, w9
	lsr	x9, x8, #63
	asr	x8, x8, #36
	add	w0, w8, w9
	b	LBB0_22
LBB0_6:
	ldr	w8, [x19, #44]
	cbz	w8, LBB0_11
; %bb.7:
	ldr	x8, [x19]
	ldr	x8, [x8]
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _B43legacy_BFL_RSSI@GOTPAGE
Lloh4:
	ldr	x9, [x9, _B43legacy_BFL_RSSI@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_11
; %bb.8:
	ldr	w8, [x19, #40]
Lloh6:
	adrp	x9, _B43legacy_RADIO_INTERFMODE_NONWLAN@GOTPAGE
Lloh7:
	ldr	x9, [x9, _B43legacy_RADIO_INTERFMODE_NONWLAN@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	cmp	w8, w9
	b.ne	LBB0_15
; %bb.9:
	mov	w21, #10
	b	LBB0_17
LBB0_10:
	mov	w0, #1
	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
	b	_B43legacy_BUG_ON
LBB0_11:
	mov	x0, x19
	mov	w1, #32
	bl	_b43legacy_nrssi_hw_read
	sub	w8, w0, #64
	cmp	w0, #31
	csel	w20, w8, w0, gt
	mov	x0, x19
	mov	w1, #1162
	bl	_b43legacy_phy_read
	and	w8, w0, #0xf000
	cmp	w20, #2
	b.gt	LBB0_13
; %bb.12:
	mov	w9, #2539
	b	LBB0_14
LBB0_13:
	mov	w9, #2797
LBB0_14:
	orr	w2, w8, w9
	b	LBB0_19
LBB0_15:
	ldr	w8, [x19, #36]
	cbz	w8, LBB0_25
LBB0_16:
	mov	w21, #17
LBB0_17:
	mov	w8, #14
LBB0_18:
	ldr	x9, [x19, #24]
	ldp	w9, w10, [x9]
	sub	w10, w10, w9
	mul	w8, w10, w8
	add	w8, w8, w9, lsl #6
	cmp	w8, #32
	mov	w22, #31
	cinc	w9, w22, ge
	add	w8, w9, w8
	asr	w0, w8, #6
	mov	w1, #-31
	mov	w2, #31
	bl	_clamp_val
	mov	x20, x0
	ldr	x8, [x19, #24]
	ldp	w8, w9, [x8]
	sub	w9, w9, w8
	mul	w9, w9, w21
	add	w8, w9, w8, lsl #6
	cmp	w8, #32
	cinc	w9, w22, ge
	add	w8, w9, w8
	asr	w0, w8, #6
	mov	w1, #-31
	mov	w2, #31
	bl	_clamp_val
	mov	x21, x0
	mov	x0, x19
	mov	w1, #1162
	bl	_b43legacy_phy_read
	and	w8, w0, #0xf000
	and	w9, w21, #0x3f
	bfi	w9, w20, #6, #6
	orr	w2, w9, w8
LBB0_19:
	mov	x0, x19
	mov	w1, #1162
LBB0_20:
	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
	b	_b43legacy_phy_write
LBB0_21:
	sub	w0, w8, #5
LBB0_22:
	mov	w1, #0
	mov	w2, #62
	bl	_clamp_val
	mov	x20, x0
	mov	x0, x19
	mov	w1, #32
	bl	_b43legacy_phy_read
	mov	w2, #28
	bfi	w2, w20, #8, #24
	mov	x0, x19
	mov	w1, #32
	bl	_b43legacy_phy_write
	ldr	w8, [x19, #16]
	cmp	w8, #6
	b.lt	LBB0_24
; %bb.23:
	mov	x0, x19
	mov	w1, #135
	mov	w2, #3597
	bl	_b43legacy_phy_write
	mov	x0, x19
	mov	w1, #134
	mov	w2, #3083
	bl	_b43legacy_phy_write
	mov	x0, x19
	mov	w1, #133
	mov	w2, #2569
	bl	_b43legacy_phy_write
	mov	x0, x19
	mov	w1, #132
	mov	w2, #2056
	bl	_b43legacy_phy_write
	mov	x0, x19
	mov	w1, #131
	mov	w2, #2056
	bl	_b43legacy_phy_write
	mov	x0, x19
	mov	w1, #130
	mov	w2, #1540
	bl	_b43legacy_phy_write
	mov	x0, x19
	mov	w1, #129
	mov	w2, #770
	bl	_b43legacy_phy_write
	mov	x0, x19
	mov	w1, #128
	mov	w2, #256
	b	LBB0_20
LBB0_24:
	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
LBB0_25:
	ldr	w8, [x19, #32]
	cbz	w8, LBB0_16
; %bb.26:
	mov	w21, #18
	mov	w8, #19
	b	LBB0_18
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_B43legacy_BFL_RSSI,4,2         ; @B43legacy_BFL_RSSI
	.comm	_B43legacy_RADIO_INTERFMODE_NONWLAN,4,2 ; @B43legacy_RADIO_INTERFMODE_NONWLAN
.subsections_via_symbols
