	.file	"extr_mthca_allocator.c_mthca_buf_free.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	mthca_buf_free
	.type	mthca_buf_free, @function
mthca_buf_free:
.LFB0:
	.cfi_startproc
	endbr64
	push	r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	mov	r13, rdx
	push	r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	mov	r12, rdi
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	mov	ebp, esi
	push	rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	mov	ebx, ecx
	sub	rsp, 8
	.cfi_def_cfa_offset 48
	test	r8, r8
	je	.L2
	mov	rsi, r8
	call	mthca_free_mr@PLT
.L2:
	test	ebx, ebx
	jne	.L3
	mov	ecx, DWORD PTR PAGE_SIZE[rip]
	xor	ebx, ebx
	lea	eax, -1[rcx+rbp]
	cdq
	idiv	ecx
	test	eax, eax
	jle	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	mov	rax, QWORD PTR 0[r13]
	mov	esi, DWORD PTR mapping[rip]
	lea	rdi, [rax+rbx*4]
	call	dma_unmap_addr@PLT
	mov	esi, DWORD PTR PAGE_SIZE[rip]
	mov	rdi, QWORD PTR [r12]
	mov	ecx, eax
	mov	rax, QWORD PTR 0[r13]
	mov	edx, DWORD PTR [rax+rbx*4]
	add	rbx, 1
	call	dma_free_coherent@PLT
	mov	ecx, DWORD PTR PAGE_SIZE[rip]
	lea	eax, -1[rcx+rbp]
	cdq
	idiv	ecx
	cmp	eax, ebx
	jg	.L4
.L5:
	mov	rdi, QWORD PTR 0[r13]
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	jmp	kfree@PLT
	.p2align 4,,10
	.p2align 3
.L3:
	.cfi_restore_state
	mov	esi, DWORD PTR mapping[rip]
	mov	rdi, r13
	call	dma_unmap_addr@PLT
	mov	edx, DWORD PTR 0[r13]
	mov	rdi, QWORD PTR [r12]
	mov	esi, ebp
	add	rsp, 8
	.cfi_def_cfa_offset 40
	mov	ecx, eax
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	jmp	dma_free_coherent@PLT
	.cfi_endproc
.LFE0:
	.size	mthca_buf_free, .-mthca_buf_free
	.comm	mapping,4,4
	.comm	PAGE_SIZE,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_mthca_allocator.c_mthca_buf_free.c"
	.text
	.global	__aeabi_idiv
	.align	2
	.global	mthca_buf_free
	.syntax unified
	.arm
	.fpu softvfp
	.type	mthca_buf_free, %function
mthca_buf_free:
	@ args = 4, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	sub	sp, sp, #4
	ldr	ip, [sp, #40]
	mov	r8, r1
	cmp	ip, #0
	mov	r7, r2
	mov	r4, r3
	mov	r9, r0
	beq	.L2
	mov	r1, ip
	bl	mthca_free_mr
.L2:
	cmp	r4, #0
	bne	.L3
	ldr	r10, .L13
	ldr	r5, [r10]
	add	r0, r8, r5
	mov	r1, r5
	sub	r0, r0, #1
	bl	__aeabi_idiv
	cmp	r0, #0
	ble	.L5
.L4:
	ldr	r0, [r7]
	ldr	r3, .L13+4
	ldr	fp, [r0, r4, lsl #2]
	ldr	r1, [r3]
	add	r0, r0, r4, lsl #2
	ldr	r6, [r9]
	bl	dma_unmap_addr
	mov	r1, r5
	mov	r3, r0
	mov	r2, fp
	mov	r0, r6
	bl	dma_free_coherent
	ldr	r5, [r10]
	add	r4, r4, #1
	add	r0, r5, r8
	mov	r1, r5
	sub	r0, r0, #1
	bl	__aeabi_idiv
	cmp	r0, r4
	bgt	.L4
.L5:
	ldr	r0, [r7]
	add	sp, sp, #4
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	b	kfree
.L3:
	ldr	r3, .L13+4
	mov	r0, r7
	ldr	r1, [r3]
	ldr	r4, [r9]
	ldr	r5, [r7]
	bl	dma_unmap_addr
	mov	r2, r5
	mov	r3, r0
	mov	r1, r8
	mov	r0, r4
	add	sp, sp, #4
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	b	dma_free_coherent
.L14:
	.align	2
.L13:
	.word	PAGE_SIZE
	.word	mapping
	.size	mthca_buf_free, .-mthca_buf_free
	.comm	mapping,4,4
	.comm	PAGE_SIZE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
