	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function snd_ali_playback_prepare
_snd_ali_playback_prepare:              ## @snd_ali_playback_prepare
	.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	%rdi, %r13
	callq	_snd_pcm_substream_chip
	movq	%rax, %rbx
	movq	(%r13), %r12
	movq	16(%r12), %r14
	movq	16(%r14), %r15
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_snd_ali_printk
	movq	%rbx, %rdi
	callq	_spin_lock_irq
	movl	12(%r12), %edi
	xorl	%esi, %esi
	callq	_snd_ali_convert_rate
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	(%r14), %rsi
	movq	_ALI_SPDIF_IN_CHANNEL@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rsi
	movq	%r15, -64(%rbp)                 ## 8-byte Spill
	je	LBB0_2
## %bb.1:
	movq	_ALI_PCM_IN_CHANNEL@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rsi
	je	LBB0_2
## %bb.3:
	cmpq	$0, 8(%rbx)
	je	LBB0_7
## %bb.4:
	movq	_ALI_GLOBAL_CONTROL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_ALI_REG
	movl	%eax, %edi
	callq	_inl
	movq	_ALI_SPDIF_OUT_CH_ENABLE@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_7
## %bb.5:
	movq	(%r14), %rax
	movq	_ALI_SPDIF_OUT_CHANNEL@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_7
## %bb.6:
	movl	12(%r12), %esi
	movq	%rbx, %rdi
	callq	_snd_ali_set_spdif_out_rate
	movl	$4096, -44(%rbp)                ## 4-byte Folded Spill
                                        ## imm = 0x1000
	jmp	LBB0_7
LBB0_2:
	movq	%rbx, %rdi
	callq	_snd_ali_disable_special_channel
LBB0_7:
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movl	(%r12), %r15d
	movl	4(%r12), %edx
	movl	%edx, 8(%r14)
	movl	8(%r12), %esi
	movl	%esi, 12(%r14)
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_snd_ali_printk
	movl	12(%r14), %ebx
	decl	%ebx
	movq	%r13, %rdi
	callq	_snd_ali_control_mode
	movl	%eax, %r13d
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_snd_ali_printk
	movq	(%r14), %rsi
	movl	12(%r12), %edx
	subq	$8, %rsp
	leaq	L_.str.3(%rip), %rdi
	movl	-44(%rbp), %r12d                ## 4-byte Reload
	movl	%r12d, %ecx
	movl	$1, %r8d
	xorl	%r9d, %r9d
	xorl	%eax, %eax
	pushq	%r13
	callq	_snd_ali_printk
	addq	$16, %rsp
	movq	(%r14), %rsi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%r15d, -48(%rbp)                ## 4-byte Spill
	movl	%r15d, %edx
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	xorl	%ecx, %ecx
	movl	%ebx, %r8d
	movl	%r12d, %r9d
	pushq	$0
	pushq	%r13
	pushq	$0
	pushq	$0
	pushq	$1
	pushq	$0
	callq	_snd_ali_write_voice_regs
	addq	$48, %rsp
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	testq	%rdx, %rdx
	je	LBB0_9
## %bb.8:
	movl	8(%r14), %eax
	movl	%eax, 8(%rdx)
	movl	8(%r14), %eax
	leal	(%rax,%rax), %ecx
	movl	%ecx, 12(%rdx)
	leal	-1(%rax,%rax), %r8d
	movq	(%rdx), %rsi
	movq	%r15, %rdi
	movl	-48(%rbp), %edx                 ## 4-byte Reload
	xorl	%ecx, %ecx
	movl	%r12d, %r9d
	pushq	$0
	pushq	%r13
	pushq	$1023                           ## imm = 0x3FF
	pushq	$127
	pushq	$1
	pushq	$0
	callq	_snd_ali_write_voice_regs
	addq	$48, %rsp
LBB0_9:
	movq	%r15, %rdi
	callq	_spin_unlock_irq
	xorl	%eax, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"playback_prepare ...\n"

	.comm	_ALI_SPDIF_IN_CHANNEL,8,3       ## @ALI_SPDIF_IN_CHANNEL
	.comm	_ALI_PCM_IN_CHANNEL,8,3         ## @ALI_PCM_IN_CHANNEL
	.comm	_ALI_GLOBAL_CONTROL,4,2         ## @ALI_GLOBAL_CONTROL
	.comm	_ALI_SPDIF_OUT_CH_ENABLE,4,2    ## @ALI_SPDIF_OUT_CH_ENABLE
	.comm	_ALI_SPDIF_OUT_CHANNEL,8,3      ## @ALI_SPDIF_OUT_CHANNEL
L_.str.1:                               ## @.str.1
	.asciz	"playback_prepare: eso=%xh count=%xh\n"

L_.str.2:                               ## @.str.2
	.asciz	"playback_prepare:\n"

L_.str.3:                               ## @.str.3
	.asciz	"ch=%d, Rate=%d Delta=%xh,GVSEL=%xh,PAN=%xh,CTRL=%xh\n"

	.no_dead_strip	_snd_ali_playback_prepare
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function snd_ali_playback_prepare
_snd_ali_playback_prepare:              ; @snd_ali_playback_prepare
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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	x21, x0
	bl	_snd_pcm_substream_chip
	mov	x19, x0
	ldr	x26, [x21]
	ldr	x25, [x26, #16]
	ldr	x24, [x25, #16]
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_snd_ali_printk
	mov	x0, x19
	bl	_spin_lock_irq
	ldr	w0, [x26, #12]
	mov	w1, #0
	bl	_snd_ali_convert_rate
	mov	x20, x0
	ldr	x1, [x25]
Lloh2:
	adrp	x8, _ALI_SPDIF_IN_CHANNEL@GOTPAGE
Lloh3:
	ldr	x8, [x8, _ALI_SPDIF_IN_CHANNEL@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
Lloh5:
	adrp	x9, _ALI_PCM_IN_CHANNEL@GOTPAGE
Lloh6:
	ldr	x9, [x9, _ALI_PCM_IN_CHANNEL@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x9]
	cmp	x1, x8
	ccmp	x1, x9, #4, ne
	b.ne	LBB0_2
; %bb.1:
	mov	x0, x19
	bl	_snd_ali_disable_special_channel
	b	LBB0_6
LBB0_2:
	ldr	x8, [x19, #8]
	cbz	x8, LBB0_6
; %bb.3:
Lloh8:
	adrp	x8, _ALI_GLOBAL_CONTROL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ALI_GLOBAL_CONTROL@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_ALI_REG
	bl	_inl
Lloh11:
	adrp	x8, _ALI_SPDIF_OUT_CH_ENABLE@GOTPAGE
Lloh12:
	ldr	x8, [x8, _ALI_SPDIF_OUT_CH_ENABLE@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	tst	w8, w0
	b.eq	LBB0_6
; %bb.4:
	ldr	x8, [x25]
Lloh14:
	adrp	x9, _ALI_SPDIF_OUT_CHANNEL@GOTPAGE
Lloh15:
	ldr	x9, [x9, _ALI_SPDIF_OUT_CHANNEL@GOTPAGEOFF]
Lloh16:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_6
; %bb.5:
	ldr	w1, [x26, #12]
	mov	x0, x19
	bl	_snd_ali_set_spdif_out_rate
	mov	w20, #4096
LBB0_6:
	ldp	w22, w8, [x26]
	ldr	w9, [x26, #8]
	stp	w8, w9, [x25, #8]
	stp	x9, x8, [sp]
Lloh17:
	adrp	x0, l_.str.1@PAGE
Lloh18:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_snd_ali_printk
	ldr	w8, [x25, #12]
	sub	w23, w8, #1
	mov	x0, x21
	bl	_snd_ali_control_mode
	mov	x21, x0
Lloh19:
	adrp	x0, l_.str.2@PAGE
Lloh20:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_snd_ali_printk
	ldr	x8, [x25]
	ldr	w9, [x26, #12]
	stp	xzr, x21, [sp, #32]
	mov	w10, #1
	stp	x20, x10, [sp, #16]
	stp	x8, x9, [sp]
Lloh21:
	adrp	x0, l_.str.3@PAGE
Lloh22:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_snd_ali_printk
	ldr	x1, [x25]
	stp	w21, wzr, [sp, #8]
	str	xzr, [sp]
	mov	x0, x19
	mov	x2, x22
	mov	w3, #0
	mov	x4, x23
	mov	x5, x20
	mov	w6, #0
	mov	w7, #1
	bl	_snd_ali_write_voice_regs
	cbz	x24, LBB0_8
; %bb.7:
	ldr	w8, [x25, #8]
	str	w8, [x24, #8]
	ldr	w8, [x25, #8]
	lsl	w8, w8, #1
	str	w8, [x24, #12]
	sub	w4, w8, #1
	ldr	x1, [x24]
	stp	w21, wzr, [sp, #8]
	mov	x8, #127
	movk	x8, #1023, lsl #32
	str	x8, [sp]
	mov	x0, x19
	mov	x2, x22
	mov	w3, #0
	mov	x5, x20
	mov	w6, #0
	mov	w7, #1
	bl	_snd_ali_write_voice_regs
LBB0_8:
	mov	x0, x19
	bl	_spin_unlock_irq
	mov	w0, #0
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"playback_prepare ...\n"

	.comm	_ALI_SPDIF_IN_CHANNEL,8,3       ; @ALI_SPDIF_IN_CHANNEL
	.comm	_ALI_PCM_IN_CHANNEL,8,3         ; @ALI_PCM_IN_CHANNEL
	.comm	_ALI_GLOBAL_CONTROL,4,2         ; @ALI_GLOBAL_CONTROL
	.comm	_ALI_SPDIF_OUT_CH_ENABLE,4,2    ; @ALI_SPDIF_OUT_CH_ENABLE
	.comm	_ALI_SPDIF_OUT_CHANNEL,8,3      ; @ALI_SPDIF_OUT_CHANNEL
l_.str.1:                               ; @.str.1
	.asciz	"playback_prepare: eso=%xh count=%xh\n"

l_.str.2:                               ; @.str.2
	.asciz	"playback_prepare:\n"

l_.str.3:                               ; @.str.3
	.asciz	"ch=%d, Rate=%d Delta=%xh,GVSEL=%xh,PAN=%xh,CTRL=%xh\n"

	.no_dead_strip	_snd_ali_playback_prepare
.subsections_via_symbols
