	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function set_dac_rate
_set_dac_rate:                          ## @set_dac_rate
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r15d
	movq	%rdi, %rbx
	cmpq	$0, 8(%rdi)
	je	LBB0_2
## %bb.1:
	movl	$96000, %eax                    ## imm = 0x17700
	xorl	%edx, %edx
	divl	%r15d
	movl	%eax, %ecx
	incl	%ecx
	shrl	%ecx
	movl	%ecx, 28(%rbx)
	movw	$-17536, %ax                    ## imm = 0xBB80
	xorl	%edx, %edx
	divw	%cx
	movzwl	%ax, %eax
	movl	%eax, 32(%rbx)
	jmp	LBB0_6
LBB0_2:
	movl	$1, 28(%rbx)
	movl	(%rbx), %edi
	movq	_AC97_EXTENDED_STATUS@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	callq	_rdcodec
	cmpl	$48000, %r15d                   ## imm = 0xBB80
	movl	$48000, %r14d                   ## imm = 0xBB80
	cmovbl	%r15d, %r14d
	movl	(%rbx), %edi
	movl	(%r12), %esi
	movq	_AC97_EXTSTAT_VRA@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	%eax, %edx
	callq	_wrcodec
	movl	(%rbx), %edi
	movq	_AC97_PCM_FRONT_DAC_RATE@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movl	%r14d, %edx
	callq	_wrcodec
	cmpl	$3, 36(%rbx)
	jl	LBB0_5
## %bb.3:
	movl	(%rbx), %edi
	movq	_AC97_PCM_SURR_DAC_RATE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r14d, %edx
	callq	_wrcodec
	cmpl	$5, 36(%rbx)
	jl	LBB0_5
## %bb.4:
	movl	(%rbx), %edi
	movq	_AC97_PCM_LFE_DAC_RATE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r14d, %edx
	callq	_wrcodec
LBB0_5:
	movl	(%rbx), %edi
	movl	(%r15), %esi
	callq	_rdcodec
	movq	%rax, %r14
	leaq	L_.str(%rip), %rdi
	movl	%r14d, %esi
	callq	_pr_debug
	movl	(%rbx), %edi
	movq	_AC97_PCM_LR_ADC_RATE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_rdcodec
	movl	%r14d, 32(%rbx)
	movl	%eax, 20(%rbx)
LBB0_6:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AC97_EXTENDED_STATUS,4,2       ## @AC97_EXTENDED_STATUS
	.comm	_AC97_EXTSTAT_VRA,4,2           ## @AC97_EXTSTAT_VRA
	.comm	_AC97_PCM_FRONT_DAC_RATE,4,2    ## @AC97_PCM_FRONT_DAC_RATE
	.comm	_AC97_PCM_SURR_DAC_RATE,4,2     ## @AC97_PCM_SURR_DAC_RATE
	.comm	_AC97_PCM_LFE_DAC_RATE,4,2      ## @AC97_PCM_LFE_DAC_RATE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"set_dac_rate: set to %d Hz\n"

	.comm	_AC97_PCM_LR_ADC_RATE,4,2       ## @AC97_PCM_LR_ADC_RATE
	.no_dead_strip	_set_dac_rate
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function set_dac_rate
_set_dac_rate:                          ; @set_dac_rate
	.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	x20, x1
	mov	x19, x0
	ldr	x8, [x0, #8]
	cbz	x8, LBB0_2
; %bb.1:
	mov	w8, #30464
	movk	w8, #1, lsl #16
	udiv	w8, w8, w20
	add	w8, w8, #1
	lsr	w9, w8, #1
	ubfx	w8, w8, #1, #16
	mov	w10, #48000
	udiv	w8, w10, w8
	stp	w9, w8, [x19, #28]
	b	LBB0_6
LBB0_2:
	mov	w8, #1
	str	w8, [x19, #28]
	ldr	w0, [x19]
Lloh0:
	adrp	x21, _AC97_EXTENDED_STATUS@GOTPAGE
Lloh1:
	ldr	x21, [x21, _AC97_EXTENDED_STATUS@GOTPAGEOFF]
	ldr	w1, [x21]
	bl	_rdcodec
	mov	w8, #48000
	cmp	w20, w8
	csel	w20, w20, w8, lo
	ldr	w8, [x19]
	ldr	w1, [x21]
Lloh2:
	adrp	x9, _AC97_EXTSTAT_VRA@GOTPAGE
Lloh3:
	ldr	x9, [x9, _AC97_EXTSTAT_VRA@GOTPAGEOFF]
Lloh4:
	ldr	w9, [x9]
	orr	w2, w9, w0
	mov	x0, x8
	bl	_wrcodec
	ldr	w0, [x19]
Lloh5:
	adrp	x21, _AC97_PCM_FRONT_DAC_RATE@GOTPAGE
Lloh6:
	ldr	x21, [x21, _AC97_PCM_FRONT_DAC_RATE@GOTPAGEOFF]
	ldr	w1, [x21]
	mov	x2, x20
	bl	_wrcodec
	ldr	w8, [x19, #36]
	cmp	w8, #3
	b.lt	LBB0_5
; %bb.3:
	ldr	w0, [x19]
Lloh7:
	adrp	x8, _AC97_PCM_SURR_DAC_RATE@GOTPAGE
Lloh8:
	ldr	x8, [x8, _AC97_PCM_SURR_DAC_RATE@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	mov	x2, x20
	bl	_wrcodec
	ldr	w8, [x19, #36]
	cmp	w8, #5
	b.lt	LBB0_5
; %bb.4:
	ldr	w0, [x19]
Lloh10:
	adrp	x8, _AC97_PCM_LFE_DAC_RATE@GOTPAGE
Lloh11:
	ldr	x8, [x8, _AC97_PCM_LFE_DAC_RATE@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
	mov	x2, x20
	bl	_wrcodec
LBB0_5:
	ldr	w0, [x19]
	ldr	w1, [x21]
	bl	_rdcodec
	mov	x20, x0
Lloh13:
	adrp	x0, l_.str@PAGE
Lloh14:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x20
	bl	_pr_debug
	ldr	w0, [x19]
Lloh15:
	adrp	x8, _AC97_PCM_LR_ADC_RATE@GOTPAGE
Lloh16:
	ldr	x8, [x8, _AC97_PCM_LR_ADC_RATE@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
	bl	_rdcodec
	str	w20, [x19, #32]
	str	w0, [x19, #20]
LBB0_6:
	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
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_AC97_EXTENDED_STATUS,4,2       ; @AC97_EXTENDED_STATUS
	.comm	_AC97_EXTSTAT_VRA,4,2           ; @AC97_EXTSTAT_VRA
	.comm	_AC97_PCM_FRONT_DAC_RATE,4,2    ; @AC97_PCM_FRONT_DAC_RATE
	.comm	_AC97_PCM_SURR_DAC_RATE,4,2     ; @AC97_PCM_SURR_DAC_RATE
	.comm	_AC97_PCM_LFE_DAC_RATE,4,2      ; @AC97_PCM_LFE_DAC_RATE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"set_dac_rate: set to %d Hz\n"

	.comm	_AC97_PCM_LR_ADC_RATE,4,2       ; @AC97_PCM_LR_ADC_RATE
	.no_dead_strip	_set_dac_rate
.subsections_via_symbols
