	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function isa_dmastatus_locked
_isa_dmastatus_locked:                  ## @isa_dmastatus_locked
	.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	%edi, %r15d
	movq	_MA_OWNED@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_isa_dma_lock@GOTPCREL(%rip), %rdi
	callq	_mtx_assert
	movq	_dma_inuse@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	$1, %eax
	movl	%r15d, %ecx
	shll	%cl, %eax
	btl	%r15d, %edx
	jae	LBB0_1
## %bb.2:
	movq	_dma_busy@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	jne	LBB0_5
## %bb.3:
	movq	_dma_auto_mode@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_4
LBB0_5:
	cmpl	$3, %r15d
	jg	LBB0_7
## %bb.6:
	movq	_DMA1_FFC@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movl	%r15d, %edi
	callq	_DMA1_CHN
	movl	%eax, %r13d
	incl	%r13d
	jmp	LBB0_8
LBB0_1:
	leaq	L_.str(%rip), %rdi
	movl	%r15d, %esi
	callq	_printf
	movl	$-1, %eax
	jmp	LBB0_9
LBB0_7:
	movq	_DMA2_FFC@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	leal	-4(%r15), %edi
	callq	_DMA2_CHN
	movl	%eax, %r13d
	addl	$2, %r13d
LBB0_8:
	xorl	%eax, %eax
	callq	_disable_intr
	movl	%r14d, %edi
	xorl	%esi, %esi
	callq	_outb
	movl	%r13d, %edi
	callq	_inb
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	%r13d, %edi
	callq	_inb
	movl	%eax, %r12d
	movl	%r14d, %edi
	xorl	%esi, %esi
	callq	_outb
	movl	%r13d, %edi
	callq	_inb
	movl	%eax, %r14d
	movl	%r13d, %edi
	callq	_inb
	movl	%eax, %ebx
	xorl	%eax, %eax
	callq	_enable_intr
	shll	$8, %r12d
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	addl	%eax, %r12d
	shll	$8, %ebx
	addl	%r14d, %ebx
	cmpl	%r14d, %eax
	cmovgel	%r12d, %ebx
	incl	%ebx
	movzwl	%bx, %eax
	cmpl	$4, %r15d
	setge	%cl
	shll	%cl, %eax
LBB0_9:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	leaq	L_.str.1(%rip), %rdi
	movl	%r15d, %esi
	callq	_printf
	movl	$-2, %eax
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.comm	_isa_dma_lock,4,2               ## @isa_dma_lock
	.comm	_MA_OWNED,4,2                   ## @MA_OWNED
	.comm	_dma_inuse,4,2                  ## @dma_inuse
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"isa_dmastatus: channel %d not active\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_FFC,4,2                   ## @DMA1_FFC
	.comm	_DMA2_FFC,4,2                   ## @DMA2_FFC
	.no_dead_strip	_isa_dmastatus_locked
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function isa_dmastatus_locked
_isa_dmastatus_locked:                  ; @isa_dmastatus_locked
	.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	x19, x0
Lloh0:
	adrp	x8, _MA_OWNED@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MA_OWNED@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
Lloh3:
	adrp	x0, _isa_dma_lock@GOTPAGE
Lloh4:
	ldr	x0, [x0, _isa_dma_lock@GOTPAGEOFF]
	bl	_mtx_assert
Lloh5:
	adrp	x8, _dma_inuse@GOTPAGE
Lloh6:
	ldr	x8, [x8, _dma_inuse@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x8]
	mov	w8, #1
	lsl	w8, w8, w19
	tst	w9, w8
	b.eq	LBB0_5
; %bb.1:
Lloh8:
	adrp	x9, _dma_busy@GOTPAGE
Lloh9:
	ldr	x9, [x9, _dma_busy@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	tst	w9, w8
	b.ne	LBB0_3
; %bb.2:
Lloh11:
	adrp	x9, _dma_auto_mode@GOTPAGE
Lloh12:
	ldr	x9, [x9, _dma_auto_mode@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_9
LBB0_3:
	cmp	w19, #3
	b.gt	LBB0_6
; %bb.4:
Lloh14:
	adrp	x8, _DMA1_FFC@GOTPAGE
Lloh15:
	ldr	x8, [x8, _DMA1_FFC@GOTPAGEOFF]
Lloh16:
	ldr	w20, [x8]
	mov	x0, x19
	bl	_DMA1_CHN
	add	w21, w0, #1
	b	LBB0_7
LBB0_5:
Lloh17:
	adrp	x0, l_.str@PAGE
Lloh18:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x19
	bl	_printf
	mov	w0, #-1
	b	LBB0_8
LBB0_6:
Lloh19:
	adrp	x8, _DMA2_FFC@GOTPAGE
Lloh20:
	ldr	x8, [x8, _DMA2_FFC@GOTPAGEOFF]
Lloh21:
	ldr	w20, [x8]
	sub	w0, w19, #4
	bl	_DMA2_CHN
	add	w21, w0, #2
LBB0_7:
	bl	_disable_intr
	mov	x0, x20
	mov	w1, #0
	bl	_outb
	mov	x0, x21
	bl	_inb
	mov	x22, x0
	mov	x0, x21
	bl	_inb
	mov	x23, x0
	mov	x0, x20
	mov	w1, #0
	bl	_outb
	mov	x0, x21
	bl	_inb
	mov	x20, x0
	mov	x0, x21
	bl	_inb
	mov	x21, x0
	bl	_enable_intr
	add	w8, w22, w23, lsl #8
	add	w9, w20, w21, lsl #8
	cmp	w22, w20
	csel	w8, w9, w8, lt
	add	w8, w8, #1
	and	w8, w8, #0xffff
	cmp	w19, #3
	cset	w9, gt
	lsl	w0, w8, w9
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:
Lloh22:
	adrp	x0, l_.str.1@PAGE
Lloh23:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x19
	bl	_printf
	mov	w0, #-2
	b	LBB0_8
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_isa_dma_lock,4,2               ; @isa_dma_lock
	.comm	_MA_OWNED,4,2                   ; @MA_OWNED
	.comm	_dma_inuse,4,2                  ; @dma_inuse
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"isa_dmastatus: channel %d not active\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_FFC,4,2                   ; @DMA1_FFC
	.comm	_DMA2_FFC,4,2                   ; @DMA2_FFC
	.no_dead_strip	_isa_dmastatus_locked
.subsections_via_symbols
