	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ad1848_prepare_for_input
_ad1848_prepare_for_input:              ## @ad1848_prepare_for_input
	.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
	movq	_audio_devs@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movslq	%edi, %rcx
	movq	(%rax,%rcx,8), %rax
	movq	8(%rax), %r15
	cmpq	$0, 32(%r15)
	jne	LBB0_41
## %bb.1:
	movl	%edi, %r14d
	movq	(%rax), %r13
	leaq	24(%r15), %rdi
	movq	%rdi, -64(%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	%r15, %rdi
	callq	_ad_enter_MCE
	movq	(%r15), %rax
	movq	_MD_1845@GOTPCREL(%rip), %rdx
	movq	_MD_1845_SSCAPE@GOTPCREL(%rip), %rcx
	cmpq	(%rdx), %rax
	je	LBB0_3
## %bb.2:
	cmpq	(%rcx), %rax
	jne	LBB0_4
LBB0_3:
	andb	$-16, %r12b
	movzbl	13(%r13), %edx
	movq	%r15, %rdi
	movl	$22, %esi
	callq	_ad_write
	movzbl	12(%r13), %edx
	movq	%r15, %rdi
	movl	$23, %esi
	callq	_ad_write
	movq	(%r15), %rax
LBB0_4:
	movq	_MD_4232@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_6
## %bb.5:
	movq	%r15, %rdi
	movl	$16, %esi
	callq	_ad_read
	movl	%eax, %ebx
	orb	$48, %al
	movzbl	%al, %edx
	movq	%r15, %rdi
	movl	$16, %esi
	callq	_ad_write
	andb	$-49, %bl
	movl	%ebx, -48(%rbp)                 ## 4-byte Spill
	movq	(%r15), %rax
	jmp	LBB0_7
LBB0_6:
	movl	$0, -48(%rbp)                   ## 4-byte Folded Spill
LBB0_7:
	movq	_MD_IWAVE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_9
## %bb.8:
	movq	%r15, %rdi
	movl	$17, %esi
	movl	$194, %edx
	callq	_ad_write
	movq	(%r15), %rax
LBB0_9:
	movq	_MD_1848@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_16
## %bb.10:
	movq	%r15, %rdi
	movl	$8, %esi
	callq	_ad_read
	movl	%eax, %r13d
	movzbl	%r12b, %edx
	movq	%r15, %rdi
	movl	$8, %esi
	callq	_ad_write
	movl	$99, %ebx
	.p2align	4, 0x90
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	movl	28(%r15), %edi
	callq	_inb
	subl	$1, %ebx
	setb	%cl
	cmpl	$128, %eax
	je	LBB0_13
## %bb.12:                              ##   in Loop: Header=BB0_11 Depth=1
	testb	%cl, %cl
	je	LBB0_11
LBB0_13:
	movl	$9999, %ebx                     ## imm = 0x270F
	.p2align	4, 0x90
LBB0_14:                                ## =>This Inner Loop Header: Depth=1
	movl	28(%r15), %edi
	callq	_inb
	subl	$1, %ebx
	setb	%cl
	cmpl	$128, %eax
	jne	LBB0_34
## %bb.15:                              ##   in Loop: Header=BB0_14 Depth=1
	testb	%cl, %cl
	je	LBB0_14
	jmp	LBB0_34
LBB0_16:
	movq	%r15, %rdi
	movl	$28, %esi
	callq	_ad_read
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	%r12d, -52(%rbp)                ## 4-byte Spill
	movzbl	%r12b, %edx
	movq	%r15, %rdi
	movl	$28, %esi
	callq	_ad_write
	movl	$99, %r12d
	.p2align	4, 0x90
LBB0_17:                                ## =>This Inner Loop Header: Depth=1
	movl	28(%r15), %edi
	callq	_inb
	subl	$1, %r12d
	setb	%cl
	cmpl	$128, %eax
	je	LBB0_19
## %bb.18:                              ##   in Loop: Header=BB0_17 Depth=1
	testb	%cl, %cl
	je	LBB0_17
LBB0_19:
	movl	$9999, %ebx                     ## imm = 0x270F
	.p2align	4, 0x90
LBB0_20:                                ## =>This Inner Loop Header: Depth=1
	movl	28(%r15), %edi
	callq	_inb
	subl	$1, %ebx
	setb	%cl
	cmpl	$128, %eax
	jne	LBB0_22
## %bb.21:                              ##   in Loop: Header=BB0_20 Depth=1
	testb	%cl, %cl
	je	LBB0_20
LBB0_22:
	movq	(%r15), %rax
	movq	_MD_1848@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	movl	-52(%rbp), %r12d                ## 4-byte Reload
	je	LBB0_33
## %bb.23:
	movq	_MD_1845@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_33
## %bb.24:
	movq	_MD_1845_SSCAPE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_33
## %bb.25:
	movzbl	(%r13), %r13d
	movq	%r15, %rdi
	movl	$8, %esi
	callq	_ad_read
	andl	$240, %eax
	orl	%eax, %r13d
	movq	%r15, %rdi
	movl	$8, %esi
	movl	%r13d, %edx
	callq	_ad_write
	movl	$99, %ebx
	.p2align	4, 0x90
LBB0_26:                                ## =>This Inner Loop Header: Depth=1
	movl	28(%r15), %edi
	callq	_inb
	subl	$1, %ebx
	setb	%cl
	cmpl	$128, %eax
	je	LBB0_28
## %bb.27:                              ##   in Loop: Header=BB0_26 Depth=1
	testb	%cl, %cl
	je	LBB0_26
LBB0_28:
	movl	$9999, %ebx                     ## imm = 0x270F
	movl	-44(%rbp), %r13d                ## 4-byte Reload
	.p2align	4, 0x90
LBB0_29:                                ## =>This Inner Loop Header: Depth=1
	movl	28(%r15), %edi
	callq	_inb
	subl	$1, %ebx
	setb	%cl
	cmpl	$128, %eax
	jne	LBB0_34
## %bb.30:                              ##   in Loop: Header=BB0_29 Depth=1
	testb	%cl, %cl
	je	LBB0_29
	jmp	LBB0_34
LBB0_33:
	movl	-44(%rbp), %r13d                ## 4-byte Reload
LBB0_34:
	movq	(%r15), %rax
	movq	_MD_4232@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_36
## %bb.35:
	movzbl	-48(%rbp), %edx                 ## 1-byte Folded Reload
	movq	%r15, %rdi
	movl	$16, %esi
	callq	_ad_write
LBB0_36:
	movq	%r15, %rdi
	callq	_ad_leave_MCE
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_spin_unlock_irqrestore
	movq	$0, 16(%r15)
	movq	_timer_installed@GOTPCREL(%rip), %rax
	cmpl	%r14d, (%rax)
	jne	LBB0_40
## %bb.37:
	cmpq	$0, 8(%r15)
	je	LBB0_40
## %bb.38:
	andb	$1, %r12b
	movzbl	%r12b, %eax
	andl	$1, %r13d
	cmpl	%eax, %r13d
	je	LBB0_40
## %bb.39:
	movl	%r14d, %edi
	callq	_ad1848_tmr_reprogram
LBB0_40:
	movl	%r14d, %edi
	callq	_ad1848_halt_input
LBB0_41:
	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_IWAVE,8,3                   ## @MD_IWAVE
	.comm	_MD_1848,8,3                    ## @MD_1848
	.comm	_timer_installed,4,2            ## @timer_installed
	.no_dead_strip	_ad1848_prepare_for_input
.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_input
_ad1848_prepare_for_input:              ; @ad1848_prepare_for_input
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
Lloh0:
	adrp	x8, _audio_devs@GOTPAGE
Lloh1:
	ldr	x8, [x8, _audio_devs@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	ldr	x8, [x8, w0, sxtw #3]
	ldr	x20, [x8, #8]
	ldr	x9, [x20, #32]
	cbnz	x9, LBB0_29
; %bb.1:
	mov	x19, x0
	ldr	x26, [x8]
	add	x21, x20, #24
	mov	x0, x21
	bl	_spin_lock_irqsave
	ldp	w8, w9, [x26]
	orr	w8, w8, w9, lsl #5
	ldr	w9, [x26, #8]
	orr	w10, w8, #0x10
	cmp	w9, #1
	csel	w23, 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	x28, _MD_1845_SSCAPE@GOTPAGE
Lloh7:
	ldr	x28, [x28, _MD_1845_SSCAPE@GOTPAGEOFF]
	ldr	x10, [x28]
	cmp	x8, x9
	ccmp	x8, x10, #4, ne
	b.ne	LBB0_3
; %bb.2:
	and	w23, w23, #0xfffffff0
	ldrb	w2, [x26, #13]
	mov	x0, x20
	mov	w1, #22
	bl	_ad_write
	ldrb	w2, [x26, #12]
	mov	x0, x20
	mov	w1, #23
	bl	_ad_write
	ldr	x8, [x20]
LBB0_3:
Lloh8:
	adrp	x25, _MD_4232@GOTPAGE
Lloh9:
	ldr	x25, [x25, _MD_4232@GOTPAGEOFF]
	ldr	x9, [x25]
	cmp	x8, x9
	b.ne	LBB0_5
; %bb.4:
	mov	x0, x20
	mov	w1, #16
	bl	_ad_read
	mov	x22, x0
	orr	w8, w0, #0x30
	and	w2, w8, #0xff
	mov	x0, x20
	mov	w1, #16
	bl	_ad_write
	and	w8, w22, #0xffffffcf
	str	w8, [sp, #12]                   ; 4-byte Folded Spill
	ldr	x8, [x20]
	b	LBB0_6
LBB0_5:
	str	wzr, [sp, #12]                  ; 4-byte Folded Spill
LBB0_6:
Lloh10:
	adrp	x9, _MD_IWAVE@GOTPAGE
Lloh11:
	ldr	x9, [x9, _MD_IWAVE@GOTPAGEOFF]
Lloh12:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_8
; %bb.7:
	mov	x0, x20
	mov	w1, #17
	mov	w2, #194
	bl	_ad_write
	ldr	x8, [x20]
LBB0_8:
Lloh13:
	adrp	x24, _MD_1848@GOTPAGE
Lloh14:
	ldr	x24, [x24, _MD_1848@GOTPAGEOFF]
	ldr	x9, [x24]
	mov	x0, x20
	cmp	x8, x9
	b.ne	LBB0_13
; %bb.9:
	mov	w1, #8
	bl	_ad_read
	mov	x27, x0
	and	w2, w23, #0xff
	mov	x0, x20
	mov	w1, #8
	bl	_ad_write
	mov	w22, #99
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x20, #28]
	bl	_inb
	cmp	w0, #128
	ccmp	w22, #0, #4, ne
	sub	w22, w22, #1
	b.ne	LBB0_10
; %bb.11:
	mov	w22, #9999
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x20, #28]
	bl	_inb
	cmp	w0, #128
	ccmp	w22, #0, #4, eq
	sub	w22, w22, #1
	b.ne	LBB0_12
	b	LBB0_22
LBB0_13:
	mov	w1, #28
	bl	_ad_read
	mov	x27, x0
	and	w2, w23, #0xff
	mov	x0, x20
	mov	w1, #28
	bl	_ad_write
	mov	w22, #99
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x20, #28]
	bl	_inb
	cmp	w0, #128
	ccmp	w22, #0, #4, ne
	sub	w22, w22, #1
	b.ne	LBB0_14
; %bb.15:
	mov	w22, #9999
LBB0_16:                                ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x20, #28]
	bl	_inb
	cmp	w0, #128
	ccmp	w22, #0, #4, eq
	sub	w22, w22, #1
	b.ne	LBB0_16
; %bb.17:
	ldr	x8, [x20]
	ldr	x9, [x24]
Lloh15:
	adrp	x10, _MD_1845@GOTPAGE
Lloh16:
	ldr	x10, [x10, _MD_1845@GOTPAGEOFF]
Lloh17:
	ldr	x10, [x10]
	ldr	x11, [x28]
	cmp	x8, x9
	ccmp	x8, x10, #4, ne
	ccmp	x8, x11, #4, ne
	b.eq	LBB0_22
; %bb.18:
	ldrb	w22, [x26]
	mov	x0, x20
	mov	w1, #8
	bl	_ad_read
	and	w8, w0, #0xf0
	orr	w2, w8, w22
	mov	x0, x20
	mov	w1, #8
	bl	_ad_write
	mov	w22, #99
LBB0_19:                                ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x20, #28]
	bl	_inb
	cmp	w0, #128
	ccmp	w22, #0, #4, ne
	sub	w22, w22, #1
	b.ne	LBB0_19
; %bb.20:
	mov	w22, #9999
LBB0_21:                                ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x20, #28]
	bl	_inb
	cmp	w0, #128
	ccmp	w22, #0, #4, eq
	sub	w22, w22, #1
	b.ne	LBB0_21
LBB0_22:
	ldr	x8, [x20]
	ldr	x9, [x25]
	cmp	x8, x9
	b.ne	LBB0_24
; %bb.23:
	ldr	w8, [sp, #12]                   ; 4-byte Folded Reload
	and	w2, w8, #0xff
	mov	x0, x20
	mov	w1, #16
	bl	_ad_write
LBB0_24:
	mov	x0, x20
	bl	_ad_leave_MCE
	mov	x0, x21
	bl	_spin_unlock_irqrestore
	str	xzr, [x20, #16]
Lloh18:
	adrp	x8, _timer_installed@GOTPAGE
Lloh19:
	ldr	x8, [x8, _timer_installed@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	cmp	w8, w19
	b.ne	LBB0_28
; %bb.25:
	ldr	x8, [x20, #8]
	cbz	x8, LBB0_28
; %bb.26:
	and	w8, w23, #0x1
	and	w9, w27, #0x1
	cmp	w9, w8
	b.eq	LBB0_28
; %bb.27:
	mov	x0, x19
	bl	_ad1848_tmr_reprogram
LBB0_28:
	mov	x0, x19
	bl	_ad1848_halt_input
LBB0_29:
	mov	w0, #0
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.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_IWAVE,8,3                   ; @MD_IWAVE
	.comm	_MD_1848,8,3                    ; @MD_1848
	.comm	_timer_installed,4,2            ; @timer_installed
	.no_dead_strip	_ad1848_prepare_for_input
.subsections_via_symbols
