	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ag71xx_send
_ag71xx_send:                           ## @ag71xx_send
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r15d
	movq	(%rdi), %r14
	movl	8(%r14), %eax
	movq	_AG71XX_TX_RING_SIZE@GOTPCREL(%rip), %rbx
	cltd
	idivl	(%rbx)
	movq	%rsi, %r12
	movq	16(%r14), %rax
	movslq	%edx, %rcx
	movq	(%rax,%rcx,8), %r13
	movq	%r13, %rdi
	callq	_ag71xx_desc_empty
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%r12, %rdi
	movl	%r15d, %esi
	callq	_flush_cache
	movq	%r12, %rdi
	callq	_virt_to_phys
	movq	%rax, 8(%r13)
	movq	_DESC_PKTLEN_M@GOTPCREL(%rip), %rcx
	andl	(%rcx), %r15d
	movl	%r15d, (%r13)
	movq	(%r14), %rcx
	movq	(%rcx), %rsi
	leaq	L_.str.1(%rip), %rdi
	movq	%rax, %rdx
	movl	%r15d, %ecx
	callq	_DBG
	movl	8(%r14), %eax
	incl	%eax
	movq	%rbx, %rcx
	xorl	%ebx, %ebx
	cmpl	(%rcx), %eax
	cmovgel	%ebx, %eax
	movl	%eax, 8(%r14)
	movq	_AG71XX_REG_TX_CTRL@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movq	_TX_CTRL_TXE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	callq	_ag71xx_wr
	movq	_MAX_WAIT@GOTPCREL(%rip), %r12
	movl	(%r12), %eax
	testl	%eax, %eax
	jle	LBB0_7
## %bb.3:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r13, %rdi
	callq	_ag71xx_desc_empty
	testq	%rax, %rax
	jne	LBB0_5
## %bb.6:                               ##   in Loop: Header=BB0_4 Depth=1
	movl	$10, %edi
	callq	_udelay
	incl	%ebx
	movl	(%r12), %eax
	cmpl	%eax, %ebx
	jl	LBB0_4
LBB0_7:
	cmpl	%eax, %ebx
	jne	LBB0_9
LBB0_8:
	movq	(%r14), %rax
	movq	(%rax), %rsi
	leaq	L_.str.2(%rip), %rdi
	callq	_printf
	movl	$-1, %r15d
	jmp	LBB0_10
LBB0_1:
	movq	(%r14), %rax
	movq	(%rax), %rsi
	leaq	L_.str(%rip), %rdi
	callq	_printf
	movl	$1, %r15d
	jmp	LBB0_10
LBB0_5:
	movl	(%r12), %eax
	cmpl	%eax, %ebx
	je	LBB0_8
LBB0_9:
	movl	(%r15), %esi
	xorl	%r15d, %r15d
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_ag71xx_wr
	movq	$0, 8(%r13)
	movq	_DESC_EMPTY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%r13)
LBB0_10:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AG71XX_TX_RING_SIZE,4,2        ## @AG71XX_TX_RING_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s: tx buffer full\n"

	.comm	_DESC_PKTLEN_M,4,2              ## @DESC_PKTLEN_M
L_.str.1:                               ## @.str.1
	.asciz	"%s: sending %#08x length %#08x\n"

	.comm	_AG71XX_REG_TX_CTRL,4,2         ## @AG71XX_REG_TX_CTRL
	.comm	_TX_CTRL_TXE,4,2                ## @TX_CTRL_TXE
	.comm	_MAX_WAIT,4,2                   ## @MAX_WAIT
L_.str.2:                               ## @.str.2
	.asciz	"%s: tx timed out!\n"

	.comm	_DESC_EMPTY,4,2                 ## @DESC_EMPTY
	.no_dead_strip	_ag71xx_send
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ag71xx_send
_ag71xx_send:                           ; @ag71xx_send
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x21, x2
	mov	x22, x1
	ldr	x19, [x0]
	ldr	w8, [x19, #8]
Lloh0:
	adrp	x23, _AG71XX_TX_RING_SIZE@GOTPAGE
Lloh1:
	ldr	x23, [x23, _AG71XX_TX_RING_SIZE@GOTPAGEOFF]
	ldr	w9, [x23]
	sdiv	w10, w8, w9
	msub	w8, w10, w9, w8
	ldr	x9, [x19, #16]
	ldr	x20, [x9, w8, sxtw #3]
	mov	x0, x20
	bl	_ag71xx_desc_empty
	cbz	x0, LBB0_5
; %bb.1:
	mov	x0, x22
	mov	x1, x21
	bl	_flush_cache
	mov	x0, x22
	bl	_virt_to_phys
	mov	x2, x0
Lloh2:
	adrp	x8, _DESC_PKTLEN_M@GOTPAGE
Lloh3:
	ldr	x8, [x8, _DESC_PKTLEN_M@GOTPAGEOFF]
	str	x0, [x20, #8]
Lloh4:
	ldr	w8, [x8]
	and	w3, w8, w21
	str	w3, [x20]
	ldr	x8, [x19]
	ldr	x1, [x8]
Lloh5:
	adrp	x0, l_.str.1@PAGE
Lloh6:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_DBG
	ldr	w8, [x19, #8]
	add	w9, w8, #1
	ldr	w10, [x23]
	cmp	w9, w10
	csinc	w8, wzr, w8, ge
	str	w8, [x19, #8]
Lloh7:
	adrp	x21, _AG71XX_REG_TX_CTRL@GOTPAGE
Lloh8:
	ldr	x21, [x21, _AG71XX_REG_TX_CTRL@GOTPAGEOFF]
	ldr	w1, [x21]
Lloh9:
	adrp	x8, _TX_CTRL_TXE@GOTPAGE
Lloh10:
	ldr	x8, [x8, _TX_CTRL_TXE@GOTPAGEOFF]
Lloh11:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_ag71xx_wr
Lloh12:
	adrp	x23, _MAX_WAIT@GOTPAGE
Lloh13:
	ldr	x23, [x23, _MAX_WAIT@GOTPAGEOFF]
	ldr	w8, [x23]
	cmp	w8, #1
	b.lt	LBB0_6
; %bb.2:
	mov	w22, #0
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	bl	_ag71xx_desc_empty
	cbnz	x0, LBB0_9
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	w0, #10
	bl	_udelay
	add	w22, w22, #1
	ldr	w8, [x23]
	cmp	w22, w8
	b.lt	LBB0_3
	b	LBB0_7
LBB0_5:
	ldr	x8, [x19]
	ldr	x1, [x8]
Lloh14:
	adrp	x0, l_.str@PAGE
Lloh15:
	add	x0, x0, l_.str@PAGEOFF
	bl	_printf
	mov	w0, #1
	b	LBB0_11
LBB0_6:
	mov	w22, #0
LBB0_7:
	cmp	w22, w8
	b.ne	LBB0_10
LBB0_8:
	ldr	x8, [x19]
	ldr	x1, [x8]
Lloh16:
	adrp	x0, l_.str.2@PAGE
Lloh17:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_printf
	mov	w0, #-1
	b	LBB0_11
LBB0_9:
	ldr	w8, [x23]
	cmp	w22, w8
	b.eq	LBB0_8
LBB0_10:
	ldr	w1, [x21]
	mov	x0, x19
	mov	w2, #0
	bl	_ag71xx_wr
	mov	w0, #0
	str	xzr, [x20, #8]
Lloh18:
	adrp	x8, _DESC_EMPTY@GOTPAGE
Lloh19:
	ldr	x8, [x8, _DESC_EMPTY@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	str	w8, [x20]
LBB0_11:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_AG71XX_TX_RING_SIZE,4,2        ; @AG71XX_TX_RING_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s: tx buffer full\n"

	.comm	_DESC_PKTLEN_M,4,2              ; @DESC_PKTLEN_M
l_.str.1:                               ; @.str.1
	.asciz	"%s: sending %#08x length %#08x\n"

	.comm	_AG71XX_REG_TX_CTRL,4,2         ; @AG71XX_REG_TX_CTRL
	.comm	_TX_CTRL_TXE,4,2                ; @TX_CTRL_TXE
	.comm	_MAX_WAIT,4,2                   ; @MAX_WAIT
l_.str.2:                               ; @.str.2
	.asciz	"%s: tx timed out!\n"

	.comm	_DESC_EMPTY,4,2                 ; @DESC_EMPTY
	.no_dead_strip	_ag71xx_send
.subsections_via_symbols
