	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function usb_dmac_chan_get_residue
_usb_dmac_chan_get_residue:             ## @usb_dmac_chan_get_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	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movl	%esi, %eax
	movq	%rdi, %r14
	movq	8(%rdi), %rsi
	testq	%rsi, %rsi
	jne	LBB0_4
## %bb.1:
	movq	%r14, %rdi
	movl	%eax, %esi
	callq	_vchan_find_desc
	testq	%rax, %rax
	je	LBB0_2
## %bb.3:
	movq	%rax, %rdi
	callq	_to_usb_dmac_desc
	movq	%rax, %rsi
LBB0_4:
	movl	(%rsi), %edx
	movl	4(%rsi), %r8d
	leal	1(%rdx), %eax
	cmpl	%r8d, %eax
	jge	LBB0_5
## %bb.6:
	movq	8(%rsi), %rcx
	movslq	%eax, %rdi
	movl	%edx, %r9d
	notl	%r9d
	addl	%r8d, %r9d
	movl	%r8d, %eax
	subl	%edx, %eax
	addl	$-2, %eax
	cmpl	$3, %eax
	jae	LBB0_8
## %bb.7:
	xorl	%ebx, %ebx
	jmp	LBB0_10
LBB0_5:
	xorl	%ebx, %ebx
	jmp	LBB0_13
LBB0_8:
	movl	%r9d, %eax
	andl	$-4, %eax
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	addl	(%rcx,%rdi,8), %ebx
	addl	8(%rcx,%rdi,8), %ebx
	addl	16(%rcx,%rdi,8), %ebx
	addl	24(%rcx,%rdi,8), %ebx
	movslq	%ebx, %rbx
	addq	$4, %rdi
	addl	$-4, %eax
	jne	LBB0_9
LBB0_10:
	testb	$3, %r9b
	je	LBB0_13
## %bb.11:
	leaq	(%rcx,%rdi,8), %rax
	movl	%edx, %ecx
	notb	%cl
	addb	%r8b, %cl
	movzbl	%cl, %ecx
	andl	$3, %ecx
	xorl	%edi, %edi
	.p2align	4, 0x90
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	addl	(%rax,%rdi,8), %ebx
	movslq	%ebx, %rbx
	incq	%rdi
	cmpl	%edi, %ecx
	jne	LBB0_12
LBB0_13:
	movq	%r14, %rdi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_usb_dmac_get_current_residue
	addl	%eax, %ebx
LBB0_14:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_2:
	xorl	%ebx, %ebx
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_usb_dmac_chan_get_residue
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function usb_dmac_chan_get_residue
_usb_dmac_chan_get_residue:             ; @usb_dmac_chan_get_residue
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x8, x1
	mov	x19, x0
	ldr	x1, [x0, #8]
	cbnz	x1, LBB0_3
; %bb.1:
	mov	x0, x19
	mov	x1, x8
	bl	_vchan_find_desc
	cbz	x0, LBB0_8
; %bb.2:
	bl	_to_usb_dmac_desc
	mov	x1, x0
LBB0_3:
	ldp	w2, w9, [x1]
	add	w8, w2, #1
	cmp	w8, w9
	b.ge	LBB0_6
; %bb.4:
	mov	x20, #0
	ldr	x10, [x1, #8]
	add	x8, x10, w8, sxtw #3
	mvn	w10, w2
	add	w9, w10, w9
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w10, [x8], #8
	add	w10, w10, w20
	sxtw	x20, w10
	subs	w9, w9, #1
	b.ne	LBB0_5
	b	LBB0_7
LBB0_6:
	mov	x20, #0
LBB0_7:
	mov	x0, x19
	bl	_usb_dmac_get_current_residue
	add	w0, w0, w20
LBB0_8:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_usb_dmac_chan_get_residue
.subsections_via_symbols
