	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_poll_tx_qdma
_mtk_poll_tx_qdma:                      ## @mtk_poll_tx_qdma
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, -72(%rbp)                 ## 8-byte Spill
	movq	%rdx, -64(%rbp)                 ## 8-byte Spill
	movl	%esi, %r14d
	movq	%rdi, %r13
	movq	_MTK_QTX_CRX_PTR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_mtk_r32
	movq	%rax, %rbx
	movq	_MTK_QTX_DRX_PTR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	callq	_mtk_r32
	movq	%rax, %r15
	movq	%r13, %rdi
	movq	%rbx, %rsi
	callq	_mtk_qdma_phys_to_virt
	movq	%r15, -80(%rbp)                 ## 8-byte Spill
	cmpq	%r15, %rbx
	je	LBB0_1
## %bb.2:
	movl	%r14d, -44(%rbp)                ## 4-byte Spill
	testl	%r14d, %r14d
	je	LBB0_3
## %bb.4:
	movq	(%rax), %r15
	movq	%r13, %rdi
	movq	%r15, %rsi
	callq	_mtk_qdma_phys_to_virt
	movq	%rax, %r12
	movq	_TX_DMA_OWNER_CPU@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 8(%r12)
	je	LBB0_3
## %bb.5:
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r13, %rdi
	movl	%ebx, %r14d
	movq	%r12, %rsi
	callq	_mtk_desc_to_tx_buf
	movq	_MTK_TX_FLAGS_FPORT1@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	xorl	%ecx, %ecx
	testl	%edx, (%rax)
	setne	%bl
	movq	8(%rax), %rdx
	testq	%rdx, %rdx
	je	LBB0_8
## %bb.9:                               ##   in Loop: Header=BB0_7 Depth=1
	movq	_MTK_DMA_DUMMY_DESC@GOTPCREL(%rip), %rsi
	cmpq	(%rsi), %rdx
	je	LBB0_10
## %bb.11:                              ##   in Loop: Header=BB0_7 Depth=1
	movb	%bl, %cl
	movl	(%rdx), %edx
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	addl	%edx, (%rsi,%rcx,4)
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	incl	(%rdx,%rcx,4)
	movl	%r14d, %ebx
	decl	%ebx
	jmp	LBB0_12
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_7 Depth=1
	movl	%r14d, %ebx
LBB0_12:                                ##   in Loop: Header=BB0_7 Depth=1
	movq	%r15, %r14
	movq	%r13, %rdi
	movq	%rax, %rsi
	callq	_mtk_tx_unmap
	movq	%r12, 8(%r13)
	movq	%r13, %rdi
	callq	_atomic_inc
	cmpq	-80(%rbp), %r15                 ## 8-byte Folded Reload
	je	LBB0_14
## %bb.13:                              ##   in Loop: Header=BB0_7 Depth=1
	testl	%ebx, %ebx
	je	LBB0_14
## %bb.6:                               ##   in Loop: Header=BB0_7 Depth=1
	movq	(%r12), %r15
	movq	%r13, %rdi
	movq	%r15, %rsi
	callq	_mtk_qdma_phys_to_virt
	movq	%rax, %r12
	movq	_TX_DMA_OWNER_CPU@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	%r14, %rsi
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	testl	%eax, 8(%r12)
	jne	LBB0_7
	jmp	LBB0_15
LBB0_3:
	movq	%rbx, %rsi
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	jmp	LBB0_15
LBB0_1:
	movq	%rbx, %rsi
	movl	%r14d, %ebx
	jmp	LBB0_15
LBB0_8:
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movl	%r14d, %ebx
	jmp	LBB0_15
LBB0_14:
	movq	%r14, %rsi
LBB0_15:
	movq	_MTK_QTX_CRX_PTR@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r13, %rdi
	callq	_mtk_w32
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MTK_QTX_CRX_PTR,4,2            ## @MTK_QTX_CRX_PTR
	.comm	_MTK_QTX_DRX_PTR,4,2            ## @MTK_QTX_DRX_PTR
	.comm	_TX_DMA_OWNER_CPU,4,2           ## @TX_DMA_OWNER_CPU
	.comm	_MTK_TX_FLAGS_FPORT1,4,2        ## @MTK_TX_FLAGS_FPORT1
	.comm	_MTK_DMA_DUMMY_DESC,8,3         ## @MTK_DMA_DUMMY_DESC
	.no_dead_strip	_mtk_poll_tx_qdma
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtk_poll_tx_qdma
_mtk_poll_tx_qdma:                      ; @mtk_poll_tx_qdma
	.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	x21, x3
	mov	x22, x2
	mov	x19, x1
	mov	x20, x0
Lloh0:
	adrp	x8, _MTK_QTX_CRX_PTR@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MTK_QTX_CRX_PTR@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_mtk_r32
	mov	x26, x0
Lloh3:
	adrp	x8, _MTK_QTX_DRX_PTR@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MTK_QTX_DRX_PTR@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_mtk_r32
	mov	x23, x0
	mov	x0, x20
	mov	x1, x26
	bl	_mtk_qdma_phys_to_virt
	cmp	x26, x23
	ccmp	w19, #0, #4, ne
	b.eq	LBB0_9
; %bb.1:
	ldr	x27, [x0]
	mov	x0, x20
	mov	x1, x27
	bl	_mtk_qdma_phys_to_virt
	ldr	w8, [x0, #8]
Lloh6:
	adrp	x28, _TX_DMA_OWNER_CPU@GOTPAGE
Lloh7:
	ldr	x28, [x28, _TX_DMA_OWNER_CPU@GOTPAGEOFF]
	ldr	w9, [x28]
	tst	w9, w8
	b.eq	LBB0_9
; %bb.2:
	mov	x25, x0
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	mov	x24, x27
	mov	x0, x20
	mov	x1, x25
	bl	_mtk_desc_to_tx_buf
	ldr	w8, [x0]
Lloh8:
	adrp	x9, _MTK_TX_FLAGS_FPORT1@GOTPAGE
Lloh9:
	ldr	x9, [x9, _MTK_TX_FLAGS_FPORT1@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	tst	w9, w8
	cset	w8, ne
	ldr	x9, [x0, #8]
	cbz	x9, LBB0_9
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x1, x0
Lloh11:
	adrp	x10, _MTK_DMA_DUMMY_DESC@GOTPAGE
Lloh12:
	ldr	x10, [x10, _MTK_DMA_DUMMY_DESC@GOTPAGEOFF]
Lloh13:
	ldr	x10, [x10]
	cmp	x9, x10
	b.eq	LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w9, [x9]
	lsl	x8, x8, #2
	ldr	w10, [x21, x8]
	add	w9, w10, w9
	str	w9, [x21, x8]
	ldr	w9, [x22, x8]
	add	w9, w9, #1
	str	w9, [x22, x8]
	sub	w19, w19, #1
LBB0_6:                                 ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, x20
	bl	_mtk_tx_unmap
	str	x25, [x20, #8]
	mov	x0, x20
	bl	_atomic_inc
	cmp	x24, x23
	b.eq	LBB0_10
; %bb.7:                                ;   in Loop: Header=BB0_3 Depth=1
	cbz	w19, LBB0_10
; %bb.8:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x27, [x25]
	mov	x0, x20
	mov	x1, x27
	bl	_mtk_qdma_phys_to_virt
	mov	x25, x0
	ldr	w8, [x0, #8]
	ldr	w9, [x28]
	mov	x26, x24
	tst	w9, w8
	b.ne	LBB0_3
	b	LBB0_10
LBB0_9:
	mov	x24, x26
LBB0_10:
Lloh14:
	adrp	x8, _MTK_QTX_CRX_PTR@GOTPAGE
Lloh15:
	ldr	x8, [x8, _MTK_QTX_CRX_PTR@GOTPAGEOFF]
Lloh16:
	ldr	w2, [x8]
	mov	x0, x20
	mov	x1, x24
	bl	_mtk_w32
	mov	x0, x19
	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 AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_MTK_QTX_CRX_PTR,4,2            ; @MTK_QTX_CRX_PTR
	.comm	_MTK_QTX_DRX_PTR,4,2            ; @MTK_QTX_DRX_PTR
	.comm	_TX_DMA_OWNER_CPU,4,2           ; @TX_DMA_OWNER_CPU
	.comm	_MTK_TX_FLAGS_FPORT1,4,2        ; @MTK_TX_FLAGS_FPORT1
	.comm	_MTK_DMA_DUMMY_DESC,8,3         ; @MTK_DMA_DUMMY_DESC
	.no_dead_strip	_mtk_poll_tx_qdma
.subsections_via_symbols
