	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ata_dbdma_stop
_ata_dbdma_stop:                        ## @ata_dbdma_stop
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movl	(%rdi), %edi
	callq	_device_get_softc
	movq	%rax, %rbx
	movl	4(%rax), %edi
	callq	_dbdma_get_chan_status
	movl	%eax, %r15d
	movl	4(%rbx), %edi
	callq	_dbdma_pause
	movq	_ATA_DMA_ACTIVE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	notl	%eax
	andl	%eax, (%rbx)
	movq	_DBDMA_STATUS_DEAD@GOTPCREL(%rip), %rax
	testl	%r15d, (%rax)
	je	LBB0_2
## %bb.1:
	movl	(%r14), %edi
	leaq	L_.str(%rip), %rsi
	callq	_device_printf
	movl	(%r14), %edi
	callq	_ata_dbdma_reset
	jmp	LBB0_8
LBB0_2:
	movq	_DBDMA_STATUS_RUN@GOTPCREL(%rip), %rax
	testl	%r15d, (%rax)
	je	LBB0_3
## %bb.4:
	movq	_DBDMA_STATUS_ACTIVE@GOTPCREL(%rip), %rax
	testl	%r15d, (%rax)
	je	LBB0_5
## %bb.6:
	movl	(%r14), %edi
	leaq	L_.str.2(%rip), %rsi
	jmp	LBB0_7
LBB0_3:
	movl	(%r14), %edi
	leaq	L_.str.1(%rip), %rsi
LBB0_7:
	callq	_device_printf
LBB0_8:
	movq	_ATA_S_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_9:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	xorl	%eax, %eax
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.comm	_ATA_DMA_ACTIVE,4,2             ## @ATA_DMA_ACTIVE
	.comm	_DBDMA_STATUS_DEAD,4,2          ## @DBDMA_STATUS_DEAD
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"DBDMA dead, resetting channel...\n"

	.comm	_ATA_S_ERROR,4,2                ## @ATA_S_ERROR
	.comm	_DBDMA_STATUS_RUN,4,2           ## @DBDMA_STATUS_RUN
L_.str.1:                               ## @.str.1
	.asciz	"DBDMA confused, stop called when channel is not running!\n"

	.comm	_DBDMA_STATUS_ACTIVE,4,2        ## @DBDMA_STATUS_ACTIVE
L_.str.2:                               ## @.str.2
	.asciz	"DBDMA channel stopped prematurely\n"

	.no_dead_strip	_ata_dbdma_stop
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ata_dbdma_stop
_ata_dbdma_stop:                        ; @ata_dbdma_stop
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x19, x0
	ldr	w0, [x0]
	bl	_device_get_softc
	mov	x21, x0
	ldr	w0, [x0, #4]
	bl	_dbdma_get_chan_status
	mov	x20, x0
	ldr	w0, [x21, #4]
	bl	_dbdma_pause
Lloh0:
	adrp	x8, _ATA_DMA_ACTIVE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ATA_DMA_ACTIVE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	ldr	w9, [x21]
	bic	w8, w9, w8
	str	w8, [x21]
Lloh3:
	adrp	x8, _DBDMA_STATUS_DEAD@GOTPAGE
Lloh4:
	ldr	x8, [x8, _DBDMA_STATUS_DEAD@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	tst	w8, w20
	b.eq	LBB0_2
; %bb.1:
	ldr	w0, [x19]
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	bl	_device_printf
	ldr	w0, [x19]
	bl	_ata_dbdma_reset
	b	LBB0_7
LBB0_2:
Lloh8:
	adrp	x8, _DBDMA_STATUS_RUN@GOTPAGE
Lloh9:
	ldr	x8, [x8, _DBDMA_STATUS_RUN@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	tst	w8, w20
	b.eq	LBB0_5
; %bb.3:
Lloh11:
	adrp	x8, _DBDMA_STATUS_ACTIVE@GOTPAGE
Lloh12:
	ldr	x8, [x8, _DBDMA_STATUS_ACTIVE@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	tst	w8, w20
	b.eq	LBB0_9
; %bb.4:
	ldr	w0, [x19]
Lloh14:
	adrp	x1, l_.str.2@PAGE
Lloh15:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_6
LBB0_5:
	ldr	w0, [x19]
Lloh16:
	adrp	x1, l_.str.1@PAGE
Lloh17:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_6:
	bl	_device_printf
LBB0_7:
Lloh18:
	adrp	x8, _ATA_S_ERROR@GOTPAGE
Lloh19:
	ldr	x8, [x8, _ATA_S_ERROR@GOTPAGEOFF]
Lloh20:
	ldr	w0, [x8]
LBB0_8:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_9:
	mov	w0, #0
	b	LBB0_8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_ATA_DMA_ACTIVE,4,2             ; @ATA_DMA_ACTIVE
	.comm	_DBDMA_STATUS_DEAD,4,2          ; @DBDMA_STATUS_DEAD
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"DBDMA dead, resetting channel...\n"

	.comm	_ATA_S_ERROR,4,2                ; @ATA_S_ERROR
	.comm	_DBDMA_STATUS_RUN,4,2           ; @DBDMA_STATUS_RUN
l_.str.1:                               ; @.str.1
	.asciz	"DBDMA confused, stop called when channel is not running!\n"

	.comm	_DBDMA_STATUS_ACTIVE,4,2        ; @DBDMA_STATUS_ACTIVE
l_.str.2:                               ; @.str.2
	.asciz	"DBDMA channel stopped prematurely\n"

	.no_dead_strip	_ata_dbdma_stop
.subsections_via_symbols
