	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function amrr_update
_amrr_update:                           ## @amrr_update
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r15
	movq	%rsi, %rbx
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	movl	(%rsi), %r14d
	movslq	%r14d, %r13
	movq	%rsi, %rdi
	callq	_is_enough
	movq	24(%rbx), %rsi
	movl	%eax, %edi
	callq	_KASSERT
	movq	%r15, %rdi
	callq	_amrr_node_is_11n
	xorl	%ecx, %ecx
	testq	%rax, %rax
	setne	%cl
	shlq	$4, %rcx
	leaq	(%rcx,%r15), %rax
	addq	$8, %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movl	(%r15), %edi
	movq	_IEEE80211_MSG_RATECTL@GOTPCREL(%rip), %rdx
	movq	8(%rcx,%r15), %rax
	movq	_IEEE80211_RATE_VAL@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r8d
	andl	(%rax,%r13,4), %r8d
	movl	(%rdx), %esi
	movq	16(%rbx), %rax
	movq	24(%rbx), %r9
	leaq	16(%rbx), %r12
	movq	%rax, (%rsp)
	leaq	L_.str.1(%rip), %rcx
	movq	%r15, %rdx
	callq	_IEEE80211_NOTE
	movq	%rbx, %rdi
	callq	_is_success
	testq	%rax, %rax
	je	LBB0_4
## %bb.1:
	movl	4(%rbx), %eax
	incl	%eax
	movl	%eax, 4(%rbx)
	cmpl	8(%rbx), %eax
	jl	LBB0_10
## %bb.2:
	leal	1(%r14), %ecx
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	cmpl	8(%rax), %ecx
	jge	LBB0_10
## %bb.3:
	movl	$1, 12(%rbx)
	movl	$0, 4(%rbx)
	movl	(%r15), %edi
	movq	_IEEE80211_MSG_RATECTL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rax
	movl	%ecx, %r14d
	movq	_IEEE80211_RATE_VAL@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r8d
	andl	4(%rax,%r13,4), %r8d
	movq	16(%rbx), %rax
	movq	24(%rbx), %r9
	movq	%rax, (%rsp)
	leaq	L_.str.2(%rip), %rcx
	movq	%r15, %rdx
	callq	_IEEE80211_NOTE
                                        ## kill: def $r14d killed $r14d def $r14
	jmp	LBB0_11
LBB0_4:
	movq	-56(%rbp), %r13                 ## 8-byte Reload
	movq	%rbx, %rdi
	callq	_is_failure
	testq	%rax, %rax
	je	LBB0_11
## %bb.5:
	movl	$0, 4(%rbx)
	testl	%r14d, %r14d
	jle	LBB0_10
## %bb.6:
	cmpl	$0, 12(%rbx)
	je	LBB0_8
## %bb.7:
	movl	8(%rbx), %eax
	addl	%eax, %eax
	movl	(%r13), %ecx
	cmpl	%ecx, %eax
	cmovgel	%ecx, %eax
	jmp	LBB0_9
LBB0_8:
	movl	4(%r13), %eax
LBB0_9:
	movl	%eax, 8(%rbx)
	decl	%r14d
	movl	(%r15), %edi
	movq	_IEEE80211_MSG_RATECTL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rax
	movq	_IEEE80211_RATE_VAL@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r8d
	andl	(%rax,%r14,4), %r8d
	movq	16(%rbx), %rax
	movq	24(%rbx), %r9
	movq	%rax, (%rsp)
	leaq	L_.str.3(%rip), %rcx
	movq	%r15, %rdx
	callq	_IEEE80211_NOTE
LBB0_10:
	movl	$0, 12(%rbx)
LBB0_11:
	xorps	%xmm0, %xmm0
	movups	%xmm0, (%r12)
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_IEEE80211_MSG_RATECTL,4,2      ## @IEEE80211_MSG_RATECTL
	.section	__TEXT,__cstring,cstring_literals
L_.str.1:                               ## @.str.1
	.asciz	"AMRR: current rate %d, txcnt=%d, retrycnt=%d"

	.comm	_IEEE80211_RATE_VAL,4,2         ## @IEEE80211_RATE_VAL
L_.str.2:                               ## @.str.2
	.asciz	"AMRR increasing rate %d (txcnt=%d retrycnt=%d)"

L_.str.3:                               ## @.str.3
	.asciz	"AMRR decreasing rate %d (txcnt=%d retrycnt=%d)"

	.no_dead_strip	_amrr_update
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function amrr_update
_amrr_update:                           ; @amrr_update
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x2
	mov	x19, x1
	mov	x22, x0
	ldrsw	x21, [x1]
	mov	x0, x1
	bl	_is_enough
	ldr	x1, [x19, #24]
	bl	_KASSERT
	mov	x0, x20
	bl	_amrr_node_is_11n
	add	x9, x20, #24
	mov	x10, x20
	ldr	w8, [x10], #8
	cmp	x0, #0
	csel	x24, x10, x9, eq
Lloh0:
	adrp	x26, _IEEE80211_MSG_RATECTL@GOTPAGE
Lloh1:
	ldr	x26, [x26, _IEEE80211_MSG_RATECTL@GOTPAGEOFF]
	ldr	w1, [x26]
	ldr	x9, [x24]
	ldr	w9, [x9, x21, lsl #2]
Lloh2:
	adrp	x25, _IEEE80211_RATE_VAL@GOTPAGE
Lloh3:
	ldr	x25, [x25, _IEEE80211_RATE_VAL@GOTPAGEOFF]
	ldr	w10, [x25]
	and	w4, w10, w9
	ldr	x5, [x19, #24]
	mov	x23, x19
	ldr	x6, [x23, #16]!
Lloh4:
	adrp	x3, l_.str.1@PAGE
Lloh5:
	add	x3, x3, l_.str.1@PAGEOFF
	mov	x0, x8
	mov	x2, x20
	bl	_IEEE80211_NOTE
	mov	x0, x19
	bl	_is_success
	cbz	x0, LBB0_4
; %bb.1:
	ldp	w8, w9, [x19, #4]
	add	w8, w8, #1
	str	w8, [x19, #4]
	cmp	w8, w9
	b.lt	LBB0_10
; %bb.2:
	add	w22, w21, #1
	ldr	w8, [x24, #8]
	cmp	w22, w8
	b.ge	LBB0_10
; %bb.3:
	mov	w8, #1
	str	w8, [x19, #12]
	str	wzr, [x19, #4]
	ldr	w0, [x20]
	ldr	w1, [x26]
	ldr	x8, [x24]
	ldr	w8, [x8, w22, sxtw #2]
	ldr	w9, [x25]
	and	w4, w9, w8
	ldp	x6, x5, [x19, #16]
Lloh6:
	adrp	x3, l_.str.2@PAGE
Lloh7:
	add	x3, x3, l_.str.2@PAGEOFF
	mov	x2, x20
	bl	_IEEE80211_NOTE
	mov	x21, x22
	b	LBB0_11
LBB0_4:
	mov	x0, x19
	bl	_is_failure
	cbz	x0, LBB0_11
; %bb.5:
	str	wzr, [x19, #4]
	subs	w27, w21, #1
	b.lt	LBB0_10
; %bb.6:
	ldr	w8, [x19, #12]
	cbz	w8, LBB0_8
; %bb.7:
	ldr	w8, [x19, #8]
	lsl	w8, w8, #1
	ldr	w9, [x22]
	cmp	w8, w9
	csel	w8, w8, w9, lt
	b	LBB0_9
LBB0_8:
	ldr	w8, [x22, #4]
LBB0_9:
	str	w8, [x19, #8]
	ldr	w0, [x20]
	ldr	w1, [x26]
	ldr	x8, [x24]
	ldr	w8, [x8, w27, uxtw #2]
	ldr	w9, [x25]
	and	w4, w9, w8
	ldp	x6, x5, [x19, #16]
Lloh8:
	adrp	x3, l_.str.3@PAGE
Lloh9:
	add	x3, x3, l_.str.3@PAGEOFF
	mov	x2, x20
	bl	_IEEE80211_NOTE
	mov	x21, x27
LBB0_10:
	str	wzr, [x19, #12]
LBB0_11:
	stp	xzr, xzr, [x23]
	mov	x0, x21
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_IEEE80211_MSG_RATECTL,4,2      ; @IEEE80211_MSG_RATECTL
	.section	__TEXT,__cstring,cstring_literals
l_.str.1:                               ; @.str.1
	.asciz	"AMRR: current rate %d, txcnt=%d, retrycnt=%d"

	.comm	_IEEE80211_RATE_VAL,4,2         ; @IEEE80211_RATE_VAL
l_.str.2:                               ; @.str.2
	.asciz	"AMRR increasing rate %d (txcnt=%d retrycnt=%d)"

l_.str.3:                               ; @.str.3
	.asciz	"AMRR decreasing rate %d (txcnt=%d retrycnt=%d)"

	.no_dead_strip	_amrr_update
.subsections_via_symbols
