	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function stm32_mdma_desc_residue
_stm32_mdma_desc_residue:               ## @stm32_mdma_desc_residue
	.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, %r12d
	movq	%rsi, %r13
	movq	%rdi, %r15
	callq	_stm32_mdma_get_dev
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	incl	%r12d
	xorl	%r14d, %r14d
	cmpl	(%r13), %r12d
	jge	LBB0_3
## %bb.1:
	movslq	%r12d, %rbx
	xorl	%r14d, %r14d
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	8(%r13), %rax
	movq	(%rax,%rbx,8), %rax
	movl	(%rax), %edi
	callq	_STM32_MDMA_CBNDTR_BNDT
	addl	%eax, %r14d
	incq	%rbx
	movslq	(%r13), %rax
	cmpq	%rax, %rbx
	jl	LBB0_2
LBB0_3:
	movl	8(%r15), %edi
	callq	_STM32_MDMA_CBNDTR
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	%eax, %esi
	callq	_stm32_mdma_read
	movl	%eax, %ecx
	movq	_STM32_MDMA_CBNDTR_BNDT_MASK@GOTPCREL(%rip), %rax
	andl	(%rax), %ecx
	addl	%r14d, %ecx
	movl	(%r15), %esi
	testl	%esi, %esi
	je	LBB0_5
## %bb.4:
	imull	4(%r15), %esi
	movl	%ecx, %eax
	cltd
	idivl	%esi
	movl	%ecx, %eax
	subl	%edx, %eax
	addl	%esi, %eax
	testl	%edx, %edx
	cmovnel	%eax, %ecx
LBB0_5:
	movslq	%ecx, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_STM32_MDMA_CBNDTR_BNDT_MASK,4,2 ## @STM32_MDMA_CBNDTR_BNDT_MASK
	.no_dead_strip	_stm32_mdma_desc_residue
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function stm32_mdma_desc_residue
_stm32_mdma_desc_residue:               ; @stm32_mdma_desc_residue
	.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	x22, x2
	mov	x21, x1
	mov	x19, x0
	bl	_stm32_mdma_get_dev
	mov	x20, x0
	add	w8, w22, #1
	ldr	w9, [x21]
	cmp	w8, w9
	b.ge	LBB0_3
; %bb.1:
	mov	w22, #0
	sxtw	x23, w8
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x21, #8]
	ldr	x8, [x8, x23, lsl #3]
	ldr	w0, [x8]
	bl	_STM32_MDMA_CBNDTR_BNDT
	add	w22, w22, w0
	add	x23, x23, #1
	ldrsw	x8, [x21]
	cmp	x23, x8
	b.lt	LBB0_2
	b	LBB0_4
LBB0_3:
	mov	w22, #0
LBB0_4:
	ldr	w0, [x19, #8]
	bl	_STM32_MDMA_CBNDTR
	mov	x1, x0
	mov	x0, x20
	bl	_stm32_mdma_read
Lloh0:
	adrp	x8, _STM32_MDMA_CBNDTR_BNDT_MASK@GOTPAGE
Lloh1:
	ldr	x8, [x8, _STM32_MDMA_CBNDTR_BNDT_MASK@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	and	w8, w8, w0
	add	w8, w8, w22
	ldr	w9, [x19]
	cbz	w9, LBB0_6
; %bb.5:
	ldr	w10, [x19, #4]
	mul	w9, w10, w9
	sdiv	w10, w8, w9
	mul	w10, w10, w9
	add	w9, w10, w9
	cmp	w8, w10
	csel	w8, w8, w9, eq
LBB0_6:
	sxtw	x0, w8
	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 AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_STM32_MDMA_CBNDTR_BNDT_MASK,4,2 ; @STM32_MDMA_CBNDTR_BNDT_MASK
	.no_dead_strip	_stm32_mdma_desc_residue
.subsections_via_symbols
