	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function snd_via8233_playback_prepare
_snd_via8233_playback_prepare:          ## @snd_via8233_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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	callq	_snd_pcm_substream_chip
	movq	%rax, %r15
	movq	(%rbx), %r13
	movl	$48000, %esi                    ## imm = 0xBB80
	cmpq	$0, 40(%rax)
	jne	LBB0_2
## %bb.1:
	movl	(%r13), %esi
LBB0_2:
	movq	24(%r13), %r14
	movq	32(%r15), %rdi
	callq	_via_lock_rate
	testl	%eax, %eax
	js	LBB0_3
## %bb.4:
	je	LBB0_8
## %bb.5:
	movl	8(%r15), %edi
	movq	_AC97_PCM_FRONT_DAC_RATE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$48000, %edx                    ## imm = 0xBB80
	cmpq	$0, 24(%r15)
	jne	LBB0_7
## %bb.6:
	movl	(%r13), %edx
LBB0_7:
	callq	_snd_ac97_set_rate
LBB0_8:
	cmpq	$0, 16(%r15)
	je	LBB0_11
## %bb.9:
	cmpl	$48, (%r14)
	jne	LBB0_11
## %bb.10:
	movl	8(%r15), %edi
	movq	_AC97_SPDIF@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%r13), %edx
	callq	_snd_ac97_set_rate
LBB0_11:
	movl	(%r13), %eax
	movl	$1048575, %ebx                  ## imm = 0xFFFFF
	cmpl	$48000, %eax                    ## imm = 0xBB80
	je	LBB0_13
## %bb.12:
	leal	(%rax,%rax,4), %ecx
	leal	(%rax,%rcx,4), %ecx
	imull	$40576, %eax, %eax              ## imm = 0x9E80
	cltq
	imulq	$91625969, %rax, %rbx           ## imm = 0x57619F1
	movq	%rbx, %rax
	shrq	$63, %rax
	sarq	$42, %rbx
	addl	%eax, %ebx
	addl	%ecx, %ebx
LBB0_13:
	movl	%ebx, %edi
	andl	$-1048576, %edi                 ## imm = 0xFFF00000
	callq	_snd_BUG_ON
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_snd_via82xx_channel_reset
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_snd_via82xx_set_table_ptr
	movq	(%r15), %rax
	movl	(%r14), %ecx
	leal	15(%rcx), %edx
	testl	%ecx, %ecx
	cmovnsl	%ecx, %edx
	sarl	$4, %edx
	movslq	%edx, %rcx
	movq	(%rax,%rcx,8), %rax
	movl	(%rax), %r12d
	movq	_OFS_PLAYBACK_VOLUME_L@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_VIADEV_REG
	movl	%r12d, %edi
	movl	%eax, %esi
	callq	_outb
	movq	(%r15), %rax
	movl	(%r14), %ecx
	leal	15(%rcx), %edx
	testl	%ecx, %ecx
	cmovnsl	%ecx, %edx
	sarl	$4, %edx
	movslq	%edx, %rcx
	movq	(%rax,%rcx,8), %rax
	movl	4(%rax), %r12d
	movq	_OFS_PLAYBACK_VOLUME_R@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_VIADEV_REG
	movl	%r12d, %edi
	movl	%eax, %esi
	callq	_outb
	movq	8(%r13), %rcx
	movq	_SNDRV_PCM_FORMAT_S16_LE@GOTPCREL(%rip), %rdx
	xorl	%r12d, %r12d
	movl	$0, %eax
	cmpq	(%rdx), %rcx
	jne	LBB0_15
## %bb.14:
	movq	_VIA8233_REG_TYPE_16BIT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_15:
	cmpl	$2, 16(%r13)
	movl	$0, %ecx
	jl	LBB0_17
## %bb.16:
	movq	_VIA8233_REG_TYPE_STEREO@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
LBB0_17:
	orl	%eax, %ebx
	orl	%ecx, %ebx
	orl	$-16777216, %ebx                ## imm = 0xFF000000
	movq	_OFFSET_STOP_IDX@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_VIADEV_REG
	movl	%ebx, %edi
	movl	%eax, %esi
	callq	_outl
	movl	$20, %edi
	callq	_udelay
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	_snd_via82xx_codec_ready
	jmp	LBB0_18
LBB0_3:
	movl	%eax, %r12d
LBB0_18:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AC97_PCM_FRONT_DAC_RATE,4,2    ## @AC97_PCM_FRONT_DAC_RATE
	.comm	_AC97_SPDIF,4,2                 ## @AC97_SPDIF
	.comm	_OFS_PLAYBACK_VOLUME_L,4,2      ## @OFS_PLAYBACK_VOLUME_L
	.comm	_OFS_PLAYBACK_VOLUME_R,4,2      ## @OFS_PLAYBACK_VOLUME_R
	.comm	_SNDRV_PCM_FORMAT_S16_LE,8,3    ## @SNDRV_PCM_FORMAT_S16_LE
	.comm	_VIA8233_REG_TYPE_16BIT,4,2     ## @VIA8233_REG_TYPE_16BIT
	.comm	_VIA8233_REG_TYPE_STEREO,4,2    ## @VIA8233_REG_TYPE_STEREO
	.comm	_OFFSET_STOP_IDX,4,2            ## @OFFSET_STOP_IDX
	.no_dead_strip	_snd_via8233_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_via8233_playback_prepare
_snd_via8233_playback_prepare:          ; @snd_via8233_playback_prepare
	.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	x20, x0
	bl	_snd_pcm_substream_chip
	mov	x19, x0
	ldr	x22, [x20]
	ldr	x8, [x0, #40]
	cbz	x8, LBB0_2
; %bb.1:
	mov	w1, #48000
	b	LBB0_3
LBB0_2:
	ldr	w1, [x22]
LBB0_3:
	ldr	x20, [x22, #24]
	ldr	x0, [x19, #32]
	bl	_via_lock_rate
	tbnz	w0, #31, LBB0_16
; %bb.4:
	cbz	w0, LBB0_9
; %bb.5:
	ldr	w0, [x19, #8]
Lloh0:
	adrp	x8, _AC97_PCM_FRONT_DAC_RATE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _AC97_PCM_FRONT_DAC_RATE@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	ldr	x8, [x19, #24]
	cbz	x8, LBB0_7
; %bb.6:
	mov	w2, #48000
	b	LBB0_8
LBB0_7:
	ldr	w2, [x22]
LBB0_8:
	bl	_snd_ac97_set_rate
LBB0_9:
	ldr	x8, [x19, #16]
	cbz	x8, LBB0_12
; %bb.10:
	ldr	w8, [x20]
	cmp	w8, #48
	b.ne	LBB0_12
; %bb.11:
	ldr	w0, [x19, #8]
Lloh3:
	adrp	x8, _AC97_SPDIF@GOTPAGE
Lloh4:
	ldr	x8, [x8, _AC97_SPDIF@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	ldr	w2, [x22]
	bl	_snd_ac97_set_rate
LBB0_12:
	ldr	w8, [x22]
	mov	w9, #48000
	cmp	w8, w9
	b.ne	LBB0_14
; %bb.13:
	mov	w23, #1048575
	b	LBB0_15
LBB0_14:
	mov	w9, #21
	mov	w10, #40576
	mul	w10, w8, w10
	mov	w11, #6641
	movk	w11, #1398, lsl #16
	smull	x10, w10, w11
	lsr	x11, x10, #63
	asr	x10, x10, #42
	add	w10, w10, w11
	madd	w23, w8, w9, w10
LBB0_15:
	and	w0, w23, #0xfff00000
	bl	_snd_BUG_ON
	mov	x0, x19
	mov	x1, x20
	bl	_snd_via82xx_channel_reset
	mov	x0, x19
	mov	x1, x20
	bl	_snd_via82xx_set_table_ptr
	ldr	x8, [x19]
	ldr	w9, [x20]
	add	w10, w9, #15
	cmp	w9, #0
	csel	w9, w10, w9, lt
	asr	w9, w9, #4
	ldr	x8, [x8, w9, sxtw #3]
	ldr	w21, [x8]
Lloh6:
	adrp	x8, _OFS_PLAYBACK_VOLUME_L@GOTPAGE
Lloh7:
	ldr	x8, [x8, _OFS_PLAYBACK_VOLUME_L@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_VIADEV_REG
	mov	x1, x0
	mov	x0, x21
	bl	_outb
	ldr	x8, [x19]
	ldr	w9, [x20]
	add	w10, w9, #15
	cmp	w9, #0
	csel	w9, w10, w9, lt
	asr	w9, w9, #4
	ldr	x8, [x8, w9, sxtw #3]
	ldr	w21, [x8, #4]
Lloh9:
	adrp	x8, _OFS_PLAYBACK_VOLUME_R@GOTPAGE
Lloh10:
	ldr	x8, [x8, _OFS_PLAYBACK_VOLUME_R@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_VIADEV_REG
	mov	x1, x0
	mov	x0, x21
	bl	_outb
	ldr	x8, [x22, #8]
Lloh12:
	adrp	x9, _SNDRV_PCM_FORMAT_S16_LE@GOTPAGE
Lloh13:
	ldr	x9, [x9, _SNDRV_PCM_FORMAT_S16_LE@GOTPAGEOFF]
Lloh14:
	ldr	x9, [x9]
Lloh15:
	adrp	x10, _VIA8233_REG_TYPE_16BIT@GOTPAGE
Lloh16:
	ldr	x10, [x10, _VIA8233_REG_TYPE_16BIT@GOTPAGEOFF]
Lloh17:
	ldr	w10, [x10]
	cmp	x8, x9
	csel	w8, w10, wzr, eq
	ldr	w9, [x22, #16]
Lloh18:
	adrp	x10, _VIA8233_REG_TYPE_STEREO@GOTPAGE
Lloh19:
	ldr	x10, [x10, _VIA8233_REG_TYPE_STEREO@GOTPAGEOFF]
Lloh20:
	ldr	w10, [x10]
	cmp	w9, #1
	csel	w9, w10, wzr, gt
	orr	w8, w23, w8
	orr	w8, w8, w9
	orr	w21, w8, #0xff000000
Lloh21:
	adrp	x8, _OFFSET_STOP_IDX@GOTPAGE
Lloh22:
	ldr	x8, [x8, _OFFSET_STOP_IDX@GOTPAGEOFF]
Lloh23:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_VIADEV_REG
	mov	x1, x0
	mov	x0, x21
	bl	_outl
	mov	w0, #20
	bl	_udelay
	mov	x0, x19
	mov	w1, #0
	bl	_snd_via82xx_codec_ready
	mov	w0, #0
LBB0_16:
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_AC97_PCM_FRONT_DAC_RATE,4,2    ; @AC97_PCM_FRONT_DAC_RATE
	.comm	_AC97_SPDIF,4,2                 ; @AC97_SPDIF
	.comm	_OFS_PLAYBACK_VOLUME_L,4,2      ; @OFS_PLAYBACK_VOLUME_L
	.comm	_OFS_PLAYBACK_VOLUME_R,4,2      ; @OFS_PLAYBACK_VOLUME_R
	.comm	_SNDRV_PCM_FORMAT_S16_LE,8,3    ; @SNDRV_PCM_FORMAT_S16_LE
	.comm	_VIA8233_REG_TYPE_16BIT,4,2     ; @VIA8233_REG_TYPE_16BIT
	.comm	_VIA8233_REG_TYPE_STEREO,4,2    ; @VIA8233_REG_TYPE_STEREO
	.comm	_OFFSET_STOP_IDX,4,2            ; @OFFSET_STOP_IDX
	.no_dead_strip	_snd_via8233_playback_prepare
.subsections_via_symbols
