	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function audio_setup
_audio_setup:                           ## @audio_setup
	.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
	cmpl	$0, 16(%rdi)
	je	LBB0_1
## %bb.2:
	movq	%rdi, %r14
	movl	8(%rdi), %edi
	leaq	-48(%rbp), %rcx
	xorl	%esi, %esi
	xorl	%edx, %edx
	callq	_get_audio_regs
	testl	%eax, %eax
	je	LBB0_4
## %bb.3:
	movl	%eax, %ebx
	movl	4(%r14), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	callq	_device_printf
	jmp	LBB0_10
LBB0_1:
	movq	_ENOTSUP@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_10
LBB0_4:
	movl	12(%r14), %edi
	leaq	-52(%rbp), %rsi
	callq	_clk_get_freq
	testl	%eax, %eax
	je	LBB0_7
## %bb.5:
	movl	%eax, %ebx
	movl	4(%r14), %edi
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_6
LBB0_7:
	movl	8(%r14), %edi
	movl	-52(%rbp), %esi
	leaq	-60(%rbp), %rdx
	leaq	-44(%rbp), %rcx
	leaq	-56(%rbp), %r8
	callq	_get_hda_cts_n
	testl	%eax, %eax
	je	LBB0_9
## %bb.8:
	movl	%eax, %ebx
	movl	4(%r14), %edi
	leaq	L_.str.2(%rip), %rsi
LBB0_6:
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_device_printf
LBB0_10:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	movq	%r14, %rdi
	callq	_audio_setup_infoframe
	movq	_HDMI_NV_PDISP_SOR_AUDIO_CNTRL0@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movl	(%r14), %edi
	callq	_SOR_AUDIO_CNTRL0_SOURCE_SELECT
	movq	_SOR_AUDIO_CNTRL0_INJECT_NULLSMPL@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movq	%r14, %rdi
	movl	%ebx, %esi
	movl	%eax, %edx
	callq	_WR4
	movq	_HDMI_NV_PDISP_SOR_AUDIO_SPARE0@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	%r14, %rdi
	callq	_RD4
	movq	_SOR_AUDIO_SPARE0_HBR_ENABLE@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	(%rbx), %esi
	movq	%r14, %rdi
	movl	%eax, %edx
	callq	_WR4
	movq	_HDMI_NV_PDISP_HDMI_ACR_CTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%ebx, %ebx
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_WR4
	movq	_HDMI_NV_PDISP_AUDIO_N@GOTPCREL(%rip), %r13
	movl	(%r13), %r15d
	movq	_AUDIO_N_RESETF@GOTPCREL(%rip), %rcx
	movq	_AUDIO_N_GENERATE_ALTERNATE@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	orl	(%rcx), %r12d
	movl	-44(%rbp), %edi
	decl	%edi
	callq	_AUDIO_N_VALUE
	orl	%eax, %r12d
	movq	%r14, %rdi
	movl	%r15d, %esi
	movl	%r12d, %edx
	callq	_WR4
	movq	_HDMI_NV_PDISP_HDMI_ACR_0441_SUBPACK_HIGH@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	movl	-44(%rbp), %edi
	callq	_ACR_SUBPACK_N
	movq	_ACR_ENABLE@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movq	%r14, %rdi
	movl	%r15d, %esi
	movl	%eax, %edx
	callq	_WR4
	movq	_HDMI_NV_PDISP_HDMI_ACR_0441_SUBPACK_LOW@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	movl	-60(%rbp), %edi
	callq	_ACR_SUBPACK_CTS
	movq	%r14, %rdi
	movl	%r15d, %esi
	movl	%eax, %edx
	callq	_WR4
	movq	_HDMI_NV_PDISP_HDMI_SPARE@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	movq	_SPARE_HW_CTS@GOTPCREL(%rip), %rax
	movq	_SPARE_FORCE_SW_CTS@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r12d
	orl	(%rax), %r12d
	movl	$1, %edi
	callq	_SPARE_CTS_RESET_VAL
	orl	%eax, %r12d
	movq	%r14, %rdi
	movl	%r15d, %esi
	movl	%r12d, %edx
	callq	_WR4
	movl	(%r13), %esi
	movq	%r14, %rdi
	callq	_RD4
	movq	_AUDIO_N_RESETF@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	notl	%edx
	andl	%eax, %edx
	movl	(%r13), %esi
	movq	%r14, %rdi
	callq	_WR4
	movl	-48(%rbp), %esi
	movl	-56(%rbp), %edx
	movq	%r14, %rdi
	callq	_WR4
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
	.comm	_ENOTSUP,4,2                    ## @ENOTSUP
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Unsupported audio frequency.\n"

L_.str.1:                               ## @.str.1
	.asciz	"Cannot get hdmi frequency: %d\n"

L_.str.2:                               ## @.str.2
	.asciz	"Cannot compute audio coefs: %d\n"

	.comm	_HDMI_NV_PDISP_SOR_AUDIO_CNTRL0,4,2 ## @HDMI_NV_PDISP_SOR_AUDIO_CNTRL0
	.comm	_SOR_AUDIO_CNTRL0_INJECT_NULLSMPL,4,2 ## @SOR_AUDIO_CNTRL0_INJECT_NULLSMPL
	.comm	_HDMI_NV_PDISP_SOR_AUDIO_SPARE0,4,2 ## @HDMI_NV_PDISP_SOR_AUDIO_SPARE0
	.comm	_SOR_AUDIO_SPARE0_HBR_ENABLE,4,2 ## @SOR_AUDIO_SPARE0_HBR_ENABLE
	.comm	_HDMI_NV_PDISP_HDMI_ACR_CTRL,4,2 ## @HDMI_NV_PDISP_HDMI_ACR_CTRL
	.comm	_HDMI_NV_PDISP_AUDIO_N,4,2      ## @HDMI_NV_PDISP_AUDIO_N
	.comm	_AUDIO_N_RESETF,4,2             ## @AUDIO_N_RESETF
	.comm	_AUDIO_N_GENERATE_ALTERNATE,4,2 ## @AUDIO_N_GENERATE_ALTERNATE
	.comm	_HDMI_NV_PDISP_HDMI_ACR_0441_SUBPACK_HIGH,4,2 ## @HDMI_NV_PDISP_HDMI_ACR_0441_SUBPACK_HIGH
	.comm	_ACR_ENABLE,4,2                 ## @ACR_ENABLE
	.comm	_HDMI_NV_PDISP_HDMI_ACR_0441_SUBPACK_LOW,4,2 ## @HDMI_NV_PDISP_HDMI_ACR_0441_SUBPACK_LOW
	.comm	_HDMI_NV_PDISP_HDMI_SPARE,4,2   ## @HDMI_NV_PDISP_HDMI_SPARE
	.comm	_SPARE_HW_CTS,4,2               ## @SPARE_HW_CTS
	.comm	_SPARE_FORCE_SW_CTS,4,2         ## @SPARE_FORCE_SW_CTS
	.no_dead_strip	_audio_setup
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function audio_setup
_audio_setup:                           ; @audio_setup
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	ldr	w8, [x0, #16]
	cbz	w8, LBB0_3
; %bb.1:
	mov	x19, x0
	ldr	w0, [x0, #8]
	add	x3, sp, #12
	mov	x1, #0
	mov	x2, #0
	bl	_get_audio_regs
	cbz	w0, LBB0_4
; %bb.2:
	mov	x20, x0
	ldr	w0, [x19, #4]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_device_printf
	b	LBB0_9
LBB0_3:
Lloh2:
	adrp	x8, _ENOTSUP@GOTPAGE
Lloh3:
	ldr	x8, [x8, _ENOTSUP@GOTPAGEOFF]
Lloh4:
	ldr	w20, [x8]
	b	LBB0_9
LBB0_4:
	ldr	w0, [x19, #12]
	add	x1, sp, #16
	bl	_clk_get_freq
	cbz	w0, LBB0_6
; %bb.5:
	mov	x20, x0
	ldr	w0, [x19, #4]
	str	x20, [sp]
Lloh5:
	adrp	x1, l_.str.1@PAGE
Lloh6:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_device_printf
	b	LBB0_9
LBB0_6:
	ldr	w0, [x19, #8]
	ldr	w1, [sp, #16]
	add	x2, sp, #24
	add	x3, sp, #28
	add	x4, sp, #20
	bl	_get_hda_cts_n
	cbz	w0, LBB0_8
; %bb.7:
	mov	x20, x0
	ldr	w0, [x19, #4]
	str	x20, [sp]
Lloh7:
	adrp	x1, l_.str.2@PAGE
Lloh8:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_device_printf
                                        ; kill: def $w20 killed $w20 killed $x20 def $x20
	b	LBB0_9
LBB0_8:
	mov	x0, x19
	bl	_audio_setup_infoframe
Lloh9:
	adrp	x8, _HDMI_NV_PDISP_SOR_AUDIO_CNTRL0@GOTPAGE
Lloh10:
	ldr	x8, [x8, _HDMI_NV_PDISP_SOR_AUDIO_CNTRL0@GOTPAGEOFF]
Lloh11:
	ldr	w20, [x8]
	ldr	w0, [x19]
	bl	_SOR_AUDIO_CNTRL0_SOURCE_SELECT
Lloh12:
	adrp	x8, _SOR_AUDIO_CNTRL0_INJECT_NULLSMPL@GOTPAGE
Lloh13:
	ldr	x8, [x8, _SOR_AUDIO_CNTRL0_INJECT_NULLSMPL@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	orr	w2, w8, w0
	mov	x0, x19
	mov	x1, x20
	bl	_WR4
Lloh15:
	adrp	x20, _HDMI_NV_PDISP_SOR_AUDIO_SPARE0@GOTPAGE
Lloh16:
	ldr	x20, [x20, _HDMI_NV_PDISP_SOR_AUDIO_SPARE0@GOTPAGEOFF]
	ldr	w1, [x20]
	mov	x0, x19
	bl	_RD4
Lloh17:
	adrp	x8, _SOR_AUDIO_SPARE0_HBR_ENABLE@GOTPAGE
Lloh18:
	ldr	x8, [x8, _SOR_AUDIO_SPARE0_HBR_ENABLE@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	orr	w2, w8, w0
	ldr	w1, [x20]
	mov	x0, x19
	bl	_WR4
Lloh20:
	adrp	x8, _HDMI_NV_PDISP_HDMI_ACR_CTRL@GOTPAGE
Lloh21:
	ldr	x8, [x8, _HDMI_NV_PDISP_HDMI_ACR_CTRL@GOTPAGEOFF]
Lloh22:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_WR4
Lloh23:
	adrp	x21, _HDMI_NV_PDISP_AUDIO_N@GOTPAGE
Lloh24:
	ldr	x21, [x21, _HDMI_NV_PDISP_AUDIO_N@GOTPAGEOFF]
	ldr	w20, [x21]
Lloh25:
	adrp	x22, _AUDIO_N_RESETF@GOTPAGE
Lloh26:
	ldr	x22, [x22, _AUDIO_N_RESETF@GOTPAGEOFF]
	ldr	w8, [x22]
Lloh27:
	adrp	x9, _AUDIO_N_GENERATE_ALTERNATE@GOTPAGE
Lloh28:
	ldr	x9, [x9, _AUDIO_N_GENERATE_ALTERNATE@GOTPAGEOFF]
Lloh29:
	ldr	w9, [x9]
	orr	w23, w9, w8
	ldr	w8, [sp, #28]
	sub	w0, w8, #1
	bl	_AUDIO_N_VALUE
	orr	w2, w23, w0
	mov	x0, x19
	mov	x1, x20
	bl	_WR4
Lloh30:
	adrp	x8, _HDMI_NV_PDISP_HDMI_ACR_0441_SUBPACK_HIGH@GOTPAGE
Lloh31:
	ldr	x8, [x8, _HDMI_NV_PDISP_HDMI_ACR_0441_SUBPACK_HIGH@GOTPAGEOFF]
Lloh32:
	ldr	w20, [x8]
	ldr	w0, [sp, #28]
	bl	_ACR_SUBPACK_N
Lloh33:
	adrp	x8, _ACR_ENABLE@GOTPAGE
Lloh34:
	ldr	x8, [x8, _ACR_ENABLE@GOTPAGEOFF]
Lloh35:
	ldr	w8, [x8]
	orr	w2, w8, w0
	mov	x0, x19
	mov	x1, x20
	bl	_WR4
Lloh36:
	adrp	x8, _HDMI_NV_PDISP_HDMI_ACR_0441_SUBPACK_LOW@GOTPAGE
Lloh37:
	ldr	x8, [x8, _HDMI_NV_PDISP_HDMI_ACR_0441_SUBPACK_LOW@GOTPAGEOFF]
Lloh38:
	ldr	w20, [x8]
	ldr	w0, [sp, #24]
	bl	_ACR_SUBPACK_CTS
	mov	x2, x0
	mov	x0, x19
	mov	x1, x20
	bl	_WR4
Lloh39:
	adrp	x8, _HDMI_NV_PDISP_HDMI_SPARE@GOTPAGE
Lloh40:
	ldr	x8, [x8, _HDMI_NV_PDISP_HDMI_SPARE@GOTPAGEOFF]
Lloh41:
	adrp	x9, _SPARE_HW_CTS@GOTPAGE
Lloh42:
	ldr	x9, [x9, _SPARE_HW_CTS@GOTPAGEOFF]
Lloh43:
	ldr	w20, [x8]
Lloh44:
	ldr	w8, [x9]
Lloh45:
	adrp	x9, _SPARE_FORCE_SW_CTS@GOTPAGE
Lloh46:
	ldr	x9, [x9, _SPARE_FORCE_SW_CTS@GOTPAGEOFF]
Lloh47:
	ldr	w9, [x9]
	orr	w23, w9, w8
	mov	w0, #1
	bl	_SPARE_CTS_RESET_VAL
	orr	w2, w23, w0
	mov	x0, x19
	mov	x1, x20
	bl	_WR4
	ldr	w1, [x21]
	mov	x0, x19
	bl	_RD4
	ldr	w8, [x22]
	bic	w2, w0, w8
	ldr	w1, [x21]
	mov	x0, x19
	bl	_WR4
	ldr	w1, [sp, #12]
	ldr	w2, [sp, #20]
	mov	x0, x19
	bl	_WR4
	mov	w20, #0
LBB0_9:
	mov	x0, x20
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh45, Lloh46, Lloh47
	.loh AdrpLdrGotLdr	Lloh41, Lloh42, Lloh44
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh43
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_ENOTSUP,4,2                    ; @ENOTSUP
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Unsupported audio frequency.\n"

l_.str.1:                               ; @.str.1
	.asciz	"Cannot get hdmi frequency: %d\n"

l_.str.2:                               ; @.str.2
	.asciz	"Cannot compute audio coefs: %d\n"

	.comm	_HDMI_NV_PDISP_SOR_AUDIO_CNTRL0,4,2 ; @HDMI_NV_PDISP_SOR_AUDIO_CNTRL0
	.comm	_SOR_AUDIO_CNTRL0_INJECT_NULLSMPL,4,2 ; @SOR_AUDIO_CNTRL0_INJECT_NULLSMPL
	.comm	_HDMI_NV_PDISP_SOR_AUDIO_SPARE0,4,2 ; @HDMI_NV_PDISP_SOR_AUDIO_SPARE0
	.comm	_SOR_AUDIO_SPARE0_HBR_ENABLE,4,2 ; @SOR_AUDIO_SPARE0_HBR_ENABLE
	.comm	_HDMI_NV_PDISP_HDMI_ACR_CTRL,4,2 ; @HDMI_NV_PDISP_HDMI_ACR_CTRL
	.comm	_HDMI_NV_PDISP_AUDIO_N,4,2      ; @HDMI_NV_PDISP_AUDIO_N
	.comm	_AUDIO_N_RESETF,4,2             ; @AUDIO_N_RESETF
	.comm	_AUDIO_N_GENERATE_ALTERNATE,4,2 ; @AUDIO_N_GENERATE_ALTERNATE
	.comm	_HDMI_NV_PDISP_HDMI_ACR_0441_SUBPACK_HIGH,4,2 ; @HDMI_NV_PDISP_HDMI_ACR_0441_SUBPACK_HIGH
	.comm	_ACR_ENABLE,4,2                 ; @ACR_ENABLE
	.comm	_HDMI_NV_PDISP_HDMI_ACR_0441_SUBPACK_LOW,4,2 ; @HDMI_NV_PDISP_HDMI_ACR_0441_SUBPACK_LOW
	.comm	_HDMI_NV_PDISP_HDMI_SPARE,4,2   ; @HDMI_NV_PDISP_HDMI_SPARE
	.comm	_SPARE_HW_CTS,4,2               ; @SPARE_HW_CTS
	.comm	_SPARE_FORCE_SW_CTS,4,2         ; @SPARE_FORCE_SW_CTS
	.no_dead_strip	_audio_setup
.subsections_via_symbols
