	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function dmae_set_dmars
_dmae_set_dmars:                        ## @dmae_set_dmars
	.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
	movl	%esi, %r14d
	movq	%rdi, %rbx
	callq	_dmae_is_idle
	testl	%eax, %eax
	jne	LBB0_12
## %bb.1:
	movl	(%rbx), %eax
	movq	_DMARS_CHAN_MSK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ebx
	andl	%eax, %ebx
	je	LBB0_3
## %bb.2:
	movq	_DMARS_SHIFT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ebx
LBB0_3:
	cmpl	$5, %eax
	ja	LBB0_9
## %bb.4:
	movl	$3, %ecx
	btl	%eax, %ecx
	jb	LBB0_10
## %bb.5:
	movl	$12, %ecx
	btl	%eax, %ecx
	jae	LBB0_8
## %bb.6:
	movq	_SH_DMARS_BASE@GOTPCREL(%rip), %rax
	movq	_DMARS1_ADDR@GOTPCREL(%rip), %rcx
	jmp	LBB0_7
LBB0_10:
	movq	_SH_DMARS_BASE@GOTPCREL(%rip), %rax
	movq	(%rax), %r15
	jmp	LBB0_11
LBB0_8:
	movq	_SH_DMARS_BASE@GOTPCREL(%rip), %rax
	movq	_DMARS2_ADDR@GOTPCREL(%rip), %rcx
LBB0_7:
	movq	(%rcx), %r15
	addq	(%rax), %r15
LBB0_11:
	movl	%ebx, %ecx
	shll	%cl, %r14d
	movq	%r15, %rdi
	callq	_ctrl_inw
	testl	%ebx, %ebx
	movl	$255, %ecx
	movl	$65280, %edi                    ## imm = 0xFF00
	cmovel	%ecx, %edi
	andl	%eax, %edi
	orl	%r14d, %edi
	movq	%r15, %rsi
	callq	_ctrl_outw
	xorl	%eax, %eax
LBB0_12:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	_DMARS_CHAN_MSK,4,2             ## @DMARS_CHAN_MSK
	.comm	_DMARS_SHIFT,4,2                ## @DMARS_SHIFT
	.comm	_SH_DMARS_BASE,8,3              ## @SH_DMARS_BASE
	.comm	_DMARS1_ADDR,8,3                ## @DMARS1_ADDR
	.comm	_DMARS2_ADDR,8,3                ## @DMARS2_ADDR
	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_dmae_set_dmars
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function dmae_set_dmars
_dmae_set_dmars:                        ; @dmae_set_dmars
	.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, x1
	mov	x20, x0
	bl	_dmae_is_idle
	cbnz	w0, LBB0_9
; %bb.1:
	ldr	w8, [x20]
Lloh0:
	adrp	x9, _DMARS_CHAN_MSK@GOTPAGE
Lloh1:
	ldr	x9, [x9, _DMARS_CHAN_MSK@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
Lloh3:
	adrp	x10, _DMARS_SHIFT@GOTPAGE
Lloh4:
	ldr	x10, [x10, _DMARS_SHIFT@GOTPAGEOFF]
Lloh5:
	ldr	w10, [x10]
	tst	w9, w8
	csel	w21, wzr, w10, eq
	cmp	w8, #5
	b.hi	LBB0_10
; %bb.2:
	mov	w9, #1
	lsl	w8, w9, w8
	tst	w8, #0x3
	b.ne	LBB0_5
; %bb.3:
	tst	w8, #0xc
	b.eq	LBB0_6
; %bb.4:
Lloh6:
	adrp	x8, _SH_DMARS_BASE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _SH_DMARS_BASE@GOTPAGEOFF]
Lloh8:
	ldr	x8, [x8]
Lloh9:
	adrp	x9, _DMARS1_ADDR@GOTPAGE
Lloh10:
	ldr	x9, [x9, _DMARS1_ADDR@GOTPAGEOFF]
	b	LBB0_7
LBB0_5:
Lloh11:
	adrp	x8, _SH_DMARS_BASE@GOTPAGE
Lloh12:
	ldr	x8, [x8, _SH_DMARS_BASE@GOTPAGEOFF]
Lloh13:
	ldr	x20, [x8]
	b	LBB0_8
LBB0_6:
Lloh14:
	adrp	x8, _SH_DMARS_BASE@GOTPAGE
Lloh15:
	ldr	x8, [x8, _SH_DMARS_BASE@GOTPAGEOFF]
Lloh16:
	ldr	x8, [x8]
Lloh17:
	adrp	x9, _DMARS2_ADDR@GOTPAGE
Lloh18:
	ldr	x9, [x9, _DMARS2_ADDR@GOTPAGEOFF]
LBB0_7:
	ldr	x9, [x9]
	add	x20, x9, x8
LBB0_8:
	lsl	w19, w19, w21
	mov	x0, x20
	bl	_ctrl_inw
	mov	w8, #65280
	mov	w9, #255
	cmp	w21, #0
	csel	w8, w9, w8, eq
	and	w8, w0, w8
	orr	w0, w8, w19
	mov	x1, x20
	bl	_ctrl_outw
	mov	w0, #0
LBB0_9:
	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_10:
Lloh19:
	adrp	x8, _EINVAL@GOTPAGE
Lloh20:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_9
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_DMARS_CHAN_MSK,4,2             ; @DMARS_CHAN_MSK
	.comm	_DMARS_SHIFT,4,2                ; @DMARS_SHIFT
	.comm	_SH_DMARS_BASE,8,3              ; @SH_DMARS_BASE
	.comm	_DMARS1_ADDR,8,3                ; @DMARS1_ADDR
	.comm	_DMARS2_ADDR,8,3                ; @DMARS2_ADDR
	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_dmae_set_dmars
.subsections_via_symbols
