	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function r852_do_dma
_r852_do_dma:                           ## @r852_do_dma
	.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, %r15d
	movq	%rsi, %r14
	movq	%rdi, %r12
	movq	$0, 48(%rdi)
	movl	%edx, (%rdi)
	movl	$1, 4(%rdi)
	addq	$44, %rdi
	callq	_reinit_completion
	testl	%r15d, %r15d
	leaq	L_.str.1(%rip), %rax
	leaq	L_.str.2(%rip), %rsi
	cmovneq	%rax, %rsi
	leaq	L_.str(%rip), %rdi
	movq	_DMA_MEMORY@GOTPCREL(%rip), %rbx
	cmovneq	_DMA_INTERNAL@GOTPCREL(%rip), %rbx
	xorl	%eax, %eax
	callq	_dbg_verbose
	movl	(%rbx), %eax
	movl	%eax, 40(%r12)
	movq	_R852_DMA_LEN@GOTPCREL(%rip), %rbx
	movslq	(%rbx), %rdx
	leaq	-1(%rdx), %rax
	testq	%r14, %rax
	jne	LBB0_6
## %bb.1:
	movq	32(%r12), %rdi
	testl	%r15d, %r15d
	je	LBB0_2
## %bb.3:
	movq	_DMA_FROM_DEVICE@GOTPCREL(%rip), %rax
	jmp	LBB0_4
LBB0_2:
	movq	_DMA_TO_DEVICE@GOTPCREL(%rip), %rax
LBB0_4:
	movl	(%rax), %ecx
	movq	%r14, %rsi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_dma_map_single
	movl	%eax, 24(%r12)
	movq	32(%r12), %rdi
	movl	%eax, %esi
	callq	_dma_mapping_error
	testq	%rax, %rax
	je	LBB0_5
LBB0_6:
	leaq	L_.str.3(%rip), %rdi
	xorl	%eax, %eax
	callq	_dbg_verbose
	movl	20(%r12), %eax
	movl	%eax, 24(%r12)
	movb	$1, %r13b
	testl	%r15d, %r15d
	jne	LBB0_8
## %bb.7:
	movq	8(%r12), %rdi
	movl	(%rbx), %edx
	movq	%r14, %rsi
	callq	_memcpy
	jmp	LBB0_8
LBB0_5:
	xorl	%r13d, %r13d
LBB0_8:
	leaq	16(%r12), %rbx
	movq	%rbx, %rdi
	callq	_spin_lock_irqsave
	movq	%r12, %rdi
	callq	_r852_dma_enable
	movq	%rbx, %rdi
	callq	_spin_unlock_irqrestore
	movq	%r12, %rdi
	callq	_r852_dma_wait
	testl	%eax, %eax
	je	LBB0_9
## %bb.11:
	movq	%r12, %rdi
	movl	%eax, %esi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_r852_dma_done                  ## TAILCALL
LBB0_9:
	testl	%r15d, %r15d
	sete	%al
	xorb	$1, %r13b
	orb	%al, %r13b
	jne	LBB0_10
## %bb.12:
	movq	8(%r12), %rsi
	movq	_R852_DMA_LEN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_memcpy                         ## TAILCALL
LBB0_10:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"doing dma %s "

L_.str.1:                               ## @.str.1
	.asciz	"read"

L_.str.2:                               ## @.str.2
	.asciz	"write"

	.comm	_DMA_INTERNAL,4,2               ## @DMA_INTERNAL
	.comm	_DMA_MEMORY,4,2                 ## @DMA_MEMORY
	.comm	_R852_DMA_LEN,4,2               ## @R852_DMA_LEN
	.comm	_DMA_FROM_DEVICE,4,2            ## @DMA_FROM_DEVICE
	.comm	_DMA_TO_DEVICE,4,2              ## @DMA_TO_DEVICE
L_.str.3:                               ## @.str.3
	.asciz	"dma: using bounce buffer"

	.no_dead_strip	_r852_do_dma
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function r852_do_dma
_r852_do_dma:                           ; @r852_do_dma
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x21, x2
	mov	x19, x1
	mov	x20, x0
	str	xzr, [x0, #48]
	mov	w8, #1
	stp	w2, w8, [x0], #44
	bl	_reinit_completion
Lloh0:
	adrp	x8, l_.str.2@PAGE
Lloh1:
	add	x8, x8, l_.str.2@PAGEOFF
Lloh2:
	adrp	x9, l_.str.1@PAGE
Lloh3:
	add	x9, x9, l_.str.1@PAGEOFF
	cmp	w21, #0
	csel	x8, x9, x8, ne
	str	x8, [sp]
Lloh4:
	adrp	x0, l_.str@PAGE
Lloh5:
	add	x0, x0, l_.str@PAGEOFF
Lloh6:
	adrp	x8, _DMA_INTERNAL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _DMA_INTERNAL@GOTPAGEOFF]
Lloh8:
	adrp	x9, _DMA_MEMORY@GOTPAGE
Lloh9:
	ldr	x9, [x9, _DMA_MEMORY@GOTPAGEOFF]
	csel	x22, x8, x9, ne
	bl	_dbg_verbose
	ldr	w8, [x22]
	str	w8, [x20, #40]
Lloh10:
	adrp	x23, _R852_DMA_LEN@GOTPAGE
Lloh11:
	ldr	x23, [x23, _R852_DMA_LEN@GOTPAGEOFF]
	ldrsw	x2, [x23]
	sub	x8, x2, #1
	tst	x8, x19
	b.ne	LBB0_2
; %bb.1:
Lloh12:
	adrp	x8, _DMA_FROM_DEVICE@GOTPAGE
Lloh13:
	ldr	x8, [x8, _DMA_FROM_DEVICE@GOTPAGEOFF]
	ldr	x0, [x20, #32]
Lloh14:
	adrp	x9, _DMA_TO_DEVICE@GOTPAGE
Lloh15:
	ldr	x9, [x9, _DMA_TO_DEVICE@GOTPAGEOFF]
	cmp	w21, #0
	csel	x8, x8, x9, ne
	ldr	w3, [x8]
	mov	x1, x19
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_dma_map_single
	mov	x1, x0
	str	w0, [x20, #24]
	ldr	x0, [x20, #32]
	bl	_dma_mapping_error
	cbz	x0, LBB0_10
LBB0_2:
Lloh16:
	adrp	x0, l_.str.3@PAGE
Lloh17:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_dbg_verbose
	ldr	w8, [x20, #20]
	str	w8, [x20, #24]
	cbnz	w21, LBB0_4
; %bb.3:
	ldr	x0, [x20, #8]
	ldr	w2, [x23]
	mov	x1, x19
	bl	_memcpy
LBB0_4:
	mov	w24, #1
LBB0_5:
	add	x22, x20, #16
	mov	x0, x22
	bl	_spin_lock_irqsave
	mov	x0, x20
	bl	_r852_dma_enable
	mov	x0, x22
	bl	_spin_unlock_irqrestore
	mov	x0, x20
	bl	_r852_dma_wait
	cbz	w0, LBB0_7
; %bb.6:
	mov	x1, x0
	mov	x0, x20
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	b	_r852_dma_done
LBB0_7:
	cmp	w21, #0
	cset	w8, eq
	eor	w9, w24, #0x1
	orr	w8, w8, w9
	tbnz	w8, #0, LBB0_9
; %bb.8:
	ldr	x1, [x20, #8]
	ldr	w2, [x23]
	mov	x0, x19
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	b	_memcpy
LBB0_9:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_10:
	mov	w24, #0
	b	LBB0_5
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpAdd	Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"doing dma %s "

l_.str.1:                               ; @.str.1
	.asciz	"read"

l_.str.2:                               ; @.str.2
	.asciz	"write"

	.comm	_DMA_INTERNAL,4,2               ; @DMA_INTERNAL
	.comm	_DMA_MEMORY,4,2                 ; @DMA_MEMORY
	.comm	_R852_DMA_LEN,4,2               ; @R852_DMA_LEN
	.comm	_DMA_FROM_DEVICE,4,2            ; @DMA_FROM_DEVICE
	.comm	_DMA_TO_DEVICE,4,2              ; @DMA_TO_DEVICE
l_.str.3:                               ; @.str.3
	.asciz	"dma: using bounce buffer"

	.no_dead_strip	_r852_do_dma
.subsections_via_symbols
