	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_YM2413Update                   ## -- Begin function YM2413Update
	.p2align	4, 0x90
_YM2413Update:                          ## @YM2413Update
	.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
	testl	%esi, %esi
	jle	LBB0_6
## %bb.1:
	movq	%rdi, %r12
	movl	%esi, %eax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	_output@GOTPCREL(%rip), %r15
	movq	_ym2413@GOTPCREL(%rip), %r13
	xorl	%ebx, %ebx
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_4:                                 ##   in Loop: Header=BB0_2 Depth=1
	movl	4(%r13), %esi
	andl	$1, %esi
	callq	_rhythm_calc
LBB0_5:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	(%r15), %rax
	movl	4(%rax), %ecx
	addl	%ecx, %ecx
	addl	(%rax), %ecx
	imull	8(%r13), %ecx
	addl	%ecx, %ecx
	movl	%ecx, (%r12,%r14,4)
	movl	%ecx, 4(%r12,%r14,4)
	xorl	%eax, %eax
	callq	_advance
	incq	%rbx
	cmpl	%ebx, -48(%rbp)                 ## 4-byte Folded Reload
	je	LBB0_6
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	leaq	(%rbx,%rbx), %r14
	movq	(%r15), %rax
	movq	$0, (%rax)
	xorl	%eax, %eax
	callq	_advance_lfo
	movq	16(%r13), %rdi
	callq	_chan_calc
	movq	16(%r13), %rdi
	addq	$4, %rdi
	callq	_chan_calc
	movq	16(%r13), %rdi
	addq	$8, %rdi
	callq	_chan_calc
	movq	16(%r13), %rdi
	addq	$12, %rdi
	callq	_chan_calc
	movq	16(%r13), %rdi
	addq	$16, %rdi
	callq	_chan_calc
	movq	16(%r13), %rdi
	addq	$20, %rdi
	callq	_chan_calc
	testb	$32, (%r13)
	movq	16(%r13), %rdi
	jne	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	addq	$24, %rdi
	callq	_chan_calc
	movq	16(%r13), %rdi
	addq	$28, %rdi
	callq	_chan_calc
	movq	16(%r13), %rdi
	addq	$32, %rdi
	callq	_chan_calc
	jmp	LBB0_5
LBB0_6:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_output,8,3                     ## @output
	.comm	_ym2413,24,3                    ## @ym2413
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_YM2413Update                   ; -- Begin function YM2413Update
	.p2align	2
_YM2413Update:                          ; @YM2413Update
	.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
	cmp	w1, #1
	b.lt	LBB0_6
; %bb.1:
	mov	x19, x1
	mov	x20, x0
Lloh0:
	adrp	x21, _output@GOTPAGE
Lloh1:
	ldr	x21, [x21, _output@GOTPAGEOFF]
Lloh2:
	adrp	x22, _ym2413@GOTPAGE
Lloh3:
	ldr	x22, [x22, _ym2413@GOTPAGEOFF]
	b	LBB0_4
LBB0_2:                                 ;   in Loop: Header=BB0_4 Depth=1
	ldr	w8, [x22, #4]
	and	w1, w8, #0x1
	bl	_rhythm_calc
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	ldr	x8, [x21]
	ldp	w9, w8, [x8]
	add	w8, w9, w8, lsl #1
	ldr	w9, [x22, #8]
	mul	w8, w8, w9
	lsl	w8, w8, #1
	stp	w8, w8, [x20], #8
	bl	_advance
	subs	w19, w19, #1
	b.eq	LBB0_6
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x21]
	str	xzr, [x8]
	bl	_advance_lfo
	ldr	x0, [x22, #16]
	bl	_chan_calc
	ldr	x8, [x22, #16]
	add	x0, x8, #4
	bl	_chan_calc
	ldr	x8, [x22, #16]
	add	x0, x8, #8
	bl	_chan_calc
	ldr	x8, [x22, #16]
	add	x0, x8, #12
	bl	_chan_calc
	ldr	x8, [x22, #16]
	add	x0, x8, #16
	bl	_chan_calc
	ldr	x8, [x22, #16]
	add	x0, x8, #20
	bl	_chan_calc
	ldr	x0, [x22, #16]
	ldrb	w8, [x22]
	tbnz	w8, #5, LBB0_2
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	add	x0, x0, #24
	bl	_chan_calc
	ldr	x8, [x22, #16]
	add	x0, x8, #28
	bl	_chan_calc
	ldr	x8, [x22, #16]
	add	x0, x8, #32
	bl	_chan_calc
	b	LBB0_3
LBB0_6:
	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
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_output,8,3                     ; @output
	.comm	_ym2413,24,3                    ; @ym2413
.subsections_via_symbols
