	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_isa_dmastop                    ## -- Begin function isa_dmastop
	.p2align	4, 0x90
_isa_dmastop:                           ## @isa_dmastop
	.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	%edi, %r14d
	movq	_isa_dma_lock@GOTPCREL(%rip), %rdi
	callq	_mtx_lock
	movq	_dma_inuse@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	$1, %ebx
	movl	%r14d, %ecx
	shll	%cl, %ebx
	btl	%r14d, %eax
	jb	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rdi
	movl	%r14d, %esi
	callq	_printf
LBB0_2:
	movq	_dma_busy@GOTPCREL(%rip), %rax
	testl	%ebx, (%rax)
	jne	LBB0_5
## %bb.3:
	movq	_dma_auto_mode@GOTPCREL(%rip), %rax
	testl	%ebx, (%rax)
	je	LBB0_4
LBB0_5:
	testb	$4, %r14b
	jne	LBB0_6
## %bb.7:
	movq	_DMA1_SMSK@GOTPCREL(%rip), %rax
	jmp	LBB0_8
LBB0_6:
	movq	_DMA2_SMSK@GOTPCREL(%rip), %rax
LBB0_8:
	movl	(%rax), %edi
	movl	%r14d, %esi
	andl	$3, %esi
	orl	$4, %esi
	callq	_outb
	movl	%r14d, %edi
	callq	_isa_dmastatus_locked
	movl	%eax, %ebx
LBB0_9:
	movq	_isa_dma_lock@GOTPCREL(%rip), %rdi
	callq	_mtx_unlock
	movl	%ebx, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_4:
	leaq	L_.str.1(%rip), %rdi
	movl	%r14d, %esi
	callq	_printf
	movl	$-2, %ebx
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.comm	_isa_dma_lock,4,2               ## @isa_dma_lock
	.comm	_dma_inuse,4,2                  ## @dma_inuse
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"isa_dmastop: channel %d not acquired\n"

	.comm	_dma_busy,4,2                   ## @dma_busy
	.comm	_dma_auto_mode,4,2              ## @dma_auto_mode
L_.str.1:                               ## @.str.1
	.asciz	"chan %d not busy\n"

	.comm	_DMA1_SMSK,4,2                  ## @DMA1_SMSK
	.comm	_DMA2_SMSK,4,2                  ## @DMA2_SMSK
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_isa_dmastop                    ; -- Begin function isa_dmastop
	.p2align	2
_isa_dmastop:                           ; @isa_dmastop
	.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	x19, x0
Lloh0:
	adrp	x0, _isa_dma_lock@GOTPAGE
Lloh1:
	ldr	x0, [x0, _isa_dma_lock@GOTPAGEOFF]
	bl	_mtx_lock
Lloh2:
	adrp	x8, _dma_inuse@GOTPAGE
Lloh3:
	ldr	x8, [x8, _dma_inuse@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	mov	w9, #1
	lsl	w20, w9, w19
	tst	w8, w20
	b.ne	LBB0_2
; %bb.1:
Lloh5:
	adrp	x0, l_.str@PAGE
Lloh6:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x19
	bl	_printf
LBB0_2:
Lloh7:
	adrp	x8, _dma_busy@GOTPAGE
Lloh8:
	ldr	x8, [x8, _dma_busy@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	tst	w8, w20
	b.ne	LBB0_4
; %bb.3:
Lloh10:
	adrp	x8, _dma_auto_mode@GOTPAGE
Lloh11:
	ldr	x8, [x8, _dma_auto_mode@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	tst	w8, w20
	b.eq	LBB0_6
LBB0_4:
Lloh13:
	adrp	x8, _DMA1_SMSK@GOTPAGE
Lloh14:
	ldr	x8, [x8, _DMA1_SMSK@GOTPAGEOFF]
Lloh15:
	adrp	x9, _DMA2_SMSK@GOTPAGE
Lloh16:
	ldr	x9, [x9, _DMA2_SMSK@GOTPAGEOFF]
	tst	w19, #0x4
	csel	x8, x8, x9, eq
	ldr	w0, [x8]
	mov	w1, #4
	bfxil	w1, w19, #0, #2
	bl	_outb
	mov	x0, x19
	bl	_isa_dmastatus_locked
	mov	x19, x0
LBB0_5:
Lloh17:
	adrp	x0, _isa_dma_lock@GOTPAGE
Lloh18:
	ldr	x0, [x0, _isa_dma_lock@GOTPAGEOFF]
	bl	_mtx_unlock
	mov	x0, x19
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_6:
Lloh19:
	adrp	x0, l_.str.1@PAGE
Lloh20:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x19
	bl	_printf
	mov	w19, #-2
	b	LBB0_5
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_isa_dma_lock,4,2               ; @isa_dma_lock
	.comm	_dma_inuse,4,2                  ; @dma_inuse
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"isa_dmastop: channel %d not acquired\n"

	.comm	_dma_busy,4,2                   ; @dma_busy
	.comm	_dma_auto_mode,4,2              ; @dma_auto_mode
l_.str.1:                               ; @.str.1
	.asciz	"chan %d not busy\n"

	.comm	_DMA1_SMSK,4,2                  ; @DMA1_SMSK
	.comm	_DMA2_SMSK,4,2                  ; @DMA2_SMSK
.subsections_via_symbols
