	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tvaudio_s_ctrl
_tvaudio_s_ctrl:                        ## @tvaudio_s_ctrl
	.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
	movq	%rsi, %rbx
	callq	_to_state
	movq	%rax, %r14
	movl	(%rbx), %eax
	addl	$-128, %eax
	cmpl	$4, %eax
	ja	LBB0_14
## %bb.1:
	movq	32(%r14), %r12
	leaq	LJTI0_0(%rip), %rcx
	movslq	(%rcx,%rax,4), %rax
	addq	%rcx, %rax
	jmpq	*%rax
LBB0_2:
	movq	_CHIP_HAS_VOLUME@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r12)
	je	LBB0_14
## %bb.3:
	movl	16(%r14), %edi
	movl	20(%r14), %esi
	callq	_max
	testl	%eax, %eax
	je	LBB0_18
## %bb.4:
	movl	%eax, %r15d
	movl	16(%r14), %edi
	movl	20(%r14), %esi
	callq	_min
	shll	$15, %eax
	cltd
	idivl	%r15d
	movl	%eax, %r15d
	jmp	LBB0_19
LBB0_5:
	movq	_CHIP_HAS_BASSTREBLE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r12)
	je	LBB0_14
## %bb.6:
	movl	4(%rbx), %edi
	movl	%edi, 28(%r14)
	movl	16(%r12), %ebx
	callq	*8(%r12)
	jmp	LBB0_21
LBB0_7:
	movq	_CHIP_HAS_INPUTSEL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r12)
	je	LBB0_14
## %bb.8:
	movl	4(%rbx), %eax
	cmpl	$2, %eax
	jb	LBB0_16
## %bb.9:
	movq	_ERANGE@GOTPCREL(%rip), %rcx
	jmp	LBB0_15
LBB0_10:
	movq	_CHIP_HAS_BASSTREBLE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r12)
	je	LBB0_14
## %bb.11:
	movl	4(%rbx), %edi
	movl	%edi, 24(%r14)
	movl	32(%r12), %ebx
	callq	*24(%r12)
	jmp	LBB0_21
LBB0_12:
	movq	_CHIP_HAS_VOLUME@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r12)
	je	LBB0_14
## %bb.13:
	movl	16(%r14), %edi
	movl	20(%r14), %esi
	callq	_max
	jmp	LBB0_20
LBB0_14:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
LBB0_15:
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_23
LBB0_16:
	movl	%eax, (%r14)
	movl	72(%r12), %esi
	testl	%eax, %eax
	je	LBB0_24
## %bb.17:
	movl	56(%r12), %ecx
	movl	76(%r12), %edx
	jmp	LBB0_25
LBB0_18:
	movl	$32768, %r15d                   ## imm = 0x8000
LBB0_19:
	movl	4(%rbx), %ebx
	movl	$65536, %edi                    ## imm = 0x10000
	subl	%r15d, %edi
	movl	$32768, %esi                    ## imm = 0x8000
	callq	_min
                                        ## kill: def $eax killed $eax def $rax
	imull	%ebx, %eax
	leal	32767(%rax), %ecx
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	sarl	$15, %ecx
	movl	%ecx, 16(%r14)
	shll	$15, %ebx
	movl	%r15d, %edi
	movl	%ebx, %esi
	callq	_min
                                        ## kill: def $eax killed $eax def $rax
	leal	32767(%rax), %ecx
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	sarl	$15, %ecx
	movl	%ecx, 20(%r14)
LBB0_20:
	movl	52(%r12), %ebx
	movl	16(%r14), %edi
	callq	*40(%r12)
	movq	%r14, %rdi
	movl	%ebx, %esi
	movl	%eax, %edx
	callq	_chip_write
	movl	48(%r12), %ebx
	movl	20(%r14), %edi
	callq	*40(%r12)
LBB0_21:
	movq	%r14, %rdi
	movl	%ebx, %esi
	movl	%eax, %edx
	callq	_chip_write
LBB0_22:
	xorl	%eax, %eax
LBB0_23:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_24:
	movq	64(%r12), %rax
	movq	8(%r14), %rcx
	movl	(%rax,%rcx,4), %edx
	movl	56(%r12), %ecx
LBB0_25:
	movq	%r14, %rdi
	callq	_chip_write_masked
	jmp	LBB0_22
	.cfi_endproc
	.p2align	2, 0x90
	.data_region jt32
.set L0_0_set_2, LBB0_2-LJTI0_0
.set L0_0_set_5, LBB0_5-LJTI0_0
.set L0_0_set_7, LBB0_7-LJTI0_0
.set L0_0_set_10, LBB0_10-LJTI0_0
.set L0_0_set_12, LBB0_12-LJTI0_0
LJTI0_0:
	.long	L0_0_set_2
	.long	L0_0_set_5
	.long	L0_0_set_7
	.long	L0_0_set_10
	.long	L0_0_set_12
	.end_data_region
                                        ## -- End function
	.comm	_CHIP_HAS_INPUTSEL,4,2          ## @CHIP_HAS_INPUTSEL
	.comm	_ERANGE,4,2                     ## @ERANGE
	.comm	_CHIP_HAS_VOLUME,4,2            ## @CHIP_HAS_VOLUME
	.comm	_CHIP_HAS_BASSTREBLE,4,2        ## @CHIP_HAS_BASSTREBLE
	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_tvaudio_s_ctrl
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tvaudio_s_ctrl
_tvaudio_s_ctrl:                        ; @tvaudio_s_ctrl
	.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, x1
	bl	_to_state
	ldr	w8, [x20]
	sub	w8, w8, #128
	cmp	w8, #4
	b.hi	LBB0_14
; %bb.1:
	mov	x19, x0
	ldr	x22, [x0, #32]
Lloh0:
	adrp	x9, lJTI0_0@PAGE
Lloh1:
	add	x9, x9, lJTI0_0@PAGEOFF
	adr	x10, LBB0_2
	ldrb	w11, [x9, x8]
	add	x10, x10, x11, lsl #2
	br	x10
LBB0_2:
	ldr	w8, [x22]
Lloh2:
	adrp	x9, _CHIP_HAS_VOLUME@GOTPAGE
Lloh3:
	ldr	x9, [x9, _CHIP_HAS_VOLUME@GOTPAGEOFF]
Lloh4:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_14
; %bb.3:
	ldp	w0, w1, [x19, #16]
	bl	_max
	cbz	w0, LBB0_18
; %bb.4:
	mov	x21, x0
	ldp	w0, w1, [x19, #16]
	bl	_min
	lsl	w8, w0, #15
	sdiv	w21, w8, w21
	b	LBB0_19
LBB0_5:
	ldr	w8, [x22]
Lloh5:
	adrp	x9, _CHIP_HAS_BASSTREBLE@GOTPAGE
Lloh6:
	ldr	x9, [x9, _CHIP_HAS_BASSTREBLE@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_14
; %bb.6:
	ldr	w0, [x20, #4]
	str	w0, [x19, #28]
	ldr	w20, [x22, #16]
	ldr	x8, [x22, #8]
	b	LBB0_21
LBB0_7:
	ldr	w8, [x22]
Lloh8:
	adrp	x9, _CHIP_HAS_INPUTSEL@GOTPAGE
Lloh9:
	ldr	x9, [x9, _CHIP_HAS_INPUTSEL@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_14
; %bb.8:
	ldr	w8, [x20, #4]
	cmp	w8, #2
	b.lo	LBB0_16
; %bb.9:
Lloh11:
	adrp	x8, _ERANGE@GOTPAGE
Lloh12:
	ldr	x8, [x8, _ERANGE@GOTPAGEOFF]
	b	LBB0_15
LBB0_10:
	ldr	w8, [x22]
Lloh13:
	adrp	x9, _CHIP_HAS_BASSTREBLE@GOTPAGE
Lloh14:
	ldr	x9, [x9, _CHIP_HAS_BASSTREBLE@GOTPAGEOFF]
Lloh15:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_14
; %bb.11:
	ldr	w0, [x20, #4]
	str	w0, [x19, #24]
	ldr	w20, [x22, #32]
	ldr	x8, [x22, #24]
	b	LBB0_21
LBB0_12:
	ldr	w8, [x22]
Lloh16:
	adrp	x9, _CHIP_HAS_VOLUME@GOTPAGE
Lloh17:
	ldr	x9, [x9, _CHIP_HAS_VOLUME@GOTPAGEOFF]
Lloh18:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_14
; %bb.13:
	ldp	w0, w1, [x19, #16]
	bl	_max
	b	LBB0_20
LBB0_14:
Lloh19:
	adrp	x8, _EINVAL@GOTPAGE
Lloh20:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_15:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_23
LBB0_16:
	str	w8, [x19]
	ldr	w1, [x22, #72]
	cbz	w8, LBB0_24
; %bb.17:
	ldr	w2, [x22, #76]
	b	LBB0_25
LBB0_18:
	mov	w21, #32768
LBB0_19:
	ldr	w20, [x20, #4]
	mov	w8, #65536
	sub	w0, w8, w21
	mov	w1, #32768
	bl	_min
	mul	w8, w0, w20
	mov	w23, #32767
	add	w9, w8, w23
	cmp	w8, #0
	csel	w8, w9, w8, lt
	asr	w8, w8, #15
	str	w8, [x19, #16]
	lsl	w1, w20, #15
	mov	x0, x21
	bl	_min
	add	w8, w0, w23
	cmp	w0, #0
	csel	w8, w8, w0, lt
	asr	w8, w8, #15
	str	w8, [x19, #20]
LBB0_20:
	ldr	w20, [x22, #52]
	ldr	x8, [x22, #40]
	ldr	w0, [x19, #16]
	blr	x8
	mov	x2, x0
	mov	x0, x19
	mov	x1, x20
	bl	_chip_write
	ldr	w20, [x22, #48]
	ldr	x8, [x22, #40]
	ldr	w0, [x19, #20]
LBB0_21:
	blr	x8
	mov	x2, x0
	mov	x0, x19
	mov	x1, x20
	bl	_chip_write
LBB0_22:
	mov	w0, #0
LBB0_23:
	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
LBB0_24:
	ldr	x8, [x22, #64]
	ldr	x9, [x19, #8]
	ldr	w2, [x8, x9, lsl #2]
LBB0_25:
	ldr	w3, [x22, #56]
	mov	x0, x19
	bl	_chip_write_masked
	b	LBB0_22
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh19, Lloh20
	.cfi_endproc
	.section	__TEXT,__const
lJTI0_0:
	.byte	(LBB0_2-LBB0_2)>>2
	.byte	(LBB0_5-LBB0_2)>>2
	.byte	(LBB0_7-LBB0_2)>>2
	.byte	(LBB0_10-LBB0_2)>>2
	.byte	(LBB0_12-LBB0_2)>>2
                                        ; -- End function
	.comm	_CHIP_HAS_INPUTSEL,4,2          ; @CHIP_HAS_INPUTSEL
	.comm	_ERANGE,4,2                     ; @ERANGE
	.comm	_CHIP_HAS_VOLUME,4,2            ; @CHIP_HAS_VOLUME
	.comm	_CHIP_HAS_BASSTREBLE,4,2        ; @CHIP_HAS_BASSTREBLE
	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_tvaudio_s_ctrl
.subsections_via_symbols
