	.file	"extr_pasemi_mac.c_pasemi_mac_free_tx_resources.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	pasemi_mac_free_tx_resources, @function
pasemi_mac_free_tx_resources:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	r15
	push	r14
	push	r13
	push	r12
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	mov	r12, rdi
	push	rbx
	sub	rsp, 40
	.cfi_offset 3, -56
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -56[rbp], rax
	xor	eax, eax
	call	tx_ring@PLT
	mov	rcx, rsp
	mov	r15, rax
	mov	eax, DWORD PTR MAX_SKB_FRAGS[rip]
	add	eax, 1
	cdqe
	lea	rax, 15[0+rax*8]
	mov	rdx, rax
	and	rax, -4096
	sub	rcx, rax
	and	rdx, -16
	mov	rax, rcx
	cmp	rsp, rax
	je	.L3
.L21:
	sub	rsp, 4096
	or	QWORD PTR 4088[rsp], 0
	cmp	rsp, rax
	jne	.L21
.L3:
	and	edx, 4095
	sub	rsp, rdx
	test	rdx, rdx
	jne	.L22
	mov	r13d, DWORD PTR [r15]
	mov	r14d, DWORD PTR 4[r15]
	mov	rcx, rsp
	cmp	r13d, r14d
	jg	.L23
	.p2align 4,,10
	.p2align 3
.L5:
	mov	rdi, QWORD PTR 16[r15]
	cmp	r13d, r14d
	jnb	.L6
	.p2align 4,,10
	.p2align 3
.L9:
	mov	eax, DWORD PTR TX_RING_SIZE[rip]
	lea	edx, 1[r13]
	lea	ebx, -1[rax]
	mov	eax, 2
	and	ebx, edx
	sal	rbx, 4
	add	rbx, rdi
	cmp	QWORD PTR 8[rbx], 0
	je	.L7
	mov	r8, QWORD PTR [rbx]
	test	r8, r8
	jne	.L24
.L7:
	add	r13d, eax
	cmp	r13d, r14d
	jb	.L9
.L6:
	call	kfree@PLT
	lea	rdi, 8[r15]
	call	pasemi_dma_free_chan@PLT
	mov	rax, QWORD PTR -56[rbp]
	xor	rax, QWORD PTR fs:40
	jne	.L25
	lea	rsp, -40[rbp]
	pop	rbx
	pop	r12
	pop	r13
	pop	r14
	pop	r15
	pop	rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L23:
	.cfi_restore_state
	add	r14d, DWORD PTR TX_RING_SIZE[rip]
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L24:
	mov	rdi, r8
	mov	QWORD PTR -80[rbp], rcx
	mov	DWORD PTR -72[rbp], edx
	call	skb_shinfo@PLT
	mov	r9, QWORD PTR 16[r15]
	mov	rcx, QWORD PTR -80[rbp]
	xor	esi, esi
	mov	r8d, DWORD PTR [rax]
	mov	eax, DWORD PTR TX_RING_SIZE[rip]
	mov	edx, DWORD PTR -72[rbp]
	lea	edi, -1[rax]
	.p2align 4,,10
	.p2align 3
.L8:
	lea	eax, [rdx+rsi]
	and	eax, edi
	sal	rax, 4
	mov	r10, QWORD PTR 8[r9+rax]
	mov	eax, esi
	add	esi, 1
	mov	QWORD PTR [rcx+rax*8], r10
	cmp	esi, r8d
	jbe	.L8
	mov	rdx, QWORD PTR [rbx]
	mov	rdi, r12
	mov	esi, r8d
	mov	QWORD PTR -72[rbp], rcx
	call	pasemi_mac_unmap_tx_skb@PLT
	mov	rdi, QWORD PTR 16[r15]
	mov	rcx, QWORD PTR -72[rbp]
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L22:
	or	QWORD PTR -8[rsp+rdx], 0
	mov	r13d, DWORD PTR [r15]
	mov	r14d, DWORD PTR 4[r15]
	mov	rcx, rsp
	cmp	r13d, r14d
	jle	.L5
	jmp	.L23
.L25:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	pasemi_mac_free_tx_resources, .-pasemi_mac_free_tx_resources
	.comm	TX_RING_SIZE,4,4
	.comm	MAX_SKB_FRAGS,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_pasemi_mac.c_pasemi_mac_free_tx_resources.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	pasemi_mac_free_tx_resources, %function
pasemi_mac_free_tx_resources:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	add	fp, sp, #32
	sub	sp, sp, #20
	ldr	r3, .L16
	ldr	r3, [r3]
	str	r3, [fp, #-40]
	mov	r3,#0
	str	r0, [fp, #-48]
	bl	tx_ring
	ldr	r3, .L16+4
	ldr	r6, [r0, #4]
	ldr	r4, [r0]
	ldr	r3, [r3]
	cmp	r4, r6
	lsl	r3, r3, #2
	ldrgt	r7, .L16+8
	add	r3, r3, #11
	bic	r3, r3, #7
	sub	sp, sp, r3
	ldrgt	r3, [r7]
	mov	r8, r0
	addgt	r6, r6, r3
	cmp	r4, r6
	mov	r9, sp
	ldr	r2, [r0, #12]
	bcs	.L3
	ldr	r7, .L16+8
.L6:
	ldr	r3, [r7]
	add	r5, r4, #1
	sub	r3, r3, #1
	and	r3, r3, r5
	add	r10, r2, r3, lsl #3
	ldr	r1, [r10, #4]
	cmp	r1, #0
	beq	.L9
	ldr	r0, [r2, r3, lsl #3]
	cmp	r0, #0
	bne	.L14
.L9:
	mov	r3, #2
.L4:
	add	r4, r4, r3
	cmp	r4, r6
	bcc	.L6
.L3:
	mov	r0, r2
	bl	kfree
	add	r0, r8, #8
	bl	pasemi_dma_free_chan
	ldr	r3, .L16
	ldr	r2, [r3]
	ldr	r3, [fp, #-40]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L15
	sub	sp, fp, #32
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L14:
	bl	skb_shinfo
	mov	ip, #0
	ldr	r3, [r7]
	ldr	lr, [r8, #12]
	ldr	r1, [r0]
	sub	r0, r3, #1
	sub	r3, r9, #4
.L5:
	add	r2, r5, ip
	and	r2, r2, r0
	add	r2, lr, r2, lsl #3
	ldr	r2, [r2, #4]
	add	ip, ip, #1
	cmp	ip, r1
	str	r2, [r3, #4]!
	bls	.L5
	mov	r3, r9
	ldr	r2, [r10]
	ldr	r0, [fp, #-48]
	bl	pasemi_mac_unmap_tx_skb
	ldr	r2, [r8, #12]
	mov	r3, r0
	b	.L4
.L15:
	bl	__stack_chk_fail
.L17:
	.align	2
.L16:
	.word	.LC0
	.word	MAX_SKB_FRAGS
	.word	TX_RING_SIZE
	.size	pasemi_mac_free_tx_resources, .-pasemi_mac_free_tx_resources
	.comm	TX_RING_SIZE,4,4
	.comm	MAX_SKB_FRAGS,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
