	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_play_note                      ## -- Begin function play_note
	.p2align	4, 0x90
_play_note:                             ## @play_note
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movl	%edi, %ebx
	movss	%xmm0, -20(%rbp)                ## 4-byte Spill
	cvttss2si	%xmm0, %esi
	leaq	L_.str(%rip), %rdi
	movl	%ebx, %edx
	callq	_dprintf
	movq	_audio_initialized@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	jne	LBB0_2
## %bb.1:
	xorl	%eax, %eax
	callq	_audio_init
LBB0_2:
	movq	_audio_config@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_9
## %bb.3:
	movq	_voices@GOTPCREL(%rip), %r14
	cmpl	$7, (%r14)
	jg	LBB0_9
## %bb.4:
	movq	_playing_notes@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_6
## %bb.5:
	xorl	%eax, %eax
	callq	_stop_all_notes
LBB0_6:
	movq	_playing_note@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
	movq	_envelope_index@GOTPCREL(%rip), %rax
	movq	$0, (%rax)
	xorps	%xmm0, %xmm0
	movss	-20(%rbp), %xmm1                ## 4-byte Reload
                                        ## xmm1 = mem[0],zero,zero,zero
	ucomiss	%xmm0, %xmm1
	jbe	LBB0_8
## %bb.7:
	movaps	%xmm1, %xmm0
	movq	_frequencies@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movslq	(%r14), %rcx
	movss	%xmm1, (%rax,%rcx,4)
	movq	_volumes@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	%ebx, (%rax,%rcx,4)
	incl	(%r14)
LBB0_8:
	movq	_GPTD8@GOTPCREL(%rip), %rbx
	movq	_gpt8cfg1@GOTPCREL(%rip), %rsi
	movq	%rbx, %rdi
	callq	_gptStart
	movq	%rbx, %rdi
	movl	$2, %esi
	callq	_gptStartContinuous
	xorl	%eax, %eax
	callq	_RESTART_CHANNEL_1
	xorl	%eax, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_RESTART_CHANNEL_2              ## TAILCALL
LBB0_9:
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"audio play note freq=%d vol=%d"

	.comm	_audio_initialized,4,2          ## @audio_initialized
	.comm	_audio_config,8,3               ## @audio_config
	.comm	_voices,4,2                     ## @voices
	.comm	_playing_notes,8,3              ## @playing_notes
	.comm	_playing_note,4,2               ## @playing_note
	.comm	_envelope_index,8,3             ## @envelope_index
	.comm	_frequencies,8,3                ## @frequencies
	.comm	_volumes,8,3                    ## @volumes
	.comm	_GPTD8,4,2                      ## @GPTD8
	.comm	_gpt8cfg1,4,2                   ## @gpt8cfg1
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_play_note                      ; -- Begin function play_note
	.p2align	2
_play_note:                             ; @play_note
	.cfi_startproc
; %bb.0:
	stp	d9, d8, [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 b8, -40
	.cfi_offset b9, -48
	mov	x19, x0
	fmov	s8, s0
	fcvtzs	w1, s0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	mov	x2, x19
	bl	_dprintf
Lloh2:
	adrp	x8, _audio_initialized@GOTPAGE
Lloh3:
	ldr	x8, [x8, _audio_initialized@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	cbnz	w8, LBB0_2
; %bb.1:
	bl	_audio_init
LBB0_2:
Lloh5:
	adrp	x8, _audio_config@GOTPAGE
Lloh6:
	ldr	x8, [x8, _audio_config@GOTPAGEOFF]
Lloh7:
	ldr	x8, [x8]
Lloh8:
	adrp	x20, _voices@GOTPAGE
Lloh9:
	ldr	x20, [x20, _voices@GOTPAGEOFF]
	ldr	w9, [x20]
	cmp	x8, #0
	ccmp	w9, #7, #0, ne
	b.le	LBB0_4
; %bb.3:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	d9, d8, [sp], #48               ; 16-byte Folded Reload
	ret
LBB0_4:
Lloh10:
	adrp	x8, _playing_notes@GOTPAGE
Lloh11:
	ldr	x8, [x8, _playing_notes@GOTPAGEOFF]
Lloh12:
	ldr	x8, [x8]
	cbz	x8, LBB0_6
; %bb.5:
	bl	_stop_all_notes
LBB0_6:
Lloh13:
	adrp	x8, _playing_note@GOTPAGE
Lloh14:
	ldr	x8, [x8, _playing_note@GOTPAGEOFF]
	mov	w9, #1
Lloh15:
	str	w9, [x8]
Lloh16:
	adrp	x8, _envelope_index@GOTPAGE
Lloh17:
	ldr	x8, [x8, _envelope_index@GOTPAGEOFF]
Lloh18:
	str	xzr, [x8]
	fcmp	s8, #0.0
	b.le	LBB0_8
; %bb.7:
Lloh19:
	adrp	x8, _frequencies@GOTPAGE
Lloh20:
	ldr	x8, [x8, _frequencies@GOTPAGEOFF]
Lloh21:
	ldr	x8, [x8]
	ldrsw	x9, [x20]
	lsl	x9, x9, #2
	str	s8, [x8, x9]
Lloh22:
	adrp	x8, _volumes@GOTPAGE
Lloh23:
	ldr	x8, [x8, _volumes@GOTPAGEOFF]
Lloh24:
	ldr	x8, [x8]
	str	w19, [x8, x9]
	ldr	w8, [x20]
	add	w8, w8, #1
	str	w8, [x20]
LBB0_8:
Lloh25:
	adrp	x19, _GPTD8@GOTPAGE
Lloh26:
	ldr	x19, [x19, _GPTD8@GOTPAGEOFF]
Lloh27:
	adrp	x1, _gpt8cfg1@GOTPAGE
Lloh28:
	ldr	x1, [x1, _gpt8cfg1@GOTPAGEOFF]
	mov	x0, x19
	bl	_gptStart
	mov	x0, x19
	mov	w1, #2
	bl	_gptStartContinuous
	bl	_RESTART_CHANNEL_1
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	d9, d8, [sp], #48               ; 16-byte Folded Reload
	b	_RESTART_CHANNEL_2
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotStr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotStr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"audio play note freq=%d vol=%d"

	.comm	_audio_initialized,4,2          ; @audio_initialized
	.comm	_audio_config,8,3               ; @audio_config
	.comm	_voices,4,2                     ; @voices
	.comm	_playing_notes,8,3              ; @playing_notes
	.comm	_playing_note,4,2               ; @playing_note
	.comm	_envelope_index,8,3             ; @envelope_index
	.comm	_frequencies,8,3                ; @frequencies
	.comm	_volumes,8,3                    ; @volumes
	.comm	_GPTD8,4,2                      ; @GPTD8
	.comm	_gpt8cfg1,4,2                   ; @gpt8cfg1
.subsections_via_symbols
