	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bgmac_dma_tx_free
_bgmac_dma_tx_free:                     ## @bgmac_dma_tx_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	%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, %rbx
	movq	8(%rdi), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	_BGMAC_DMA_TX_STATUS@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	32(%rbx), %rsi
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	callq	_bgmac_read
	movl	%eax, %r12d
	movl	(%rbx), %eax
	cmpl	4(%rbx), %eax
	je	LBB0_11
## %bb.1:
	movq	_BGMAC_DMA_TX_STATDPTR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	andl	%ecx, %r12d
	subl	24(%rbx), %r12d
	andl	%ecx, %r12d
	sarl	$2, %r12d
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
	movl	$0, -48(%rbp)                   ## 4-byte Folded Spill
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	$0, (%r15)
	movl	(%rbx), %eax
	incl	%eax
	movl	%eax, (%rbx)
	cmpl	4(%rbx), %eax
	je	LBB0_9
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	cltd
	movq	_BGMAC_TX_RING_SLOTS@GOTPCREL(%rip), %rcx
	idivl	(%rcx)
	cmpl	%r12d, %edx
	je	LBB0_9
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	16(%rbx), %r13
	movslq	%edx, %r14
	movq	8(%rbx), %rax
	movl	4(%rax,%r14,8), %edi
	callq	_le32_to_cpu
	movl	%eax, %r15d
	movq	8(%rbx), %rax
	movl	(%rax,%r14,8), %edi
	callq	_le32_to_cpu
	movq	_BGMAC_DESC_CTL1_LEN@GOTPCREL(%rip), %rcx
	andl	(%rcx), %eax
	shlq	$4, %r14
	movq	(%r13,%r14), %rsi
	movq	_DMA_TO_DEVICE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movq	_BGMAC_DESC_CTL0_SOF@GOTPCREL(%rip), %rdx
	testl	%r15d, (%rdx)
	je	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movl	%eax, %edx
	callq	_dma_unmap_single
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_5:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movl	%eax, %edx
	callq	_dma_unmap_page
LBB0_6:                                 ##   in Loop: Header=BB0_2 Depth=1
	leaq	(%r14,%r13), %r15
	movq	8(%r13,%r14), %rdi
	testq	%rdi, %rdi
	je	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	(%rdi), %eax
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movq	(%rcx), %rcx
	addl	%eax, 4(%rcx)
	incl	(%rcx)
	addq	%r13, %r14
	addq	$8, %r14
	addl	%eax, -44(%rbp)                 ## 4-byte Folded Spill
	incl	-48(%rbp)                       ## 4-byte Folded Spill
	callq	_dev_kfree_skb
	movq	$0, (%r14)
	jmp	LBB0_8
LBB0_9:
	movl	-48(%rbp), %esi                 ## 4-byte Reload
	testl	%esi, %esi
	je	LBB0_11
## %bb.10:
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movq	(%rbx), %rdi
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	callq	_netdev_completed_queue
	movq	(%rbx), %rdi
	callq	_netif_queue_stopped
	testq	%rax, %rax
	je	LBB0_11
## %bb.12:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rdi
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_netif_wake_queue               ## TAILCALL
LBB0_11:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_BGMAC_DMA_TX_STATUS,8,3        ## @BGMAC_DMA_TX_STATUS
	.comm	_BGMAC_DMA_TX_STATDPTR,4,2      ## @BGMAC_DMA_TX_STATDPTR
	.comm	_BGMAC_TX_RING_SLOTS,4,2        ## @BGMAC_TX_RING_SLOTS
	.comm	_BGMAC_DESC_CTL1_LEN,4,2        ## @BGMAC_DESC_CTL1_LEN
	.comm	_BGMAC_DESC_CTL0_SOF,4,2        ## @BGMAC_DESC_CTL0_SOF
	.comm	_DMA_TO_DEVICE,4,2              ## @DMA_TO_DEVICE
	.no_dead_strip	_bgmac_dma_tx_free
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bgmac_dma_tx_free
_bgmac_dma_tx_free:                     ; @bgmac_dma_tx_free
	.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, x1
	mov	x19, x0
	ldr	x21, [x0, #8]
	ldr	x8, [x1, #32]
Lloh0:
	adrp	x9, _BGMAC_DMA_TX_STATUS@GOTPAGE
Lloh1:
	ldr	x9, [x9, _BGMAC_DMA_TX_STATUS@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_bgmac_read
	ldp	w8, w9, [x20]
	cmp	w8, w9
	b.eq	LBB0_12
; %bb.1:
	mov	w22, #0
	mov	w23, #0
Lloh3:
	adrp	x9, _BGMAC_DMA_TX_STATDPTR@GOTPAGE
Lloh4:
	ldr	x9, [x9, _BGMAC_DMA_TX_STATDPTR@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	and	w10, w9, w0
	ldr	w11, [x20, #24]
	sub	w10, w10, w11
	and	w9, w10, w9
	asr	w25, w9, #2
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	str	xzr, [x28]
	ldp	w8, w9, [x20]
	add	w8, w8, #1
	str	w8, [x20]
	cmp	w8, w9
	b.eq	LBB0_9
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
Lloh6:
	adrp	x9, _BGMAC_TX_RING_SLOTS@GOTPAGE
Lloh7:
	ldr	x9, [x9, _BGMAC_TX_RING_SLOTS@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	sdiv	w10, w8, w9
	msub	w8, w10, w9, w8
	cmp	w8, w25
	b.eq	LBB0_9
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	sxtw	x27, w8
	ldp	x8, x26, [x20, #8]
	lsl	x28, x27, #3
	add	x8, x8, x28
	ldr	w0, [x8, #4]
	bl	_le32_to_cpu
	mov	x24, x0
	ldr	x8, [x20, #8]
	ldr	w0, [x8, x28]
	bl	_le32_to_cpu
Lloh9:
	adrp	x8, _BGMAC_DESC_CTL1_LEN@GOTPAGE
Lloh10:
	ldr	x8, [x8, _BGMAC_DESC_CTL1_LEN@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	and	w2, w8, w0
Lloh12:
	adrp	x8, _BGMAC_DESC_CTL0_SOF@GOTPAGE
Lloh13:
	ldr	x8, [x8, _BGMAC_DESC_CTL0_SOF@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	add	x28, x26, x27, lsl #4
	ldr	x1, [x28]
Lloh15:
	adrp	x9, _DMA_TO_DEVICE@GOTPAGE
Lloh16:
	ldr	x9, [x9, _DMA_TO_DEVICE@GOTPAGEOFF]
Lloh17:
	ldr	w3, [x9]
	mov	x0, x21
	tst	w8, w24
	b.eq	LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	bl	_dma_unmap_single
	b	LBB0_7
LBB0_6:                                 ;   in Loop: Header=BB0_3 Depth=1
	bl	_dma_unmap_page
LBB0_7:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x24, x26, x27, lsl #4
	ldr	x0, [x24, #8]!
	cbz	x0, LBB0_2
; %bb.8:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w8, [x0]
	ldr	x9, [x19]
	ldp	w11, w10, [x9]
	add	w10, w10, w8
	add	w11, w11, #1
	stp	w11, w10, [x9]
	add	w22, w22, w8
	add	w23, w23, #1
	bl	_dev_kfree_skb
	str	xzr, [x24]
	b	LBB0_2
LBB0_9:
	cbz	w23, LBB0_12
; %bb.10:
	ldr	x0, [x19]
	mov	x1, x23
	mov	x2, x22
	bl	_netdev_completed_queue
	ldr	x0, [x19]
	bl	_netif_queue_stopped
	cbz	x0, LBB0_12
; %bb.11:
	ldr	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
	b	_netif_wake_queue
LBB0_12:
	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	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_BGMAC_DMA_TX_STATUS,8,3        ; @BGMAC_DMA_TX_STATUS
	.comm	_BGMAC_DMA_TX_STATDPTR,4,2      ; @BGMAC_DMA_TX_STATDPTR
	.comm	_BGMAC_TX_RING_SLOTS,4,2        ; @BGMAC_TX_RING_SLOTS
	.comm	_BGMAC_DESC_CTL1_LEN,4,2        ; @BGMAC_DESC_CTL1_LEN
	.comm	_BGMAC_DESC_CTL0_SOF,4,2        ; @BGMAC_DESC_CTL0_SOF
	.comm	_DMA_TO_DEVICE,4,2              ; @DMA_TO_DEVICE
	.no_dead_strip	_bgmac_dma_tx_free
.subsections_via_symbols
