	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ## -- Begin function SN76496_set_gain
LCPI0_0:
	.quad	0x3ff05f6878eddb18              ## double 1.023292992
LCPI0_1:
	.quad	0x3ff4248ef90a4b10              ## double 1.258925412
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	4, 0x90
_SN76496_set_gain:                      ## @SN76496_set_gain
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	movq	_MAX_OUTPUT@GOTPCREL(%rip), %rax
	movslq	(%rax), %r9
	imulq	$1431655766, %r9, %rcx          ## imm = 0x55555556
	movq	%rcx, %rdx
	shrq	$63, %rdx
	shrq	$32, %rcx
	addl	%edx, %ecx
	movl	%esi, %edx
	cvtsi2sd	%ecx, %xmm0
	andl	$255, %edx
	je	LBB0_8
## %bb.1:
	leal	-1(%rdx), %r8d
	andl	$7, %esi
	je	LBB0_5
## %bb.2:
	xorl	%ecx, %ecx
	movsd	LCPI0_0(%rip), %xmm1            ## xmm1 = mem[0],zero
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	mulsd	%xmm1, %xmm0
	incl	%ecx
	cmpl	%ecx, %esi
	jne	LBB0_3
## %bb.4:
	subl	%ecx, %edx
LBB0_5:
	cmpl	$7, %r8d
	jb	LBB0_8
## %bb.6:
	decl	%edx
	movsd	LCPI0_0(%rip), %xmm1            ## xmm1 = mem[0],zero
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	mulsd	%xmm1, %xmm0
	mulsd	%xmm1, %xmm0
	mulsd	%xmm1, %xmm0
	mulsd	%xmm1, %xmm0
	mulsd	%xmm1, %xmm0
	mulsd	%xmm1, %xmm0
	mulsd	%xmm1, %xmm0
	mulsd	%xmm1, %xmm0
	addl	$-8, %edx
	cmpl	$-2, %edx
	jb	LBB0_7
LBB0_8:
	movslq	%r9d, %rcx
	imulq	$1431655766, %rcx, %rcx         ## imm = 0x55555556
	movq	%rcx, %rdx
	shrq	$63, %rdx
	shrq	$32, %rcx
	addl	%edx, %ecx
	xorps	%xmm1, %xmm1
	cvtsi2sd	%ecx, %xmm1
	ucomisd	%xmm1, %xmm0
	cvttsd2si	%xmm0, %edx
	cmoval	%ecx, %edx
	movq	(%rdi), %rcx
	movl	%edx, (%rcx)
	movq	(%rdi), %rcx
	movl	$1, %edx
	movsd	LCPI0_1(%rip), %xmm1            ## xmm1 = mem[0],zero
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	divsd	%xmm1, %xmm0
	movslq	(%rax), %rsi
	imulq	$1431655766, %rsi, %rsi         ## imm = 0x55555556
	movq	%rsi, %rdi
	shrq	$63, %rdi
	shrq	$32, %rsi
	addl	%edi, %esi
	xorps	%xmm2, %xmm2
	cvtsi2sd	%esi, %xmm2
	ucomisd	%xmm2, %xmm0
	cvttsd2si	%xmm0, %edi
	cmoval	%esi, %edi
	movl	%edi, (%rcx,%rdx,4)
	incq	%rdx
	cmpq	$15, %rdx
	jne	LBB0_9
## %bb.10:
	movl	$0, 60(%rcx)
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_OUTPUT,4,2                 ## @MAX_OUTPUT
	.no_dead_strip	_SN76496_set_gain
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function SN76496_set_gain
_SN76496_set_gain:                      ; @SN76496_set_gain
	.cfi_startproc
; %bb.0:
Lloh0:
	adrp	x8, _MAX_OUTPUT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MAX_OUTPUT@GOTPAGEOFF]
	ldrsw	x10, [x8]
	mov	w9, #21846
	movk	w9, #21845, lsl #16
	mul	x11, x10, x9
	lsr	x12, x11, #63
	lsr	x11, x11, #32
	add	w11, w11, w12
	scvtf	d0, w11
	ands	w11, w1, #0xff
	b.eq	LBB0_3
; %bb.1:
	add	w11, w11, #1
	mov	x12, #56088
	movk	x12, #30957, lsl #16
	movk	x12, #24424, lsl #32
	movk	x12, #16368, lsl #48
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	fmov	d1, x12
	fmul	d0, d0, d1
	sub	w11, w11, #1
	cmp	w11, #1
	b.hi	LBB0_2
LBB0_3:
	smull	x10, w10, w9
	lsr	x11, x10, #63
	lsr	x10, x10, #32
	add	w10, w10, w11
	scvtf	d1, w10
	fcvtzs	w11, d0
	fcmp	d0, d1
	csel	w11, w10, w11, gt
	ldr	x10, [x0]
	str	w11, [x10]
	mov	w11, #4
	mov	x12, #19216
	movk	x12, #63754, lsl #16
	movk	x12, #9358, lsl #32
	movk	x12, #16372, lsl #48
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	fmov	d1, x12
	fdiv	d0, d0, d1
	ldrsw	x13, [x8]
	mul	x13, x13, x9
	lsr	x14, x13, #63
	lsr	x13, x13, #32
	add	w13, w13, w14
	scvtf	d1, w13
	fcvtzs	w14, d0
	fcmp	d0, d1
	csel	w13, w13, w14, gt
	str	w13, [x10, x11]
	add	x11, x11, #4
	cmp	x11, #60
	b.ne	LBB0_4
; %bb.5:
	str	wzr, [x10, #60]
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_OUTPUT,4,2                 ; @MAX_OUTPUT
	.no_dead_strip	_SN76496_set_gain
.subsections_via_symbols
