	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function denali_dma_xfer
_denali_dma_xfer:                       ## @denali_dma_xfer
	.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
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r14
	movq	%rsi, %rbx
	movq	%rdi, %r15
	testl	%r8d, %r8d
	movl	%r8d, -52(%rbp)                 ## 4-byte Spill
	movl	%ecx, -48(%rbp)                 ## 4-byte Spill
	jne	LBB0_1
## %bb.2:
	movq	_DMA_FROM_DEVICE@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_1:
	movq	_DMA_TO_DEVICE@GOTPCREL(%rip), %rax
LBB0_3:
	movl	(%rax), %r13d
	movl	4(%r15), %edi
	movq	%rbx, %rsi
	movq	%r14, %rdx
	movl	%r13d, %ecx
	callq	_dma_map_single
	movl	%eax, %r12d
	movl	4(%r15), %edi
	movl	%eax, %esi
	callq	_dma_mapping_error
	testq	%rax, %rax
	je	LBB0_4
## %bb.19:
	movl	4(%r15), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_dbg
	movq	%r15, %rdi
	movq	%rbx, %rsi
	movq	%r14, %rdx
	movl	-48(%rbp), %ecx                 ## 4-byte Reload
	movl	-52(%rbp), %r8d                 ## 4-byte Reload
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_denali_pio_xfer                ## TAILCALL
LBB0_4:
	movl	%r13d, -56(%rbp)                ## 4-byte Spill
	movq	%r14, -72(%rbp)                 ## 8-byte Spill
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movl	-52(%rbp), %r13d                ## 4-byte Reload
	testl	%r13d, %r13d
	je	LBB0_6
## %bb.5:
	movq	_INTR__DMA_CMD_COMP@GOTPCREL(%rip), %rax
	movq	_INTR__PROGRAM_FAIL@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r14d
	orl	(%rax), %r14d
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
	jmp	LBB0_10
LBB0_6:
	movq	_DENALI_CAP_HW_ECC_FIXUP@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_INTR__DMA_CMD_COMP@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r14d
	testl	%eax, (%r15)
	je	LBB0_8
## %bb.7:
	movq	_INTR__ECC_UNCOR_ERR@GOTPCREL(%rip), %rax
	jmp	LBB0_9
LBB0_8:
	movq	_INTR__ECC_ERR@GOTPCREL(%rip), %rax
LBB0_9:
	movl	(%rax), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
LBB0_10:
	movq	_DMA_ENABLE__FLAG@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_DMA_ENABLE@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rsi
	addq	8(%r15), %rsi
	callq	_iowrite32
	movq	(%rbx), %rdi
	addq	8(%r15), %rdi
	callq	_ioread32
	movq	%r15, %rdi
	callq	_denali_reset_irq
	movq	%r15, %rdi
	movl	%r12d, %esi
	movl	-48(%rbp), %edx                 ## 4-byte Reload
	movl	%r13d, %ecx
	callq	*16(%r15)
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_denali_wait_for_irq
	movl	%eax, %r14d
	movq	_INTR__DMA_CMD_COMP@GOTPCREL(%rip), %rax
	testl	%r14d, (%rax)
	je	LBB0_11
## %bb.12:
	movl	%r12d, %ebx
	testl	%r14d, -44(%rbp)                ## 4-byte Folded Reload
	je	LBB0_13
## %bb.14:
	movq	_EBADMSG@GOTPCREL(%rip), %rax
	jmp	LBB0_15
LBB0_11:
	movl	%r12d, %ebx
	movq	_EIO@GOTPCREL(%rip), %rax
LBB0_15:
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
	jmp	LBB0_16
LBB0_13:
	xorl	%r12d, %r12d
LBB0_16:
	movq	_DMA_ENABLE@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r15), %rsi
	xorl	%edi, %edi
	callq	_iowrite32
	movl	4(%r15), %edi
	movl	%ebx, %esi
	movq	-72(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdx
	movl	-56(%rbp), %ecx                 ## 4-byte Reload
	callq	_dma_unmap_single
	movq	_INTR__ERASED_PAGE@GOTPCREL(%rip), %rax
	testl	%r14d, (%rax)
	je	LBB0_18
## %bb.17:
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movl	$255, %esi
	movq	%rbx, %rdx
	callq	_memset
LBB0_18:
	movl	%r12d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DMA_TO_DEVICE,4,2              ## @DMA_TO_DEVICE
	.comm	_DMA_FROM_DEVICE,4,2            ## @DMA_FROM_DEVICE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to DMA-map buffer. Trying PIO.\n"

	.comm	_INTR__DMA_CMD_COMP,4,2         ## @INTR__DMA_CMD_COMP
	.comm	_INTR__PROGRAM_FAIL,4,2         ## @INTR__PROGRAM_FAIL
	.comm	_DENALI_CAP_HW_ECC_FIXUP,4,2    ## @DENALI_CAP_HW_ECC_FIXUP
	.comm	_INTR__ECC_UNCOR_ERR,4,2        ## @INTR__ECC_UNCOR_ERR
	.comm	_INTR__ECC_ERR,4,2              ## @INTR__ECC_ERR
	.comm	_DMA_ENABLE__FLAG,4,2           ## @DMA_ENABLE__FLAG
	.comm	_DMA_ENABLE,8,3                 ## @DMA_ENABLE
	.comm	_EIO,4,2                        ## @EIO
	.comm	_EBADMSG,4,2                    ## @EBADMSG
	.comm	_INTR__ERASED_PAGE,4,2          ## @INTR__ERASED_PAGE
	.no_dead_strip	_denali_dma_xfer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function denali_dma_xfer
_denali_dma_xfer:                       ; @denali_dma_xfer
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x24, x4
	mov	x25, x3
	mov	x19, x2
	mov	x20, x1
	mov	x21, x0
	cmp	w4, #0
Lloh0:
	adrp	x8, _DMA_TO_DEVICE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _DMA_TO_DEVICE@GOTPAGEOFF]
Lloh2:
	adrp	x9, _DMA_FROM_DEVICE@GOTPAGE
Lloh3:
	ldr	x9, [x9, _DMA_FROM_DEVICE@GOTPAGEOFF]
	csel	x8, x9, x8, eq
	ldr	w22, [x8]
	ldr	w0, [x0, #4]
	mov	x3, x22
	bl	_dma_map_single
	mov	x23, x0
	ldr	w0, [x21, #4]
	mov	x1, x23
	bl	_dma_mapping_error
	cbz	x0, LBB0_2
; %bb.1:
	ldr	w0, [x21, #4]
Lloh4:
	adrp	x1, l_.str@PAGE
Lloh5:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_dbg
	mov	x0, x21
	mov	x1, x20
	mov	x2, x19
	mov	x3, x25
	mov	x4, x24
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	b	_denali_pio_xfer
LBB0_2:
Lloh6:
	adrp	x28, _INTR__DMA_CMD_COMP@GOTPAGE
Lloh7:
	ldr	x28, [x28, _INTR__DMA_CMD_COMP@GOTPAGEOFF]
	cbz	w24, LBB0_4
; %bb.3:
	str	wzr, [sp, #12]                  ; 4-byte Folded Spill
	ldr	w8, [x28]
Lloh8:
	adrp	x9, _INTR__PROGRAM_FAIL@GOTPAGE
Lloh9:
	ldr	x9, [x9, _INTR__PROGRAM_FAIL@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	orr	w26, w9, w8
	b	LBB0_8
LBB0_4:
	ldr	w8, [x21]
Lloh11:
	adrp	x9, _DENALI_CAP_HW_ECC_FIXUP@GOTPAGE
Lloh12:
	ldr	x9, [x9, _DENALI_CAP_HW_ECC_FIXUP@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	mov	x10, x28
	ldr	w26, [x28]
	tst	w9, w8
	b.eq	LBB0_6
; %bb.5:
Lloh14:
	adrp	x8, _INTR__ECC_UNCOR_ERR@GOTPAGE
Lloh15:
	ldr	x8, [x8, _INTR__ECC_UNCOR_ERR@GOTPAGEOFF]
	b	LBB0_7
LBB0_6:
Lloh16:
	adrp	x8, _INTR__ECC_ERR@GOTPAGE
Lloh17:
	ldr	x8, [x8, _INTR__ECC_ERR@GOTPAGEOFF]
LBB0_7:
	ldr	w8, [x8]
	str	w8, [sp, #12]                   ; 4-byte Folded Spill
	mov	x28, x10
LBB0_8:
Lloh18:
	adrp	x8, _DMA_ENABLE__FLAG@GOTPAGE
Lloh19:
	ldr	x8, [x8, _DMA_ENABLE__FLAG@GOTPAGEOFF]
Lloh20:
	ldr	w0, [x8]
	ldr	x8, [x21, #8]
Lloh21:
	adrp	x27, _DMA_ENABLE@GOTPAGE
Lloh22:
	ldr	x27, [x27, _DMA_ENABLE@GOTPAGEOFF]
	ldr	x9, [x27]
	add	x1, x9, x8
	bl	_iowrite32
	ldr	x8, [x21, #8]
	ldr	x9, [x27]
	add	x0, x9, x8
	bl	_ioread32
	mov	x0, x21
	bl	_denali_reset_irq
	ldr	x8, [x21, #16]
	mov	x0, x21
	mov	x1, x23
	mov	x2, x25
	mov	x3, x24
	blr	x8
	mov	x0, x21
	mov	x1, x26
	bl	_denali_wait_for_irq
	mov	x24, x0
	ldr	w8, [x28]
	tst	w8, w0
	b.eq	LBB0_11
; %bb.9:
	ldr	w8, [sp, #12]                   ; 4-byte Folded Reload
	tst	w24, w8
	b.eq	LBB0_13
; %bb.10:
Lloh23:
	adrp	x8, _EBADMSG@GOTPAGE
Lloh24:
	ldr	x8, [x8, _EBADMSG@GOTPAGEOFF]
	b	LBB0_12
LBB0_11:
Lloh25:
	adrp	x8, _EIO@GOTPAGE
Lloh26:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
LBB0_12:
	ldr	w8, [x8]
	neg	w25, w8
	b	LBB0_14
LBB0_13:
	mov	w25, #0
LBB0_14:
	ldr	x8, [x21, #8]
	ldr	x9, [x27]
	add	x1, x9, x8
	mov	w0, #0
	bl	_iowrite32
	ldr	w0, [x21, #4]
	mov	x1, x23
	mov	x2, x19
	mov	x3, x22
	bl	_dma_unmap_single
Lloh27:
	adrp	x8, _INTR__ERASED_PAGE@GOTPAGE
Lloh28:
	ldr	x8, [x8, _INTR__ERASED_PAGE@GOTPAGEOFF]
Lloh29:
	ldr	w8, [x8]
	tst	w8, w24
	b.eq	LBB0_16
; %bb.15:
	mov	x0, x20
	mov	w1, #255
	mov	x2, x19
	bl	_memset
LBB0_16:
	mov	x0, x25
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_DMA_TO_DEVICE,4,2              ; @DMA_TO_DEVICE
	.comm	_DMA_FROM_DEVICE,4,2            ; @DMA_FROM_DEVICE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to DMA-map buffer. Trying PIO.\n"

	.comm	_INTR__DMA_CMD_COMP,4,2         ; @INTR__DMA_CMD_COMP
	.comm	_INTR__PROGRAM_FAIL,4,2         ; @INTR__PROGRAM_FAIL
	.comm	_DENALI_CAP_HW_ECC_FIXUP,4,2    ; @DENALI_CAP_HW_ECC_FIXUP
	.comm	_INTR__ECC_UNCOR_ERR,4,2        ; @INTR__ECC_UNCOR_ERR
	.comm	_INTR__ECC_ERR,4,2              ; @INTR__ECC_ERR
	.comm	_DMA_ENABLE__FLAG,4,2           ; @DMA_ENABLE__FLAG
	.comm	_DMA_ENABLE,8,3                 ; @DMA_ENABLE
	.comm	_EIO,4,2                        ; @EIO
	.comm	_EBADMSG,4,2                    ; @EBADMSG
	.comm	_INTR__ERASED_PAGE,4,2          ; @INTR__ERASED_PAGE
	.no_dead_strip	_denali_dma_xfer
.subsections_via_symbols
