	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ad1848_prepare_for_output
_ad1848_prepare_for_output:             ## @ad1848_prepare_for_output
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edi, %ebx
	movq	_audio_devs@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movslq	%edi, %rcx
	movq	(%rax,%rcx,8), %rax
	movq	(%rax), %r13
	movq	8(%rax), %r14
	movq	%r14, %rdi
	callq	_ad_mute
	leaq	24(%r14), %rdi
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	callq	_spin_lock_irqsave
	movl	4(%r13), %eax
	shll	$5, %eax
	orl	(%r13), %eax
	movl	%eax, %ecx
	orb	$16, %cl
	cmpl	$2, 8(%r13)
	movzbl	%cl, %r12d
	cmovll	%eax, %r12d
	movq	%r14, %rdi
	callq	_ad_enter_MCE
	movq	(%r14), %rax
	movq	_MD_1845@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_2
## %bb.1:
	movq	_MD_1845_SSCAPE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_3
LBB0_2:
	andb	$-16, %r12b
	movzbl	13(%r13), %edx
	movq	%r14, %rdi
	movl	$22, %esi
	callq	_ad_write
	movzbl	12(%r13), %edx
	movq	%r14, %rdi
	movl	$23, %esi
	callq	_ad_write
LBB0_3:
	movq	%r14, %rdi
	movl	$8, %esi
	callq	_ad_read
	movq	(%r14), %rdx
	movq	_MD_4232@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rdx
	movb	%al, -41(%rbp)                  ## 1-byte Spill
	je	LBB0_6
## %bb.4:
	movq	_MD_4236@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rdx
	jge	LBB0_6
## %bb.5:
	xorl	%r13d, %r13d
	jmp	LBB0_7
LBB0_6:
	movq	%r14, %rdi
	movl	$16, %esi
	callq	_ad_read
	movl	%eax, %r13d
	orb	$48, %al
	movzbl	%al, %edx
	movq	%r14, %rdi
	movl	$16, %esi
	callq	_ad_write
	andb	$-49, %r13b
	movq	(%r14), %rdx
LBB0_7:
	movq	_MD_IWAVE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rdx
	jne	LBB0_9
## %bb.8:
	movq	%r14, %rdi
	movl	$17, %esi
	movl	$194, %edx
	callq	_ad_write
LBB0_9:
	movl	%ebx, -48(%rbp)                 ## 4-byte Spill
	movzbl	%r12b, %edx
	movq	%r14, %rdi
	movl	$8, %esi
	callq	_ad_write
	movl	$99, %r15d
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movl	28(%r14), %edi
	callq	_inb
	subl	$1, %r15d
	setb	%cl
	cmpl	$128, %eax
	je	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=1
	testb	%cl, %cl
	je	LBB0_10
LBB0_12:
	movl	$9999, %ebx                     ## imm = 0x270F
	.p2align	4, 0x90
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	movl	28(%r14), %edi
	callq	_inb
	subl	$1, %ebx
	setb	%cl
	cmpl	$128, %eax
	jne	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_13 Depth=1
	testb	%cl, %cl
	je	LBB0_13
LBB0_15:
	movq	(%r14), %rax
	movq	_MD_4232@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jl	LBB0_17
## %bb.16:
	movzbl	%r13b, %edx
	movq	%r14, %rdi
	movl	$16, %esi
	callq	_ad_write
LBB0_17:
	movq	%r14, %rdi
	callq	_ad_leave_MCE
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_spin_unlock_irqrestore
	movq	$0, 16(%r14)
	movq	_timer_installed@GOTPCREL(%rip), %rax
	movl	-48(%rbp), %ebx                 ## 4-byte Reload
	cmpl	%ebx, (%rax)
	jne	LBB0_21
## %bb.18:
	cmpq	$0, 8(%r14)
	je	LBB0_21
## %bb.19:
	movb	-41(%rbp), %al                  ## 1-byte Reload
	xorb	%r12b, %al
	testb	$1, %al
	je	LBB0_21
## %bb.20:
	movl	%ebx, %edi
	callq	_ad1848_tmr_reprogram
LBB0_21:
	movl	%ebx, %edi
	callq	_ad1848_halt_output
	xorl	%eax, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_audio_devs,8,3                 ## @audio_devs
	.comm	_MD_1845,8,3                    ## @MD_1845
	.comm	_MD_1845_SSCAPE,8,3             ## @MD_1845_SSCAPE
	.comm	_MD_4232,8,3                    ## @MD_4232
	.comm	_MD_4236,8,3                    ## @MD_4236
	.comm	_MD_IWAVE,8,3                   ## @MD_IWAVE
	.comm	_timer_installed,4,2            ## @timer_installed
	.no_dead_strip	_ad1848_prepare_for_output
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ad1848_prepare_for_output
_ad1848_prepare_for_output:             ; @ad1848_prepare_for_output
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x19, x0
Lloh0:
	adrp	x8, _audio_devs@GOTPAGE
Lloh1:
	ldr	x8, [x8, _audio_devs@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	ldr	x8, [x8, w0, sxtw #3]
	ldp	x22, x20, [x8]
	mov	x0, x20
	bl	_ad_mute
	add	x21, x20, #24
	mov	x0, x21
	bl	_spin_lock_irqsave
	ldp	w8, w9, [x22]
	orr	w8, w8, w9, lsl #5
	ldr	w9, [x22, #8]
	orr	w10, w8, #0x10
	cmp	w9, #1
	csel	w24, w10, w8, gt
	mov	x0, x20
	bl	_ad_enter_MCE
	ldr	x8, [x20]
Lloh3:
	adrp	x9, _MD_1845@GOTPAGE
Lloh4:
	ldr	x9, [x9, _MD_1845@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
Lloh6:
	adrp	x10, _MD_1845_SSCAPE@GOTPAGE
Lloh7:
	ldr	x10, [x10, _MD_1845_SSCAPE@GOTPAGEOFF]
Lloh8:
	ldr	x10, [x10]
	cmp	x8, x9
	ccmp	x8, x10, #4, ne
	b.ne	LBB0_2
; %bb.1:
	and	w24, w24, #0xfffffff0
	ldrb	w2, [x22, #13]
	mov	x0, x20
	mov	w1, #22
	bl	_ad_write
	ldrb	w2, [x22, #12]
	mov	x0, x20
	mov	w1, #23
	bl	_ad_write
LBB0_2:
	mov	x0, x20
	mov	w1, #8
	bl	_ad_read
	mov	x22, x0
	ldr	x8, [x20]
Lloh9:
	adrp	x25, _MD_4232@GOTPAGE
Lloh10:
	ldr	x25, [x25, _MD_4232@GOTPAGEOFF]
	ldr	x9, [x25]
Lloh11:
	adrp	x10, _MD_4236@GOTPAGE
Lloh12:
	ldr	x10, [x10, _MD_4236@GOTPAGEOFF]
Lloh13:
	ldr	x10, [x10]
	cmp	x8, x9
	ccmp	x8, x10, #0, ne
	b.lt	LBB0_4
; %bb.3:
	mov	x0, x20
	mov	w1, #16
	bl	_ad_read
	mov	x23, x0
	orr	w2, w0, #0x30
	mov	x0, x20
	mov	w1, #16
	bl	_ad_write
	and	w23, w23, #0xffffffcf
	ldr	x8, [x20]
	b	LBB0_5
LBB0_4:
	mov	w23, #0
LBB0_5:
Lloh14:
	adrp	x9, _MD_IWAVE@GOTPAGE
Lloh15:
	ldr	x9, [x9, _MD_IWAVE@GOTPAGEOFF]
Lloh16:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_7
; %bb.6:
	mov	x0, x20
	mov	w1, #17
	mov	w2, #194
	bl	_ad_write
LBB0_7:
	and	w2, w24, #0xff
	mov	x0, x20
	mov	w1, #8
	bl	_ad_write
	mov	w26, #99
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x20, #28]
	bl	_inb
	cmp	w0, #128
	ccmp	w26, #0, #4, ne
	sub	w26, w26, #1
	b.ne	LBB0_8
; %bb.9:
	mov	w26, #9999
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x20, #28]
	bl	_inb
	cmp	w0, #128
	ccmp	w26, #0, #4, eq
	sub	w26, w26, #1
	b.ne	LBB0_10
; %bb.11:
	ldr	x8, [x20]
	ldr	x9, [x25]
	cmp	x8, x9
	b.lt	LBB0_13
; %bb.12:
	and	w2, w23, #0xff
	mov	x0, x20
	mov	w1, #16
	bl	_ad_write
LBB0_13:
	mov	x0, x20
	bl	_ad_leave_MCE
	mov	x0, x21
	bl	_spin_unlock_irqrestore
	str	xzr, [x20, #16]
Lloh17:
	adrp	x8, _timer_installed@GOTPAGE
Lloh18:
	ldr	x8, [x8, _timer_installed@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	cmp	w8, w19
	b.ne	LBB0_17
; %bb.14:
	ldr	x8, [x20, #8]
	cbz	x8, LBB0_17
; %bb.15:
	eor	w8, w22, w24
	tbz	w8, #0, LBB0_17
; %bb.16:
	mov	x0, x19
	bl	_ad1848_tmr_reprogram
LBB0_17:
	mov	x0, x19
	bl	_ad1848_halt_output
	mov	w0, #0
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_audio_devs,8,3                 ; @audio_devs
	.comm	_MD_1845,8,3                    ; @MD_1845
	.comm	_MD_1845_SSCAPE,8,3             ; @MD_1845_SSCAPE
	.comm	_MD_4232,8,3                    ; @MD_4232
	.comm	_MD_4236,8,3                    ; @MD_4236
	.comm	_MD_IWAVE,8,3                   ; @MD_IWAVE
	.comm	_timer_installed,4,2            ; @timer_installed
	.no_dead_strip	_ad1848_prepare_for_output
.subsections_via_symbols
