	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_SN76489_Config                 ## -- Begin function SN76489_Config
	.p2align	4, 0x90
_SN76489_Config:                        ## @SN76489_Config
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %r14d
	movl	%edx, %ecx
	movl	%esi, %r15d
	movq	_SN76489@GOTPCREL(%rip), %r13
	cmpl	%edi, (%r13)
	jae	LBB0_2
## %bb.1:
	movl	%edi, %r12d
	movl	%ecx, %ebx
	callq	_SN76489_RunUntil
	movl	%ebx, %ecx
	movl	(%r13), %ebx
	movq	_PSG_MCYCLES_RATIO@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	%ebx, %esi
	notl	%esi
	addl	%r12d, %esi
	addl	%edi, %esi
	movl	%esi, %eax
	xorl	%edx, %edx
	divl	%edi
	subl	%edx, %ebx
	addl	%esi, %ebx
	movl	%ebx, (%r13)
LBB0_2:
	movq	_PSGVolumeValues@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	24(%r13), %r9
	movq	8(%r13), %r10
	movq	16(%r13), %r8
	movl	%r14d, %edi
	shrl	$4, %edi
	andl	$1, %edi
	imull	%r15d, %edi
	movq	(%r10), %rdx
	movl	%edi, (%rdx)
	movl	%r14d, %ebx
	andl	$1, %ebx
	imull	%r15d, %ebx
	movl	%ebx, 4(%rdx)
	movq	8(%r9), %rbx
	imull	(%rax,%rbx,4), %edi
	movslq	%edi, %rdi
	imulq	$1374389535, %rdi, %rdi         ## imm = 0x51EB851F
	movq	%rdi, %rsi
	shrq	$63, %rsi
	sarq	$37, %rdi
	addl	%esi, %edi
	movq	(%r8), %rsi
	movl	%edi, (%rsi)
	movl	4(%rdx), %edx
	imull	(%rax,%rbx,4), %edx
	movslq	%edx, %rdx
	imulq	$1374389535, %rdx, %rdx         ## imm = 0x51EB851F
	movq	%rdx, %rdi
	shrq	$63, %rdi
	sarq	$37, %rdx
	addl	%edi, %edx
	movl	%edx, 4(%rsi)
	movl	%r14d, %edx
	shrl	$5, %edx
	andl	$1, %edx
	imull	%r15d, %edx
	movq	8(%r10), %rsi
	movl	%edx, (%rsi)
	movl	%r14d, %edi
	shrl	%edi
	andl	$1, %edi
	imull	%r15d, %edi
	movl	%edi, 4(%rsi)
	movq	24(%r9), %rdi
	imull	(%rax,%rdi,4), %edx
	movslq	%edx, %rdx
	imulq	$1374389535, %rdx, %rdx         ## imm = 0x51EB851F
	movq	%rdx, %rbx
	shrq	$63, %rbx
	sarq	$37, %rdx
	addl	%ebx, %edx
	movq	8(%r8), %rbx
	movl	%edx, (%rbx)
	movl	4(%rsi), %edx
	imull	(%rax,%rdi,4), %edx
	movslq	%edx, %rdx
	imulq	$1374389535, %rdx, %rdx         ## imm = 0x51EB851F
	movq	%rdx, %rsi
	shrq	$63, %rsi
	sarq	$37, %rdx
	addl	%esi, %edx
	movl	%edx, 4(%rbx)
	movl	%r14d, %edx
	shrl	$6, %edx
	andl	$1, %edx
	imull	%r15d, %edx
	movq	16(%r10), %rsi
	movl	%edx, (%rsi)
	movl	%r14d, %edi
	shrl	$2, %edi
	andl	$1, %edi
	imull	%r15d, %edi
	movl	%edi, 4(%rsi)
	movq	24(%r10), %r10
	movq	40(%r9), %rdi
	imull	(%rax,%rdi,4), %edx
	movslq	%edx, %rdx
	imulq	$1374389535, %rdx, %rdx         ## imm = 0x51EB851F
	movq	%rdx, %rbx
	shrq	$63, %rbx
	sarq	$37, %rdx
	addl	%ebx, %edx
	movq	16(%r8), %rbx
	movl	%edx, (%rbx)
	movl	4(%rsi), %edx
	imull	(%rax,%rdi,4), %edx
	movslq	%edx, %rdx
	imulq	$1374389535, %rdx, %rsi         ## imm = 0x51EB851F
	movq	%rsi, %rdx
	shrq	$63, %rdx
	sarq	$37, %rsi
	addl	%edx, %esi
	movl	%esi, 4(%rbx)
	movl	%r14d, %edx
	shrl	$7, %edx
	andl	$1, %edx
	imull	%r15d, %edx
	shrl	$3, %r14d
	andl	$1, %r14d
	imull	%r15d, %r14d
	shll	%cl, %edx
	movl	%edx, (%r10)
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %r14d
	movl	%r14d, 4(%r10)
	movq	56(%r9), %rcx
	imull	(%rax,%rcx,4), %edx
	movslq	%edx, %rdx
	imulq	$1374389535, %rdx, %rdx         ## imm = 0x51EB851F
	movq	%rdx, %rsi
	shrq	$63, %rsi
	sarq	$37, %rdx
	addl	%esi, %edx
	movq	24(%r8), %rsi
	movl	%edx, (%rsi)
	movl	4(%r10), %edx
	imull	(%rax,%rcx,4), %edx
	movslq	%edx, %rax
	imulq	$1374389535, %rax, %rax         ## imm = 0x51EB851F
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$37, %rax
	addl	%ecx, %eax
	movl	%eax, 4(%rsi)
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SN76489,32,3                   ## @SN76489
	.comm	_PSG_MCYCLES_RATIO,4,2          ## @PSG_MCYCLES_RATIO
	.comm	_PSGVolumeValues,8,3            ## @PSGVolumeValues
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ; -- Begin function SN76489_Config
lCPI0_0:
	.long	4294967291                      ; 0xfffffffb
	.long	4294967295                      ; 0xffffffff
lCPI0_1:
	.long	4294967290                      ; 0xfffffffa
	.long	4294967294                      ; 0xfffffffe
lCPI0_2:
	.long	4294967289                      ; 0xfffffff9
	.long	4294967293                      ; 0xfffffffd
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_SN76489_Config
	.p2align	2
_SN76489_Config:                        ; @SN76489_Config
	.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	x21, x3
	mov	x19, x2
	mov	x20, x1
Lloh0:
	adrp	x23, _SN76489@GOTPAGE
Lloh1:
	ldr	x23, [x23, _SN76489@GOTPAGEOFF]
	ldr	w8, [x23]
	cmp	w8, w0
	b.hs	LBB0_2
; %bb.1:
	mov	x22, x0
	bl	_SN76489_RunUntil
	ldr	w8, [x23]
Lloh2:
	adrp	x9, _PSG_MCYCLES_RATIO@GOTPAGE
Lloh3:
	ldr	x9, [x9, _PSG_MCYCLES_RATIO@GOTPAGEOFF]
Lloh4:
	ldr	w9, [x9]
	mvn	w10, w8
	add	w10, w10, w22
	add	w10, w10, w9
	udiv	w11, w10, w9
	neg	w12, w10
	madd	w9, w11, w9, w12
	add	w8, w8, w9
	add	w8, w8, w10
	str	w8, [x23]
LBB0_2:
Lloh5:
	adrp	x8, _PSGVolumeValues@GOTPAGE
Lloh6:
	ldr	x8, [x8, _PSGVolumeValues@GOTPAGEOFF]
Lloh7:
	ldr	x8, [x8]
	ldp	x10, x9, [x23, #16]
	ldr	x12, [x23, #8]
	ubfx	w11, w21, #4, #1
	mul	w11, w11, w20
	and	w13, w21, #0x1
	mul	w13, w13, w20
	ldp	x14, x15, [x12]
	stp	w11, w13, [x14]
	ldr	x13, [x9, #8]
	lsl	x13, x13, #2
	ldr	w16, [x8, x13]
	mul	w16, w11, w16
	mov	w11, #34079
	movk	w11, #20971, lsl #16
	smull	x16, w16, w11
	lsr	x17, x16, #63
	asr	x16, x16, #37
	add	w16, w16, w17
	ldp	x17, x0, [x10]
	str	w16, [x17]
	ldr	w13, [x8, x13]
	ldr	w14, [x14, #4]
	mul	w13, w14, w13
	smull	x13, w13, w11
	lsr	x14, x13, #63
	asr	x13, x13, #37
	add	w13, w13, w14
	dup.2s	v0, w21
	str	w13, [x17, #4]
Lloh8:
	adrp	x13, lCPI0_0@PAGE
Lloh9:
	ldr	d1, [x13, lCPI0_0@PAGEOFF]
	ushl.2s	v1, v0, v1
	movi.2s	v2, #1
	and.8b	v1, v1, v2
	dup.2s	v3, w20
	mul.2s	v1, v1, v3
	str	d1, [x15]
	ldr	x13, [x9, #24]
	lsl	x13, x13, #2
	ldr	w14, [x8, x13]
	fmov	w16, s1
	mul	w14, w16, w14
	smull	x14, w14, w11
	lsr	x16, x14, #63
	asr	x14, x14, #37
	add	w14, w14, w16
	str	w14, [x0]
	ldr	w13, [x8, x13]
	ldr	w14, [x15, #4]
	mul	w13, w14, w13
	smull	x13, w13, w11
	lsr	x14, x13, #63
	asr	x13, x13, #37
	add	w13, w13, w14
	str	w13, [x0, #4]
Lloh10:
	adrp	x13, lCPI0_1@PAGE
Lloh11:
	ldr	d1, [x13, lCPI0_1@PAGEOFF]
	ushl.2s	v1, v0, v1
	and.8b	v1, v1, v2
	mul.2s	v1, v1, v3
	ldp	x13, x12, [x12, #16]
	str	d1, [x13]
	ldr	x14, [x9, #40]
	lsl	x14, x14, #2
	ldr	w15, [x8, x14]
	fmov	w16, s1
	mul	w15, w16, w15
	smull	x15, w15, w11
	lsr	x16, x15, #63
	asr	x15, x15, #37
	add	w15, w15, w16
	ldp	x16, x10, [x10, #16]
	str	w15, [x16]
	ldr	w14, [x8, x14]
	ldr	w13, [x13, #4]
	mul	w13, w13, w14
	smull	x13, w13, w11
	lsr	x14, x13, #63
	asr	x13, x13, #37
	add	w13, w13, w14
	str	w13, [x16, #4]
Lloh12:
	adrp	x13, lCPI0_2@PAGE
Lloh13:
	ldr	d1, [x13, lCPI0_2@PAGEOFF]
	ushl.2s	v0, v0, v1
	and.8b	v0, v0, v2
	mul.2s	v0, v0, v3
	dup.2s	v1, w19
	ushl.2s	v0, v0, v1
	str	d0, [x12]
	ldr	x9, [x9, #56]
	lsl	x9, x9, #2
	ldr	w13, [x8, x9]
	fmov	w14, s0
	mul	w13, w14, w13
	smull	x13, w13, w11
	lsr	x14, x13, #63
	asr	x13, x13, #37
	add	w13, w13, w14
	str	w13, [x10]
	ldr	w8, [x8, x9]
	ldr	w9, [x12, #4]
	mul	w8, w9, w8
	smull	x8, w8, w11
	lsr	x9, x8, #63
	asr	x8, x8, #37
	add	w8, w8, w9
	str	w8, [x10, #4]
	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
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdr	Lloh12, Lloh13
	.loh AdrpLdr	Lloh10, Lloh11
	.loh AdrpLdr	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_SN76489,32,3                   ; @SN76489
	.comm	_PSG_MCYCLES_RATIO,4,2          ; @PSG_MCYCLES_RATIO
	.comm	_PSGVolumeValues,8,3            ; @PSGVolumeValues
.subsections_via_symbols
