	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ieee80211_pwrsave              ## -- Begin function ieee80211_pwrsave
	.p2align	4, 0x90
_ieee80211_pwrsave:                     ## @ieee80211_pwrsave
	.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	%rsi, %r15
	movq	%rdi, %r13
	leaq	24(%rdi), %r12
	movq	8(%rdi), %rbx
	movq	16(%rdi), %r14
	movq	%r12, %rdi
	callq	_IEEE80211_PSQ_LOCK
	movl	24(%r13), %eax
	cmpl	28(%r13), %eax
	jge	LBB0_1
## %bb.2:
	movl	(%r13), %edi
	imull	(%rbx), %edi
	shll	$2, %edi
	callq	_IEEE80211_TU_TO_MS
	cltq
	imulq	$274877907, %rax, %rbx          ## imm = 0x10624DD3
	movq	%rbx, %rax
	shrq	$63, %rax
	sarq	$38, %rbx
	addl	%eax, %ebx
	movq	_M_ENCAP@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	xorl	%ecx, %ecx
	testl	%eax, (%r15)
	sete	%cl
	movq	40(%r13), %rax
	leaq	(%rcx,%rcx,2), %rcx
	leaq	(%rax,%rcx,8), %rsi
	movq	8(%rax,%rcx,8), %rdx
	testq	%rdx, %rdx
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	je	LBB0_3
## %bb.7:
	movq	%r15, 8(%rdx)
	movq	16(%rax,%rcx,8), %rdi
LBB0_8:
	callq	_M_AGE_GET
	subl	%eax, %ebx
LBB0_9:
	movslq	%ebx, %r14
	notl	%ebx
	shrl	$31, %ebx
	movl	%ebx, %edi
	movq	%r14, %rsi
	callq	_KASSERT
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_M_AGE_SET
	movq	$0, 8(%r15)
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	%r15, 8(%rax)
	incl	(%rax)
	movl	24(%r13), %r15d
	leal	1(%r15), %ebx
	movl	%ebx, 24(%r13)
	movq	%r12, %rdi
	callq	_IEEE80211_PSQ_UNLOCK
	movq	_IEEE80211_MSG_POWER@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.2(%rip), %rcx
	movq	-56(%rbp), %r12                 ## 8-byte Reload
	movq	%r12, %rdi
	movq	%r13, %rdx
	movl	%r14d, %r8d
	movl	%ebx, %r9d
	callq	_IEEE80211_NOTE
	xorl	%ebx, %ebx
	testl	%r15d, %r15d
	jne	LBB0_12
## %bb.10:
	movq	(%r12), %rcx
	testq	%rcx, %rcx
	je	LBB0_12
## %bb.11:
	movq	%r13, %rdi
	movl	$1, %esi
	callq	*%rcx
	jmp	LBB0_12
LBB0_1:
	incl	32(%r13)
	movq	%r12, %rdi
	callq	_IEEE80211_PSQ_UNLOCK
	movq	_IEEE80211_MSG_ANY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	24(%r13), %r9d
	movl	32(%r13), %r8d
	leaq	L_.str(%rip), %rcx
	movq	%r14, %rdi
	movq	%r13, %rdx
	callq	_IEEE80211_NOTE
	movq	%r15, %rdi
	callq	_psq_mfree
	movq	_ENOSPC@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
LBB0_12:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	movq	%r15, 16(%rax,%rcx,8)
	leaq	24(%rax), %rcx
	cmpq	%rcx, %rsi
	je	LBB0_4
## %bb.5:
	movq	40(%rax), %r14
	testq	%r14, %r14
	je	LBB0_9
## %bb.6:
	movq	%r14, %rdi
	callq	_M_AGE_GET
	subl	%ebx, %eax
	xorl	%esi, %esi
	testl	%eax, %eax
	cmovgl	%eax, %esi
	movq	%r14, %rdi
	callq	_M_AGE_SET
	jmp	LBB0_9
LBB0_4:
	movq	16(%rax), %rdi
	testq	%rdi, %rdi
	jne	LBB0_8
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.comm	_IEEE80211_MSG_ANY,4,2          ## @IEEE80211_MSG_ANY
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"pwr save q overflow, drops %d (size %d)"

	.comm	_ENOSPC,4,2                     ## @ENOSPC
	.comm	_M_ENCAP,4,2                    ## @M_ENCAP
	.comm	_IEEE80211_MSG_POWER,4,2        ## @IEEE80211_MSG_POWER
L_.str.2:                               ## @.str.2
	.asciz	"save frame with age %d, %u now queued"

	.comm	_caddr_t,4,2                    ## @caddr_t
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ieee80211_pwrsave              ; -- Begin function ieee80211_pwrsave
	.p2align	2
_ieee80211_pwrsave:                     ; @ieee80211_pwrsave
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x21, x1
	mov	x19, x0
	add	x22, x0, #24
	ldp	x23, x20, [x0, #8]
	mov	x0, x22
	bl	_IEEE80211_PSQ_LOCK
	ldp	w8, w9, [x19, #24]
	cmp	w8, w9
	b.ge	LBB0_8
; %bb.1:
	ldr	w8, [x19]
	ldr	w9, [x23]
	mul	w8, w8, w9
	lsl	w0, w8, #2
	bl	_IEEE80211_TU_TO_MS
	mov	w8, #19923
	movk	w8, #4194, lsl #16
	smull	x8, w0, w8
	lsr	x9, x8, #63
	asr	x8, x8, #38
	add	w23, w8, w9
	ldr	w8, [x21]
Lloh0:
	adrp	x9, _M_ENCAP@GOTPAGE
Lloh1:
	ldr	x9, [x9, _M_ENCAP@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	cset	w9, eq
	ldr	x8, [x19, #40]
	mov	w10, #24
	umaddl	x25, w9, w10, x8
	mov	x26, x25
	ldr	x10, [x26, #8]!
	cbz	x10, LBB0_10
; %bb.2:
	str	x21, [x10, #8]
	mov	w10, #24
	madd	x8, x9, x10, x8
	ldr	x0, [x8, #16]
LBB0_3:
	bl	_M_AGE_GET
	sub	w23, w23, w0
LBB0_4:
	mvn	w8, w23
	lsr	w0, w8, #31
	sxtw	x1, w23
	bl	_KASSERT
	mov	x0, x21
	mov	x1, x23
	bl	_M_AGE_SET
	str	xzr, [x21, #8]
	str	x21, [x26]
	ldr	w8, [x25]
	add	w8, w8, #1
	str	w8, [x25]
	ldr	w24, [x19, #24]
	add	w21, w24, #1
	str	w21, [x19, #24]
	mov	x0, x22
	bl	_IEEE80211_PSQ_UNLOCK
Lloh3:
	adrp	x8, _IEEE80211_MSG_POWER@GOTPAGE
Lloh4:
	ldr	x8, [x8, _IEEE80211_MSG_POWER@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
Lloh6:
	adrp	x3, l_.str.2@PAGE
Lloh7:
	add	x3, x3, l_.str.2@PAGEOFF
	mov	x0, x20
	mov	x2, x19
	mov	x4, x23
	mov	x5, x21
	bl	_IEEE80211_NOTE
	cbnz	w24, LBB0_7
; %bb.5:
	ldr	x8, [x20]
	cbz	x8, LBB0_7
; %bb.6:
	mov	x0, x19
	mov	w1, #1
	blr	x8
LBB0_7:
	mov	w0, #0
	b	LBB0_9
LBB0_8:
	ldr	w8, [x19, #32]
	add	w8, w8, #1
	str	w8, [x19, #32]
	mov	x0, x22
	bl	_IEEE80211_PSQ_UNLOCK
Lloh8:
	adrp	x8, _IEEE80211_MSG_ANY@GOTPAGE
Lloh9:
	ldr	x8, [x8, _IEEE80211_MSG_ANY@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	ldr	w4, [x19, #32]
	ldr	w5, [x19, #24]
Lloh11:
	adrp	x3, l_.str@PAGE
Lloh12:
	add	x3, x3, l_.str@PAGEOFF
	mov	x0, x20
	mov	x2, x19
	bl	_IEEE80211_NOTE
	mov	x0, x21
	bl	_psq_mfree
Lloh13:
	adrp	x8, _ENOSPC@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ENOSPC@GOTPAGEOFF]
Lloh15:
	ldr	w0, [x8]
LBB0_9:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_10:
	mov	w10, #24
	madd	x9, x9, x10, x8
	str	x21, [x9, #16]
	add	x9, x8, #24
	cmp	x25, x9
	b.eq	LBB0_13
; %bb.11:
	ldr	x24, [x8, #40]
	cbz	x24, LBB0_4
; %bb.12:
	mov	x0, x24
	bl	_M_AGE_GET
	sub	w8, w0, w23
	cmp	w8, #0
	csel	w1, w8, wzr, gt
	mov	x0, x24
	bl	_M_AGE_SET
	b	LBB0_4
LBB0_13:
	ldr	x0, [x8, #16]
	cbnz	x0, LBB0_3
	b	LBB0_4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_IEEE80211_MSG_ANY,4,2          ; @IEEE80211_MSG_ANY
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"pwr save q overflow, drops %d (size %d)"

	.comm	_ENOSPC,4,2                     ; @ENOSPC
	.comm	_M_ENCAP,4,2                    ; @M_ENCAP
	.comm	_IEEE80211_MSG_POWER,4,2        ; @IEEE80211_MSG_POWER
l_.str.2:                               ; @.str.2
	.asciz	"save frame with age %d, %u now queued"

	.comm	_caddr_t,4,2                    ; @caddr_t
.subsections_via_symbols
