	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function atmel_nand_dma_transfer
_atmel_nand_dma_transfer:               ## @atmel_nand_dma_transfer
	.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	%r8d, %r14d
	movq	%rcx, %r15
	movl	%edx, %r12d
	movq	%rsi, %rbx
	movq	%rdi, %r13
	movq	_finished@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_DECLARE_COMPLETION_ONSTACK
	movl	(%r13), %edi
	movq	%rbx, %rsi
	movq	%r15, %rdx
	movl	%r14d, %ecx
	callq	_dma_map_single
	movl	%eax, %ebx
	movl	(%r13), %edi
	movl	%r12d, %esi
	callq	_dma_mapping_error
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movl	(%r13), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	jmp	LBB0_7
LBB0_2:
	movq	_DMA_FROM_DEVICE@GOTPCREL(%rip), %rax
	cmpl	%r14d, (%rax)
	movl	%r12d, %esi
	cmovel	%ebx, %esi
	cmovnel	%ebx, %r12d
	movl	4(%r13), %edi
	movq	_DMA_CTRL_ACK@GOTPCREL(%rip), %rax
	movq	_DMA_PREP_INTERRUPT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r8d
	orl	(%rax), %r8d
	movl	%r12d, %edx
	movq	%r15, %rcx
	callq	_dmaengine_prep_dma_memcpy
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	movq	_atmel_nand_dma_transfer_finished@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, 8(%rax)
	movq	_finished@GOTPCREL(%rip), %rcx
	movq	%rcx, (%rax)
	movq	%rax, %rdi
	callq	_dmaengine_submit
	movl	%eax, %edi
	callq	_dma_submit_error
	testq	%rax, %rax
	je	LBB0_9
## %bb.5:
	leaq	L_.str.2(%rip), %rsi
	jmp	LBB0_6
LBB0_3:
	leaq	L_.str.1(%rip), %rsi
LBB0_6:
	movl	(%r13), %edi
	callq	_dev_err
	movl	(%r13), %edi
	movl	%ebx, %esi
	movq	%r15, %rdx
	movl	%r14d, %ecx
	callq	_dma_unmap_single
LBB0_7:
	movl	(%r13), %edi
	leaq	L_.str.3(%rip), %rsi
	callq	_dev_dbg
	movq	_EIO@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_8:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	movl	4(%r13), %edi
	callq	_dma_async_issue_pending
	movq	_finished@GOTPCREL(%rip), %rdi
	callq	_wait_for_completion
	xorl	%eax, %eax
	jmp	LBB0_8
	.cfi_endproc
                                        ## -- End function
	.comm	_finished,4,2                   ## @finished
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to prepare a buffer for DMA access\n"

	.comm	_DMA_FROM_DEVICE,4,2            ## @DMA_FROM_DEVICE
	.comm	_DMA_CTRL_ACK,4,2               ## @DMA_CTRL_ACK
	.comm	_DMA_PREP_INTERRUPT,4,2         ## @DMA_PREP_INTERRUPT
L_.str.1:                               ## @.str.1
	.asciz	"Failed to prepare DMA memcpy\n"

	.comm	_atmel_nand_dma_transfer_finished,4,2 ## @atmel_nand_dma_transfer_finished
L_.str.2:                               ## @.str.2
	.asciz	"Failed to do DMA tx_submit\n"

L_.str.3:                               ## @.str.3
	.asciz	"Fall back to CPU I/O\n"

	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_atmel_nand_dma_transfer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function atmel_nand_dma_transfer
_atmel_nand_dma_transfer:               ; @atmel_nand_dma_transfer
	.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	x20, x4
	mov	x21, x3
	mov	x23, x2
	mov	x22, x1
	mov	x19, x0
Lloh0:
	adrp	x24, _finished@GOTPAGE
Lloh1:
	ldr	x24, [x24, _finished@GOTPAGEOFF]
	ldr	w0, [x24]
	bl	_DECLARE_COMPLETION_ONSTACK
	ldr	w0, [x19]
	mov	x1, x22
	mov	x2, x21
	mov	x3, x20
	bl	_dma_map_single
	mov	x22, x0
	ldr	w0, [x19]
	mov	x1, x23
	bl	_dma_mapping_error
	cbz	x0, LBB0_2
; %bb.1:
	ldr	w0, [x19]
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	b	LBB0_7
LBB0_2:
Lloh4:
	adrp	x8, _DMA_FROM_DEVICE@GOTPAGE
Lloh5:
	ldr	x8, [x8, _DMA_FROM_DEVICE@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	cmp	w8, w20
	csel	w1, w22, w23, eq
	csel	w2, w23, w22, eq
Lloh7:
	adrp	x8, _DMA_CTRL_ACK@GOTPAGE
Lloh8:
	ldr	x8, [x8, _DMA_CTRL_ACK@GOTPAGEOFF]
	ldr	w0, [x19, #4]
Lloh9:
	ldr	w8, [x8]
Lloh10:
	adrp	x9, _DMA_PREP_INTERRUPT@GOTPAGE
Lloh11:
	ldr	x9, [x9, _DMA_PREP_INTERRUPT@GOTPAGEOFF]
Lloh12:
	ldr	w9, [x9]
	orr	w4, w9, w8
	mov	x3, x21
	bl	_dmaengine_prep_dma_memcpy
	cbz	x0, LBB0_5
; %bb.3:
Lloh13:
	adrp	x8, _atmel_nand_dma_transfer_finished@GOTPAGE
Lloh14:
	ldr	x8, [x8, _atmel_nand_dma_transfer_finished@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	str	w8, [x0, #8]
	str	x24, [x0]
	bl	_dmaengine_submit
	bl	_dma_submit_error
	cbz	x0, LBB0_9
; %bb.4:
Lloh16:
	adrp	x1, l_.str.2@PAGE
Lloh17:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_6
LBB0_5:
Lloh18:
	adrp	x1, l_.str.1@PAGE
Lloh19:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_6:
	ldr	w0, [x19]
	bl	_dev_err
	ldr	w0, [x19]
	mov	x1, x22
	mov	x2, x21
	mov	x3, x20
	bl	_dma_unmap_single
LBB0_7:
	ldr	w0, [x19]
Lloh20:
	adrp	x1, l_.str.3@PAGE
Lloh21:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_dev_dbg
Lloh22:
	adrp	x8, _EIO@GOTPAGE
Lloh23:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_8:
	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
LBB0_9:
	ldr	w0, [x19, #4]
	bl	_dma_async_issue_pending
Lloh25:
	adrp	x0, _finished@GOTPAGE
Lloh26:
	ldr	x0, [x0, _finished@GOTPAGEOFF]
	bl	_wait_for_completion
	mov	w0, #0
	b	LBB0_8
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.comm	_finished,4,2                   ; @finished
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to prepare a buffer for DMA access\n"

	.comm	_DMA_FROM_DEVICE,4,2            ; @DMA_FROM_DEVICE
	.comm	_DMA_CTRL_ACK,4,2               ; @DMA_CTRL_ACK
	.comm	_DMA_PREP_INTERRUPT,4,2         ; @DMA_PREP_INTERRUPT
l_.str.1:                               ; @.str.1
	.asciz	"Failed to prepare DMA memcpy\n"

	.comm	_atmel_nand_dma_transfer_finished,4,2 ; @atmel_nand_dma_transfer_finished
l_.str.2:                               ; @.str.2
	.asciz	"Failed to do DMA tx_submit\n"

l_.str.3:                               ; @.str.3
	.asciz	"Fall back to CPU I/O\n"

	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_atmel_nand_dma_transfer
.subsections_via_symbols
