	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mt7603_edcca_check
_mt7603_edcca_check:                    ## @mt7603_edcca_check
	.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	%rdi, %r14
	movl	$41, %edi
	callq	_MT_AGC
	movq	%r14, %rdi
	movl	%eax, %esi
	callq	_mt76_rr
	cmpl	$0, 12(%r14)
	je	LBB0_13
## %bb.1:
	movl	%eax, %r15d
	movq	_MT_AGC_41_RSSI_0@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	%r15d, %esi
	callq	_FIELD_GET
                                        ## kill: def $eax killed $eax def $rax
	leal	-256(%rax), %ebx
	cmpl	$129, %eax
	cmovll	%eax, %ebx
	movq	_MT_AGC_41_RSSI_1@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	%r15d, %esi
	callq	_FIELD_GET
                                        ## kill: def $eax killed $eax def $rax
	leal	-256(%rax), %esi
	cmpl	$129, %eax
	cmovll	%eax, %esi
	movl	%ebx, %edi
	callq	_max
	movl	(%r14), %ecx
	movq	_MT7603_EDCCA_BLOCK_TH@GOTPCREL(%rip), %rdx
	cmpl	$-40, %eax
	jl	LBB0_3
## %bb.2:
	movl	$1, %eax
	cmpl	(%rdx), %ecx
	jl	LBB0_4
LBB0_3:
	movl	$-1, %eax
	testl	%ecx, %ecx
	jle	LBB0_5
LBB0_4:
	addl	%eax, %ecx
	movl	%ecx, (%r14)
LBB0_5:
	xorl	%r13d, %r13d
	xorl	%eax, %eax
	callq	_ktime_get_boottime
	movl	%eax, %ebx
	movq	_MT_MIB_STAT_ED@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_mt76_rr
	movl	%eax, %r15d
	movq	_MT_MIB_STAT_ED_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	movl	8(%r14), %esi
	movl	%ebx, %edi
	callq	_ktime_sub
	movl	%eax, %edi
	callq	_ktime_to_us
	movl	%ebx, 8(%r14)
	testl	%eax, %eax
	je	LBB0_13
## %bb.6:
	movl	%eax, %ecx
	andl	%r15d, %r12d
	imull	$100, %r12d, %eax
	cltd
	idivl	%ecx
	movl	4(%r14), %ecx
	xorl	%edx, %edx
	xorl	%esi, %esi
	testl	%ecx, %ecx
	setg	%dl
	sets	%sil
	xorl	%edi, %edi
	cmpl	$91, %eax
	setge	%dil
	cmovgel	%esi, %edx
	testb	%dl, %dl
	cmovel	%ecx, %r13d
	leal	-1(%r13,%rdi,2), %eax
	movl	%eax, 4(%r14)
	movq	_MT7603_EDCCA_BLOCK_TH@GOTPCREL(%rip), %rbx
	movl	(%rbx), %ecx
	movl	$1, %esi
	cmpl	%ecx, %eax
	jg	LBB0_9
## %bb.7:
	movl	%ecx, %edx
	shrl	$31, %edx
	addl	%ecx, %edx
	sarl	%edx
	cmpl	%edx, (%r14)
	jl	LBB0_9
## %bb.8:
	negl	%ecx
	xorl	%esi, %esi
	cmpl	%ecx, %eax
	jge	LBB0_10
LBB0_9:
	movq	%r14, %rdi
	callq	_mt7603_edcca_set_strict
LBB0_10:
	movl	4(%r14), %ecx
	movl	(%rbx), %eax
	cmpl	%eax, %ecx
	jg	LBB0_12
## %bb.11:
	negl	%eax
	cmpl	%eax, %ecx
	jge	LBB0_13
LBB0_12:
	movl	%eax, 4(%r14)
LBB0_13:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MT_AGC_41_RSSI_0,4,2           ## @MT_AGC_41_RSSI_0
	.comm	_MT_AGC_41_RSSI_1,4,2           ## @MT_AGC_41_RSSI_1
	.comm	_MT7603_EDCCA_BLOCK_TH,4,2      ## @MT7603_EDCCA_BLOCK_TH
	.comm	_MT_MIB_STAT_ED,4,2             ## @MT_MIB_STAT_ED
	.comm	_MT_MIB_STAT_ED_MASK,4,2        ## @MT_MIB_STAT_ED_MASK
	.no_dead_strip	_mt7603_edcca_check
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mt7603_edcca_check
_mt7603_edcca_check:                    ; @mt7603_edcca_check
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x19, x0
	mov	w0, #41
	bl	_MT_AGC
	mov	x1, x0
	mov	x0, x19
	bl	_mt76_rr
	ldr	w8, [x19, #12]
	cbz	w8, LBB0_15
; %bb.1:
	mov	x20, x0
Lloh0:
	adrp	x8, _MT_AGC_41_RSSI_0@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MT_AGC_41_RSSI_0@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	mov	x1, x20
	bl	_FIELD_GET
	sub	w8, w0, #256
	cmp	w0, #128
	csel	w21, w8, w0, gt
Lloh3:
	adrp	x8, _MT_AGC_41_RSSI_1@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MT_AGC_41_RSSI_1@GOTPAGEOFF]
Lloh5:
	ldr	w0, [x8]
	mov	x1, x20
	bl	_FIELD_GET
	sub	w8, w0, #256
	cmp	w0, #128
	csel	w1, w8, w0, gt
	mov	x0, x21
	bl	_max
	ldr	w8, [x19]
Lloh6:
	adrp	x22, _MT7603_EDCCA_BLOCK_TH@GOTPAGE
Lloh7:
	ldr	x22, [x22, _MT7603_EDCCA_BLOCK_TH@GOTPAGEOFF]
	ldr	w9, [x22]
	cmn	w0, #40
	ccmp	w8, w9, #0, ge
	b.lt	LBB0_4
; %bb.2:
	cmp	w8, #1
	b.lt	LBB0_6
; %bb.3:
	mov	w9, #-1
	b	LBB0_5
LBB0_4:
	mov	w9, #1
LBB0_5:
	add	w8, w8, w9
	str	w8, [x19]
LBB0_6:
	bl	_ktime_get_boottime
	mov	x21, x0
Lloh8:
	adrp	x8, _MT_MIB_STAT_ED@GOTPAGE
Lloh9:
	ldr	x8, [x8, _MT_MIB_STAT_ED@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_mt76_rr
	mov	x20, x0
Lloh11:
	adrp	x8, _MT_MIB_STAT_ED_MASK@GOTPAGE
Lloh12:
	ldr	x8, [x8, _MT_MIB_STAT_ED_MASK@GOTPAGEOFF]
Lloh13:
	ldr	w23, [x8]
	ldr	w1, [x19, #8]
	mov	x0, x21
	bl	_ktime_sub
	bl	_ktime_to_us
	str	w21, [x19, #8]
	cbz	w0, LBB0_15
; %bb.7:
	and	w8, w23, w20
	mov	w9, #100
	mul	w8, w8, w9
	sdiv	w8, w8, w0
	ldr	w9, [x19, #4]
	cmp	w9, #0
	cset	w10, gt
	cset	w11, lt
	cmp	w8, #90
	csel	w8, w11, w10, gt
	mov	w1, #1
	cneg	w10, w1, le
	cmp	w8, #0
	csel	w8, wzr, w9, ne
	ldr	w9, [x22]
	add	w8, w8, w10
	cmp	w8, w9
	str	w8, [x19, #4]
	b.gt	LBB0_11
; %bb.8:
	ldr	w10, [x19]
	cmp	w9, #0
	cinc	w11, w9, lt
	cmp	w10, w11, asr #1
	b.ge	LBB0_10
; %bb.9:
	mov	w1, #1
	b	LBB0_11
LBB0_10:
	mov	w1, #0
	neg	w9, w9
	cmp	w8, w9
	b.ge	LBB0_12
LBB0_11:
	mov	x0, x19
	bl	_mt7603_edcca_set_strict
LBB0_12:
	ldr	w9, [x19, #4]
	ldr	w8, [x22]
	cmp	w9, w8
	b.gt	LBB0_14
; %bb.13:
	neg	w8, w8
	cmp	w9, w8
	b.ge	LBB0_15
LBB0_14:
	str	w8, [x19, #4]
LBB0_15:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_MT_AGC_41_RSSI_0,4,2           ; @MT_AGC_41_RSSI_0
	.comm	_MT_AGC_41_RSSI_1,4,2           ; @MT_AGC_41_RSSI_1
	.comm	_MT7603_EDCCA_BLOCK_TH,4,2      ; @MT7603_EDCCA_BLOCK_TH
	.comm	_MT_MIB_STAT_ED,4,2             ; @MT_MIB_STAT_ED
	.comm	_MT_MIB_STAT_ED_MASK,4,2        ; @MT_MIB_STAT_ED_MASK
	.no_dead_strip	_mt7603_edcca_check
.subsections_via_symbols
