	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_dma_free
_mtk_dma_free:                          ## @mtk_dma_free
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	_MTK_MAC_COUNT@GOTPCREL(%rip), %r14
	movl	(%r14), %eax
	testl	%eax, %eax
	jle	LBB0_5
## %bb.1:
	xorl	%ebx, %ebx
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_4:                                 ##   in Loop: Header=BB0_2 Depth=1
	incq	%rbx
	movslq	%eax, %rcx
	cmpq	%rcx, %rbx
	jge	LBB0_5
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	56(%r15), %rcx
	movq	(%rcx,%rbx,8), %rdi
	testq	%rdi, %rdi
	je	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	callq	_netdev_reset_queue
	movl	(%r14), %eax
	jmp	LBB0_4
LBB0_5:
	movq	40(%r15), %rdx
	testq	%rdx, %rdx
	je	LBB0_7
## %bb.6:
	movl	48(%r15), %edi
	movq	_MTK_DMA_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	shll	$2, %esi
	movq	32(%r15), %rcx
	callq	_dma_free_coherent
	xorps	%xmm0, %xmm0
	movups	%xmm0, 32(%r15)
LBB0_7:
	movq	%r15, %rdi
	callq	_mtk_tx_clean
	movq	8(%r15), %rsi
	movq	%r15, %rdi
	callq	_mtk_rx_clean
	leaq	24(%r15), %rsi
	movq	%r15, %rdi
	callq	_mtk_rx_clean
	cmpq	$0, 16(%r15)
	je	LBB0_11
## %bb.8:
	movq	%r15, %rdi
	callq	_mtk_hwlro_rx_uninit
	movq	_MTK_MAX_RX_RING_NUM@GOTPCREL(%rip), %r14
	cmpl	$2, (%r14)
	jl	LBB0_11
## %bb.9:
	movl	$1, %r12d
	movl	$4, %ebx
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movq	8(%r15), %rsi
	addq	%rbx, %rsi
	movq	%r15, %rdi
	callq	_mtk_rx_clean
	incq	%r12
	movslq	(%r14), %rax
	addq	$4, %rbx
	cmpq	%rax, %r12
	jl	LBB0_10
LBB0_11:
	movl	(%r15), %edi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_kfree                          ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_MTK_MAC_COUNT,4,2              ## @MTK_MAC_COUNT
	.comm	_MTK_DMA_SIZE,4,2               ## @MTK_DMA_SIZE
	.comm	_MTK_MAX_RX_RING_NUM,4,2        ## @MTK_MAX_RX_RING_NUM
	.no_dead_strip	_mtk_dma_free
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtk_dma_free
_mtk_dma_free:                          ; @mtk_dma_free
	.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
Lloh0:
	adrp	x20, _MTK_MAC_COUNT@GOTPAGE
Lloh1:
	ldr	x20, [x20, _MTK_MAC_COUNT@GOTPAGEOFF]
	ldr	w8, [x20]
	cmp	w8, #1
	b.lt	LBB0_5
; %bb.1:
	mov	x21, #0
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x21, x21, #1
	cmp	x21, w8, sxtw
	b.ge	LBB0_5
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x9, [x19, #56]
	ldr	x0, [x9, x21, lsl #3]
	cbz	x0, LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	bl	_netdev_reset_queue
	ldr	w8, [x20]
	b	LBB0_2
LBB0_5:
	ldr	x2, [x19, #40]
	cbz	x2, LBB0_7
; %bb.6:
	ldr	w0, [x19, #48]
Lloh2:
	adrp	x8, _MTK_DMA_SIZE@GOTPAGE
Lloh3:
	ldr	x8, [x8, _MTK_DMA_SIZE@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	lsl	w1, w8, #2
	ldr	x3, [x19, #32]
	bl	_dma_free_coherent
	stp	xzr, xzr, [x19, #32]
LBB0_7:
	mov	x0, x19
	bl	_mtk_tx_clean
	ldr	x1, [x19, #8]
	mov	x0, x19
	bl	_mtk_rx_clean
	add	x1, x19, #24
	mov	x0, x19
	bl	_mtk_rx_clean
	ldr	x8, [x19, #16]
	cbz	x8, LBB0_11
; %bb.8:
	mov	x0, x19
	bl	_mtk_hwlro_rx_uninit
Lloh5:
	adrp	x20, _MTK_MAX_RX_RING_NUM@GOTPAGE
Lloh6:
	ldr	x20, [x20, _MTK_MAX_RX_RING_NUM@GOTPAGEOFF]
	ldr	w8, [x20]
	cmp	w8, #2
	b.lt	LBB0_11
; %bb.9:
	mov	w21, #1
	mov	w22, #4
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19, #8]
	add	x1, x8, x22
	mov	x0, x19
	bl	_mtk_rx_clean
	add	x21, x21, #1
	ldrsw	x8, [x20]
	add	x22, x22, #4
	cmp	x21, x8
	b.lt	LBB0_10
LBB0_11:
	ldr	w0, [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	_kfree
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.comm	_MTK_MAC_COUNT,4,2              ; @MTK_MAC_COUNT
	.comm	_MTK_DMA_SIZE,4,2               ; @MTK_DMA_SIZE
	.comm	_MTK_MAX_RX_RING_NUM,4,2        ; @MTK_MAX_RX_RING_NUM
	.no_dead_strip	_mtk_dma_free
.subsections_via_symbols
