	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mt76_dma_tx_cleanup
_mt76_dma_tx_cleanup:                   ## @mt76_dma_tx_cleanup
	.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	$88, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	8(%rdi), %rax
	movl	%esi, -72(%rbp)                 ## 4-byte Spill
	movl	%esi, %ecx
	shlq	$4, %rcx
	movq	8(%rax,%rcx), %r13
	xorps	%xmm0, %xmm0
	movaps	%xmm0, -64(%rbp)
	testq	%r13, %r13
	je	LBB0_37
## %bb.1:
	movl	%edx, %r12d
	movq	%rdi, %r15
	movl	$-1, %ebx
	testl	%edx, %edx
	jne	LBB0_3
## %bb.2:
	movq	24(%r13), %rdi
	callq	_readl
	movl	%eax, %ebx
LBB0_3:
	cmpl	$0, (%r13)
	movl	%r12d, -76(%rbp)                ## 4-byte Spill
	je	LBB0_4
## %bb.5:
	xorl	%r14d, %r14d
	testl	%r12d, %r12d
	sete	%r14b
	movl	$0, -68(%rbp)                   ## 4-byte Folded Spill
	xorl	%r12d, %r12d
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_14:                                ##   in Loop: Header=BB0_6 Depth=1
	incl	%r12d
	cmpl	$0, -76(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_15
LBB0_17:                                ##   in Loop: Header=BB0_6 Depth=1
	cmpl	%r12d, (%r13)
	jbe	LBB0_18
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movl	4(%r13), %edx
	cmpl	%ebx, %edx
	je	LBB0_18
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	%r15, %rdi
	movq	%r13, %rsi
	leaq	-120(%rbp), %rcx
	callq	_mt76_dma_tx_cleanup_idx
	cmpq	$0, -96(%rbp)
	je	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	-120(%rbp), %rax
	incl	-64(%rbp,%rax,4)
LBB0_9:                                 ##   in Loop: Header=BB0_6 Depth=1
	movl	4(%r13), %eax
	incl	%eax
	cltd
	idivl	8(%r13)
	movl	%edx, 4(%r13)
	cmpq	$0, -104(%rbp)
	je	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	16(%r15), %rax
	movq	%r15, %rdi
	movl	-72(%rbp), %esi                 ## 4-byte Reload
	leaq	-120(%rbp), %rdx
	callq	*8(%rax)
LBB0_11:                                ##   in Loop: Header=BB0_6 Depth=1
	movq	-112(%rbp), %rsi
	testq	%rsi, %rsi
	je	LBB0_14
## %bb.12:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	16(%r15), %rax
	movq	_MT_TXWI_NO_FREE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%r14d, -68(%rbp)                ## 4-byte Spill
	testl	%ecx, (%rax)
	jne	LBB0_14
## %bb.13:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	%r15, %rdi
	callq	_mt76_put_txwi
	movl	%r14d, -68(%rbp)                ## 4-byte Spill
	jmp	LBB0_14
	.p2align	4, 0x90
LBB0_15:                                ##   in Loop: Header=BB0_6 Depth=1
	cmpl	%ebx, 4(%r13)
	jne	LBB0_17
## %bb.16:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	24(%r13), %rdi
	callq	_readl
	movl	%eax, %ebx
	jmp	LBB0_17
LBB0_4:
	xorl	%r12d, %r12d
	movl	$0, -68(%rbp)                   ## 4-byte Folded Spill
LBB0_18:
	leaq	16(%r13), %rdi
	movq	%rdi, -88(%rbp)                 ## 8-byte Spill
	callq	_spin_lock_bh
	subl	%r12d, (%r13)
	leaq	-64(%rbp), %rdi
	callq	_ARRAY_SIZE
	testl	%eax, %eax
	jle	LBB0_23
## %bb.19:
	xorl	%ebx, %ebx
	leaq	-64(%rbp), %r14
	xorl	%r12d, %r12d
	jmp	LBB0_20
	.p2align	4, 0x90
LBB0_22:                                ##   in Loop: Header=BB0_20 Depth=1
	incq	%r12
	movq	%r14, %rdi
	callq	_ARRAY_SIZE
	cltq
	addq	$4, %rbx
	cmpq	%rax, %r12
	jge	LBB0_23
LBB0_20:                                ## =>This Inner Loop Header: Depth=1
	movl	-64(%rbp,%rbx), %eax
	testl	%eax, %eax
	je	LBB0_22
## %bb.21:                              ##   in Loop: Header=BB0_20 Depth=1
	movq	8(%r15), %rcx
	subl	%eax, (%rcx,%rbx,4)
	jmp	LBB0_22
LBB0_23:
	cmpl	$0, -76(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_25
## %bb.24:
	movq	%r15, %rdi
	movq	%r13, %rsi
	callq	_mt76_dma_sync_idx
LBB0_25:
	cmpl	$0, -68(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_26
## %bb.27:
	xorl	%r14d, %r14d
	cmpl	$0, 12(%r13)
	je	LBB0_32
## %bb.28:
	movq	_IEEE80211_NUM_ACS@GOTPCREL(%rip), %rax
	movl	-72(%rbp), %ecx                 ## 4-byte Reload
	cmpl	%ecx, (%rax)
	jbe	LBB0_32
## %bb.29:
	movl	(%r13), %eax
	movl	8(%r13), %ecx
	addl	$-8, %ecx
	cmpl	%ecx, %eax
	jae	LBB0_30
## %bb.31:
	movl	$0, 12(%r13)
	movb	$1, %r14b
	jmp	LBB0_32
LBB0_26:
	xorl	%r14d, %r14d
LBB0_32:
	movl	(%r13), %eax
	testl	%eax, %eax
	jne	LBB0_35
LBB0_34:
	leaq	4(%r15), %rdi
	callq	_wake_up
LBB0_35:
	movq	-88(%rbp), %rdi                 ## 8-byte Reload
	callq	_spin_unlock_bh
	testb	%r14b, %r14b
	je	LBB0_37
## %bb.36:
	movl	(%r15), %edi
	movl	-72(%rbp), %esi                 ## 4-byte Reload
	callq	_ieee80211_wake_queue
LBB0_37:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_39
## %bb.38:
	addq	$88, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_30:
	xorl	%r14d, %r14d
	testl	%eax, %eax
	jne	LBB0_35
	jmp	LBB0_34
LBB0_39:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_MT_TXWI_NO_FREE,4,2            ## @MT_TXWI_NO_FREE
	.comm	_IEEE80211_NUM_ACS,4,2          ## @IEEE80211_NUM_ACS
	.no_dead_strip	_mt76_dma_tx_cleanup
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mt76_dma_tx_cleanup
_mt76_dma_tx_cleanup:                   ; @mt76_dma_tx_cleanup
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #160
	.cfi_def_cfa_offset 160
	stp	x28, x27, [sp, #64]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #80]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #96]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #112]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #128]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #144]            ; 16-byte Folded Spill
	add	x29, sp, #144
	.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
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #56]
	ldr	x8, [x0, #8]
	add	x8, x8, w1, uxtw #4
	ldr	x21, [x8, #8]
	stp	xzr, xzr, [sp, #40]
	cbz	x21, LBB0_34
; %bb.1:
	mov	x22, x2
	mov	x19, x1
	mov	x20, x0
	cbz	w2, LBB0_16
; %bb.2:
	mov	w23, #-1
	ldr	w8, [x21]
	cbz	w8, LBB0_17
LBB0_3:
	mov	w24, #0
	mov	w25, #0
	cmp	w22, #0
	cset	w26, eq
Lloh3:
	adrp	x27, _MT_TXWI_NO_FREE@GOTPAGE
Lloh4:
	ldr	x27, [x27, _MT_TXWI_NO_FREE@GOTPAGEOFF]
	add	x28, sp, #40
	b	LBB0_6
LBB0_4:                                 ;   in Loop: Header=BB0_6 Depth=1
	cbz	w22, LBB0_14
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=1
	add	w25, w25, #1
	ldr	w8, [x21]
	cmp	w8, w25
	b.ls	LBB0_18
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w2, [x21, #4]
	cmp	w2, w23
	b.eq	LBB0_18
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	add	x3, sp, #8
	mov	x0, x20
	mov	x1, x21
	bl	_mt76_dma_tx_cleanup_idx
	ldr	x8, [sp, #32]
	cbz	x8, LBB0_9
; %bb.8:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [sp, #8]
	lsl	x8, x8, #2
	ldr	w9, [x28, x8]
	add	w9, w9, #1
	str	w9, [x28, x8]
LBB0_9:                                 ;   in Loop: Header=BB0_6 Depth=1
	ldp	w8, w9, [x21, #4]
	add	w8, w8, #1
	sdiv	w10, w8, w9
	msub	w8, w10, w9, w8
	str	w8, [x21, #4]
	ldr	x8, [sp, #24]
	cbz	x8, LBB0_11
; %bb.10:                               ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [x20, #16]
	ldr	x8, [x8, #8]
	add	x2, sp, #8
	mov	x0, x20
	mov	x1, x19
	blr	x8
LBB0_11:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	x1, [sp, #16]
	cbz	x1, LBB0_4
; %bb.12:                               ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [x20, #16]
	ldr	w8, [x8]
	ldr	w9, [x27]
	mov	x24, x26
	tst	w9, w8
	b.ne	LBB0_4
; %bb.13:                               ;   in Loop: Header=BB0_6 Depth=1
	mov	x0, x20
	bl	_mt76_put_txwi
	mov	x24, x26
	b	LBB0_4
LBB0_14:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	w8, [x21, #4]
	cmp	w8, w23
	b.ne	LBB0_5
; %bb.15:                               ;   in Loop: Header=BB0_6 Depth=1
	ldr	x0, [x21, #24]
	bl	_readl
	mov	x23, x0
	b	LBB0_5
LBB0_16:
	ldr	x0, [x21, #24]
	bl	_readl
	mov	x23, x0
	ldr	w8, [x21]
	cbnz	w8, LBB0_3
LBB0_17:
	mov	w25, #0
	mov	w24, #0
LBB0_18:
	add	x23, x21, #16
	mov	x0, x23
	bl	_spin_lock_bh
	ldr	w8, [x21]
	sub	w8, w8, w25
	str	w8, [x21]
	add	x25, sp, #40
	add	x0, sp, #40
	bl	_ARRAY_SIZE
	cmp	w0, #1
	b.lt	LBB0_23
; %bb.19:
	mov	x26, #0
	mov	x27, #0
	b	LBB0_21
LBB0_20:                                ;   in Loop: Header=BB0_21 Depth=1
	add	x27, x27, #1
	add	x0, sp, #40
	bl	_ARRAY_SIZE
	add	x26, x26, #4
	cmp	x27, w0, sxtw
	b.ge	LBB0_23
LBB0_21:                                ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x25, x26]
	cbz	w8, LBB0_20
; %bb.22:                               ;   in Loop: Header=BB0_21 Depth=1
	ldr	x9, [x20, #8]
	lsl	x10, x26, #2
	ldr	w11, [x9, x10]
	sub	w8, w11, w8
	str	w8, [x9, x10]
	b	LBB0_20
LBB0_23:
	cbz	w22, LBB0_25
; %bb.24:
	mov	x0, x20
	mov	x1, x21
	bl	_mt76_dma_sync_idx
LBB0_25:
	mov	w22, #0
	cbz	w24, LBB0_30
; %bb.26:
	ldr	w8, [x21, #12]
	cbz	w8, LBB0_30
; %bb.27:
Lloh5:
	adrp	x8, _IEEE80211_NUM_ACS@GOTPAGE
Lloh6:
	ldr	x8, [x8, _IEEE80211_NUM_ACS@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	cmp	w8, w19
	b.ls	LBB0_30
; %bb.28:
	ldr	w8, [x21]
	ldr	w9, [x21, #8]
	sub	w9, w9, #8
	cmp	w8, w9
	b.hs	LBB0_36
; %bb.29:
	str	wzr, [x21, #12]
	mov	w22, #1
LBB0_30:
	ldr	w8, [x21]
	cbnz	w8, LBB0_32
LBB0_31:
	add	x0, x20, #4
	bl	_wake_up
LBB0_32:
	mov	x0, x23
	bl	_spin_unlock_bh
	cbz	w22, LBB0_34
; %bb.33:
	ldr	w0, [x20]
	mov	x1, x19
	bl	_ieee80211_wake_queue
LBB0_34:
	ldr	x8, [sp, #56]
Lloh8:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh9:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh10:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_37
; %bb.35:
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #96]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #80]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #160
	ret
LBB0_36:
	mov	w22, #0
	cbnz	w8, LBB0_32
	b	LBB0_31
LBB0_37:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_MT_TXWI_NO_FREE,4,2            ; @MT_TXWI_NO_FREE
	.comm	_IEEE80211_NUM_ACS,4,2          ; @IEEE80211_NUM_ACS
	.no_dead_strip	_mt76_dma_tx_cleanup
.subsections_via_symbols
