	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mt76x0_phy_update_channel_gain
_mt76x0_phy_update_channel_gain:        ## @mt76x0_phy_update_channel_gain
	.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
	addq	$32, %rdi
	callq	_mt76_get_min_avg_rssi
	testl	%eax, %eax
	movl	$-75, %ebx
	cmovnel	%eax, %ebx
	movl	%ebx, (%r14)
	movq	%r14, %rdi
	callq	_mt76x02_get_rssi_gain_thresh
	xorl	%r15d, %r15d
	cmpl	%eax, %ebx
	setg	%r15b
	movl	(%r14), %ebx
	movq	%r14, %rdi
	callq	_mt76x02_get_low_rssi_gain_thresh
	xorl	%ecx, %ecx
	cmpl	%eax, %ebx
	setg	%cl
	addl	%r15d, %ecx
	movl	4(%r14), %eax
	movl	%ecx, 4(%r14)
	testl	%eax, %eax
	js	LBB0_4
## %bb.1:
	xorl	%ecx, %eax
	andl	$2, %eax
	jne	LBB0_4
## %bb.2:
	movq	%r14, %rdi
	callq	_mt76x02_phy_adjust_vga_gain
	testq	%rax, %rax
	je	LBB0_5
## %bb.3:
	movq	%r14, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_mt76x0_phy_set_gain_val        ## TAILCALL
LBB0_4:
	xorl	%eax, %eax
	cmpl	$2, %ecx
	movl	$10, %ecx
	cmovel	%eax, %ecx
	movl	%ecx, 8(%r14)
	movq	$-10, %rcx
	cmovneq	%rax, %rcx
	movq	16(%r14), %rax
	movq	24(%r14), %rdx
	addq	(%rax), %rcx
	movq	%rcx, (%rdx)
	movq	%r14, %rdi
	callq	_mt76x0_phy_set_gain_val
	movq	_MT_RX_STAT_1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_mt76_rr                        ## TAILCALL
LBB0_5:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MT_RX_STAT_1,4,2               ## @MT_RX_STAT_1
	.no_dead_strip	_mt76x0_phy_update_channel_gain
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mt76x0_phy_update_channel_gain
_mt76x0_phy_update_channel_gain:        ; @mt76x0_phy_update_channel_gain
	.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
	add	x0, x0, #32
	bl	_mt76_get_min_avg_rssi
	mov	w8, #-75
	cmp	w0, #0
	csel	w20, w8, w0, eq
	str	w20, [x19]
	mov	x0, x19
	bl	_mt76x02_get_rssi_gain_thresh
	cmp	w20, w0
	cset	w20, gt
	ldr	w21, [x19]
	mov	x0, x19
	bl	_mt76x02_get_low_rssi_gain_thresh
	cmp	w21, w0
	cinc	w8, w20, gt
	ldr	w9, [x19, #4]
	str	w8, [x19, #4]
	tbnz	w9, #31, LBB0_4
; %bb.1:
	eor	w9, w8, w9
	tbnz	w9, #1, LBB0_4
; %bb.2:
	mov	x0, x19
	bl	_mt76x02_phy_adjust_vga_gain
	cbz	x0, LBB0_5
; %bb.3:
	mov	x0, x19
	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	_mt76x0_phy_set_gain_val
LBB0_4:
	mov	w9, #10
	cmp	w8, #2
	csel	w8, wzr, w9, eq
	str	w8, [x19, #8]
	mov	x8, #-10
	csel	x8, x8, xzr, eq
	ldp	x9, x10, [x19, #16]
	ldr	x9, [x9]
	add	x8, x9, x8
	str	x8, [x10]
	mov	x0, x19
	bl	_mt76x0_phy_set_gain_val
Lloh0:
	adrp	x8, _MT_RX_STAT_1@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MT_RX_STAT_1@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x0, x19
	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	_mt76_rr
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	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_MT_RX_STAT_1,4,2               ; @MT_RX_STAT_1
	.no_dead_strip	_mt76x0_phy_update_channel_gain
.subsections_via_symbols
