	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function hdsp_write_gain
_hdsp_write_gain:                       ## @hdsp_write_gain
	.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	_HDSP_MATRIX_MIXER_SIZE@GOTPCREL(%rip), %rax
	movl	$-1, %r15d
	cmpl	%esi, (%rax)
	jbe	LBB0_8
## %bb.1:
	movl	%edx, %r12d
	movl	%esi, %ebx
	movq	%rdi, %r14
	movq	(%rdi), %rax
	movq	_H9652@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	_H9632@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	cmpq	%rcx, %rax
	je	LBB0_3
## %bb.2:
	cmpq	%rdx, %rax
	je	LBB0_3
## %bb.6:
	movq	_HDSP_LONG_WAIT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	movl	$127, %esi
	callq	_hdsp_fifo_wait
	testq	%rax, %rax
	jne	LBB0_8
## %bb.7:
	movl	%ebx, %edx
	shll	$16, %edx
	movzwl	%r12w, %r15d
	orl	%r15d, %edx
	movq	_HDSP_fifoData@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_hdsp_write
	movq	8(%r14), %rax
	movl	%ebx, %ecx
	movw	%r15w, (%rax,%rcx,2)
	xorl	%r15d, %r15d
	jmp	LBB0_8
LBB0_3:
	cmpq	%rdx, %rax
	sete	%dl
	cmpq	%rcx, %rax
	sete	%sil
	cmpl	$512, %ebx                      ## imm = 0x200
	setae	%al
	cmpl	$1352, %ebx                     ## imm = 0x548
	setae	%cl
	xorl	%r15d, %r15d
	testb	%dl, %al
	jne	LBB0_8
## %bb.4:
	andb	%sil, %cl
	jne	LBB0_8
## %bb.5:
	movq	8(%r14), %rax
	movl	%ebx, %ecx
	movw	%r12w, (%rax,%rcx,2)
	leal	(%rbx,%rbx), %esi
	addl	$4096, %esi                     ## imm = 0x1000
	andl	$-4, %esi
	andl	$2046, %ebx                     ## imm = 0x7FE
	leal	1(%rbx), %ecx
	movzwl	(%rax,%rcx,2), %ecx
	shll	$16, %ecx
	movzwl	(%rax,%rbx,2), %edx
	orl	%ecx, %edx
	movq	%r14, %rdi
	callq	_hdsp_write
LBB0_8:
	movl	%r15d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_HDSP_MATRIX_MIXER_SIZE,4,2     ## @HDSP_MATRIX_MIXER_SIZE
	.comm	_H9652,8,3                      ## @H9652
	.comm	_H9632,8,3                      ## @H9632
	.comm	_HDSP_LONG_WAIT,4,2             ## @HDSP_LONG_WAIT
	.comm	_HDSP_fifoData,4,2              ## @HDSP_fifoData
	.no_dead_strip	_hdsp_write_gain
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function hdsp_write_gain
_hdsp_write_gain:                       ; @hdsp_write_gain
	.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
Lloh0:
	adrp	x8, _HDSP_MATRIX_MIXER_SIZE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _HDSP_MATRIX_MIXER_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w1
	b.ls	LBB0_6
; %bb.1:
	mov	x21, x2
	mov	x20, x1
	mov	x19, x0
	ldr	x8, [x0]
Lloh3:
	adrp	x9, _H9652@GOTPAGE
Lloh4:
	ldr	x9, [x9, _H9652@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
Lloh6:
	adrp	x10, _H9632@GOTPAGE
Lloh7:
	ldr	x10, [x10, _H9632@GOTPAGEOFF]
Lloh8:
	ldr	x10, [x10]
	cmp	x8, x9
	ccmp	x8, x10, #4, ne
	b.ne	LBB0_5
; %bb.2:
	mov	w0, #0
	cmp	w20, #1351
	ccmp	x8, x9, #0, hi
	cset	w9, eq
	cmp	x8, x10
	mov	w8, #511
	ccmp	w20, w8, #0, eq
	b.hi	LBB0_7
; %bb.3:
	tbnz	w9, #0, LBB0_7
; %bb.4:
	ldr	x8, [x19, #8]
	strh	w21, [x8, w20, uxtw #1]
	lsl	w9, w20, #1
	add	w9, w9, #1, lsl #12             ; =4096
	and	w1, w9, #0xfffffffc
	and	w9, w20, #0x7fe
	orr	w10, w9, #0x1
	ldrh	w10, [x8, w10, uxtw #1]
	ldrh	w2, [x8, w9, uxtw #1]
	bfi	w2, w10, #16, #16
	mov	x0, x19
	bl	_hdsp_write
	mov	w0, #0
	b	LBB0_7
LBB0_5:
Lloh9:
	adrp	x8, _HDSP_LONG_WAIT@GOTPAGE
Lloh10:
	ldr	x8, [x8, _HDSP_LONG_WAIT@GOTPAGEOFF]
Lloh11:
	ldr	w2, [x8]
	mov	x0, x19
	mov	w1, #127
	bl	_hdsp_fifo_wait
	cbz	x0, LBB0_8
LBB0_6:
	mov	w0, #-1
LBB0_7:
	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
LBB0_8:
	mov	x2, x21
	bfi	w2, w20, #16, #16
Lloh12:
	adrp	x8, _HDSP_fifoData@GOTPAGE
Lloh13:
	ldr	x8, [x8, _HDSP_fifoData@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_hdsp_write
	mov	w0, #0
	ldr	x8, [x19, #8]
	strh	w21, [x8, w20, uxtw #1]
	b	LBB0_7
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_HDSP_MATRIX_MIXER_SIZE,4,2     ; @HDSP_MATRIX_MIXER_SIZE
	.comm	_H9652,8,3                      ; @H9652
	.comm	_H9632,8,3                      ; @H9632
	.comm	_HDSP_LONG_WAIT,4,2             ; @HDSP_LONG_WAIT
	.comm	_HDSP_fifoData,4,2              ; @HDSP_fifoData
	.no_dead_strip	_hdsp_write_gain
.subsections_via_symbols
