	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_VOTRAXSND_Init                 ## -- Begin function VOTRAXSND_Init
	.p2align	4, 0x90
_VOTRAXSND_Init:                        ## @VOTRAXSND_Init
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_bit16@GOTPCREL(%rip), %rax
	movl	%edx, (%rax)
	movq	_dsprate@GOTPCREL(%rip), %r15
	movl	%edi, (%r15)
	movq	_num_pokeys@GOTPCREL(%rip), %rbx
	movl	%esi, (%rbx)
	xorl	%eax, %eax
	callq	_votraxsnd_enabled
	testl	%eax, %eax
	je	LBB0_3
## %bb.1:
	movl	(%rbx), %esi
	leal	-3(%rsi), %eax
	cmpl	$-3, %eax
	ja	LBB0_2
## %bb.4:
	leaq	L_.str(%rip), %rdi
                                        ## kill: def $esi killed $esi killed $rsi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_Log_print                      ## TAILCALL
LBB0_2:
	movl	$1, _VOTRAXSND_Init.vi(%rip)
	leaq	_VOTRAXSND_Init.vi(%rip), %r14
	movq	_VOTRAXSND_busy_callback_async@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, _VOTRAXSND_Init.vi+4(%rip)
	xorl	%eax, %eax
	callq	_Votrax_Stop
	movq	%r14, %rdi
	callq	_Votrax_Start
	movq	_Atari800_tv_mode@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_Atari800_TV_PAL@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	movl	$50, %eax
	movl	$60, %esi
	cmovel	%eax, %esi
	movl	(%r15), %ecx
	movl	%ecx, %eax
	cltd
	idivl	%esi
	movq	_VTRX_RATE@GOTPCREL(%rip), %rdx
	cvtsi2sdq	(%rdx), %xmm0
	cvtsi2sd	%ecx, %xmm1
	movq	_samples_per_frame@GOTPCREL(%rip), %rcx
	divsd	%xmm1, %xmm0
	cvttsd2si	%xmm0, %ebx
	movl	%eax, (%rcx)
	movq	_ratio@GOTPCREL(%rip), %rax
	movl	%ebx, (%rax)
	movq	_VTRX_BLOCK_SIZE@GOTPCREL(%rip), %r14
	movq	_temp_votrax_buffer@GOTPCREL(%rip), %r15
	movq	(%r15), %rdi
	imull	(%r14), %ebx
	callq	_free
	leal	40(,%rbx,4), %edi
	callq	_Util_malloc
	movq	%rax, (%r15)
	movq	_votrax_buffer@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rdi
	callq	_free
	movl	(%r14), %edi
	shll	$2, %edi
	callq	_Util_malloc
	movq	%rax, (%rbx)
	movq	_FALSE@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_VOTRAXSND_busy@GOTPCREL(%rip), %rcx
	movq	%rax, (%rcx)
	movq	_votrax_sync_samples@GOTPCREL(%rip), %rax
	movq	$0, (%rax)
LBB0_3:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
.zerofill __DATA,__bss,_VOTRAXSND_Init.vi,8,2 ## @VOTRAXSND_Init.vi
	.comm	_bit16,4,2                      ## @bit16
	.comm	_dsprate,4,2                    ## @dsprate
	.comm	_num_pokeys,4,2                 ## @num_pokeys
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"VOTRAXSND_Init: cannot handle num_pokeys=%d"

	.comm	_VOTRAXSND_busy_callback_async,4,2 ## @VOTRAXSND_busy_callback_async
	.comm	_Atari800_tv_mode,8,3           ## @Atari800_tv_mode
	.comm	_Atari800_TV_PAL,8,3            ## @Atari800_TV_PAL
	.comm	_samples_per_frame,4,2          ## @samples_per_frame
	.comm	_VTRX_RATE,8,3                  ## @VTRX_RATE
	.comm	_ratio,4,2                      ## @ratio
	.comm	_VTRX_BLOCK_SIZE,4,2            ## @VTRX_BLOCK_SIZE
	.comm	_temp_votrax_buffer,8,3         ## @temp_votrax_buffer
	.comm	_votrax_buffer,8,3              ## @votrax_buffer
	.comm	_FALSE,8,3                      ## @FALSE
	.comm	_VOTRAXSND_busy,8,3             ## @VOTRAXSND_busy
	.comm	_votrax_sync_samples,8,3        ## @votrax_sync_samples
	.comm	_PBI_XLD_v_enabled,8,3          ## @PBI_XLD_v_enabled
	.comm	_VOICEBOX_BASEAUDF,4,2          ## @VOICEBOX_BASEAUDF
	.comm	_VOICEBOX_enabled,8,3           ## @VOICEBOX_enabled
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_VOTRAXSND_Init                 ; -- Begin function VOTRAXSND_Init
	.p2align	2
_VOTRAXSND_Init:                        ; @VOTRAXSND_Init
	.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, _bit16@GOTPAGE
Lloh1:
	ldr	x8, [x8, _bit16@GOTPAGEOFF]
Lloh2:
	str	w2, [x8]
Lloh3:
	adrp	x20, _dsprate@GOTPAGE
Lloh4:
	ldr	x20, [x20, _dsprate@GOTPAGEOFF]
	str	w0, [x20]
Lloh5:
	adrp	x19, _num_pokeys@GOTPAGE
Lloh6:
	ldr	x19, [x19, _num_pokeys@GOTPAGEOFF]
	str	w1, [x19]
	bl	_votraxsnd_enabled
	cbz	w0, LBB0_4
; %bb.1:
	ldr	w1, [x19]
	sub	w8, w1, #3
	cmn	w8, #3
	b.hi	LBB0_3
; %bb.2:
Lloh7:
	adrp	x0, l_.str@PAGE
Lloh8:
	add	x0, x0, l_.str@PAGEOFF
	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
	b	_Log_print
LBB0_3:
Lloh9:
	adrp	x19, _VOTRAXSND_Init.vi@PAGE
Lloh10:
	add	x19, x19, _VOTRAXSND_Init.vi@PAGEOFF
Lloh11:
	adrp	x8, _VOTRAXSND_busy_callback_async@GOTPAGE
Lloh12:
	ldr	x8, [x8, _VOTRAXSND_busy_callback_async@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	mov	w9, #1
	stp	w9, w8, [x19]
	bl	_Votrax_Stop
	mov	x0, x19
	bl	_Votrax_Start
	ldr	w8, [x20]
Lloh14:
	adrp	x9, _Atari800_tv_mode@GOTPAGE
Lloh15:
	ldr	x9, [x9, _Atari800_tv_mode@GOTPAGEOFF]
Lloh16:
	ldr	x9, [x9]
Lloh17:
	adrp	x10, _Atari800_TV_PAL@GOTPAGE
Lloh18:
	ldr	x10, [x10, _Atari800_TV_PAL@GOTPAGEOFF]
Lloh19:
	ldr	x10, [x10]
	cmp	x9, x10
	mov	w9, #60
	mov	w10, #50
	csel	w9, w10, w9, eq
	sdiv	w9, w8, w9
Lloh20:
	adrp	x10, _samples_per_frame@GOTPAGE
Lloh21:
	ldr	x10, [x10, _samples_per_frame@GOTPAGEOFF]
Lloh22:
	str	w9, [x10]
Lloh23:
	adrp	x9, _VTRX_RATE@GOTPAGE
Lloh24:
	ldr	x9, [x9, _VTRX_RATE@GOTPAGEOFF]
Lloh25:
	ldr	d0, [x9]
	scvtf	d0, d0
	scvtf	d1, w8
	fdiv	d0, d0, d1
	fcvtzs	w19, d0
Lloh26:
	adrp	x8, _ratio@GOTPAGE
Lloh27:
	ldr	x8, [x8, _ratio@GOTPAGEOFF]
Lloh28:
	str	w19, [x8]
Lloh29:
	adrp	x20, _VTRX_BLOCK_SIZE@GOTPAGE
Lloh30:
	ldr	x20, [x20, _VTRX_BLOCK_SIZE@GOTPAGEOFF]
	ldr	w21, [x20]
Lloh31:
	adrp	x22, _temp_votrax_buffer@GOTPAGE
Lloh32:
	ldr	x22, [x22, _temp_votrax_buffer@GOTPAGEOFF]
	ldr	x0, [x22]
	bl	_free
	mul	w8, w21, w19
	lsl	w8, w8, #2
	add	w0, w8, #40
	bl	_Util_malloc
	str	x0, [x22]
Lloh33:
	adrp	x19, _votrax_buffer@GOTPAGE
Lloh34:
	ldr	x19, [x19, _votrax_buffer@GOTPAGEOFF]
	ldr	x0, [x19]
	bl	_free
	ldr	w8, [x20]
	lsl	w0, w8, #2
	bl	_Util_malloc
	str	x0, [x19]
Lloh35:
	adrp	x8, _FALSE@GOTPAGE
Lloh36:
	ldr	x8, [x8, _FALSE@GOTPAGEOFF]
Lloh37:
	ldr	x8, [x8]
Lloh38:
	adrp	x9, _VOTRAXSND_busy@GOTPAGE
Lloh39:
	ldr	x9, [x9, _VOTRAXSND_busy@GOTPAGEOFF]
Lloh40:
	str	x8, [x9]
Lloh41:
	adrp	x8, _votrax_sync_samples@GOTPAGE
Lloh42:
	ldr	x8, [x8, _votrax_sync_samples@GOTPAGEOFF]
Lloh43:
	str	xzr, [x8]
LBB0_4:
	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	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotStr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotStr	Lloh41, Lloh42, Lloh43
	.loh AdrpLdrGotStr	Lloh38, Lloh39, Lloh40
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGot	Lloh33, Lloh34
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpLdrGot	Lloh29, Lloh30
	.loh AdrpLdrGotStr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotStr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
.zerofill __DATA,__bss,_VOTRAXSND_Init.vi,8,2 ; @VOTRAXSND_Init.vi
	.comm	_bit16,4,2                      ; @bit16
	.comm	_dsprate,4,2                    ; @dsprate
	.comm	_num_pokeys,4,2                 ; @num_pokeys
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"VOTRAXSND_Init: cannot handle num_pokeys=%d"

	.comm	_VOTRAXSND_busy_callback_async,4,2 ; @VOTRAXSND_busy_callback_async
	.comm	_Atari800_tv_mode,8,3           ; @Atari800_tv_mode
	.comm	_Atari800_TV_PAL,8,3            ; @Atari800_TV_PAL
	.comm	_samples_per_frame,4,2          ; @samples_per_frame
	.comm	_VTRX_RATE,8,3                  ; @VTRX_RATE
	.comm	_ratio,4,2                      ; @ratio
	.comm	_VTRX_BLOCK_SIZE,4,2            ; @VTRX_BLOCK_SIZE
	.comm	_temp_votrax_buffer,8,3         ; @temp_votrax_buffer
	.comm	_votrax_buffer,8,3              ; @votrax_buffer
	.comm	_FALSE,8,3                      ; @FALSE
	.comm	_VOTRAXSND_busy,8,3             ; @VOTRAXSND_busy
	.comm	_votrax_sync_samples,8,3        ; @votrax_sync_samples
	.comm	_PBI_XLD_v_enabled,8,3          ; @PBI_XLD_v_enabled
	.comm	_VOICEBOX_BASEAUDF,4,2          ; @VOICEBOX_BASEAUDF
	.comm	_VOICEBOX_enabled,8,3           ; @VOICEBOX_enabled
.subsections_via_symbols
