	.file	"extr_stm32-mdma.c_stm32_mdma_desc_residue.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	stm32_mdma_desc_residue, @function
stm32_mdma_desc_residue:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	mov	r14, rsi
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	mov	r12, rdi
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	ebx, edx
	add	ebx, 1
	sub	rsp, 8
	.cfi_def_cfa_offset 64
	call	stm32_mdma_get_dev@PLT
	mov	r13, rax
	cmp	ebx, DWORD PTR [r14]
	jge	.L7
	movsx	rbp, ebx
	xor	r15d, r15d
	sal	rbp, 3
	.p2align 4,,10
	.p2align 3
.L3:
	mov	rax, QWORD PTR 8[r14]
	add	ebx, 1
	mov	rax, QWORD PTR [rax+rbp]
	add	rbp, 8
	mov	edi, DWORD PTR [rax]
	call	STM32_MDMA_CBNDTR_BNDT@PLT
	add	r15d, eax
	cmp	DWORD PTR [r14], ebx
	jg	.L3
.L2:
	mov	edi, DWORD PTR 8[r12]
	call	STM32_MDMA_CBNDTR@PLT
	mov	rdi, r13
	mov	esi, eax
	call	stm32_mdma_read@PLT
	and	eax, DWORD PTR STM32_MDMA_CBNDTR_BNDT_MASK[rip]
	add	r15d, eax
	mov	eax, DWORD PTR [r12]
	test	eax, eax
	je	.L12
	imul	eax, DWORD PTR 4[r12]
	mov	ecx, eax
	mov	eax, r15d
	cdq
	idiv	ecx
	mov	eax, r15d
	sub	eax, edx
	add	eax, ecx
	test	edx, edx
	cmovne	r15d, eax
.L12:
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movsx	rax, r15d
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	.cfi_restore_state
	xor	r15d, r15d
	jmp	.L2
	.cfi_endproc
.LFE0:
	.size	stm32_mdma_desc_residue, .-stm32_mdma_desc_residue
	.comm	STM32_MDMA_CBNDTR_BNDT_MASK,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_stm32-mdma.c_stm32_mdma_desc_residue.c"
	.text
	.global	__aeabi_idivmod
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	stm32_mdma_desc_residue, %function
stm32_mdma_desc_residue:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, lr}
	mov	r5, r1
	mov	r4, r2
	mov	r7, r0
	bl	stm32_mdma_get_dev
	ldr	r3, [r5]
	add	r4, r4, #1
	cmp	r4, r3
	mov	r6, #0
	mov	r8, r0
	bge	.L2
.L3:
	ldr	r3, [r5, #4]
	ldr	r3, [r3, r4, lsl #2]
	add	r4, r4, #1
	ldr	r0, [r3]
	bl	STM32_MDMA_CBNDTR_BNDT
	ldr	r3, [r5]
	add	r6, r6, r0
	cmp	r3, r4
	bgt	.L3
.L2:
	ldr	r0, [r7, #8]
	bl	STM32_MDMA_CBNDTR
	mov	r1, r0
	mov	r0, r8
	bl	stm32_mdma_read
	ldr	r2, .L14
	ldr	r3, [r7]
	ldr	r2, [r2]
	cmp	r3, #0
	and	r0, r0, r2
	add	r6, r0, r6
	beq	.L1
	ldr	r4, [r7, #4]
	mov	r0, r6
	mul	r4, r3, r4
	mov	r1, r4
	bl	__aeabi_idivmod
	cmp	r1, #0
	subne	r6, r6, r1
	addne	r6, r6, r4
.L1:
	mov	r0, r6
	pop	{r4, r5, r6, r7, r8, pc}
.L15:
	.align	2
.L14:
	.word	STM32_MDMA_CBNDTR_BNDT_MASK
	.size	stm32_mdma_desc_residue, .-stm32_mdma_desc_residue
	.comm	STM32_MDMA_CBNDTR_BNDT_MASK,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
