	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_InitSound                      ## -- Begin function InitSound
	.p2align	4, 0x90
_InitSound:                             ## @InitSound
	.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	$32, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	__sound@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	je	LBB0_1
## %bb.2:
	leaq	-48(%rbp), %rdi
	xorl	%ebx, %ebx
	xorl	%esi, %esi
	movl	$32, %edx
	callq	_memset
	movq	_SDL_INIT_AUDIO@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_SDL_InitSubSystem
	testq	%rax, %rax
	js	LBB0_3
## %bb.4:
	movq	_soundrate@GOTPCREL(%rip), %r14
	movl	(%r14), %eax
	movl	%eax, -48(%rbp)
	movq	_AUDIO_S16SYS@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, -20(%rbp)
	movabsq	$1099511627777, %rcx            ## imm = 0x10000000001
	movq	%rcx, -44(%rbp)
	movq	_fillaudio@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, -24(%rbp)
	movq	$0, -32(%rbp)
	movq	_soundbufsize@GOTPCREL(%rip), %rcx
	imull	(%rcx), %eax
	cltq
	imulq	$274877907, %rax, %rax          ## imm = 0x10624DD3
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$38, %rax
	addl	%ecx, %eax
	cmpl	$769, %eax                      ## imm = 0x301
	movl	$768, %ecx                      ## imm = 0x300
	cmovgel	%eax, %ecx
	leal	-512(%rcx), %eax
	movq	_BufferSize@GOTPCREL(%rip), %rdx
	movl	%eax, (%rdx)
	leal	-2048(,%rcx,4), %edi
	callq	_malloc
	movq	_Buffer@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	movq	_BufferIn@GOTPCREL(%rip), %rax
	movq	$0, (%rax)
	movq	_BufferWrite@GOTPCREL(%rip), %rax
	movq	$0, (%rax)
	movq	_BufferRead@GOTPCREL(%rip), %rax
	movq	$0, (%rax)
	leaq	-48(%rbp), %rdi
	xorl	%ebx, %ebx
	xorl	%esi, %esi
	callq	_SDL_OpenAudio
	testq	%rax, %rax
	js	LBB0_3
## %bb.5:
	xorl	%edi, %edi
	callq	_SDL_PauseAudio
	movl	(%r14), %edi
	callq	_FCEUI_Sound
	movl	$1, %ebx
	jmp	LBB0_6
LBB0_1:
	xorl	%ebx, %ebx
	jmp	LBB0_6
LBB0_3:
	xorl	%eax, %eax
	callq	_SDL_GetError
	movl	%eax, %edi
	callq	_puts
	xorl	%eax, %eax
	callq	_KillSound
LBB0_6:
	movl	%ebx, %eax
	addq	$32, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	__sound,4,2                     ## @_sound
	.comm	_SDL_INIT_AUDIO,4,2             ## @SDL_INIT_AUDIO
	.comm	_soundrate,4,2                  ## @soundrate
	.comm	_AUDIO_S16SYS,4,2               ## @AUDIO_S16SYS
	.comm	_fillaudio,4,2                  ## @fillaudio
	.comm	_soundbufsize,4,2               ## @soundbufsize
	.comm	_BufferSize,4,2                 ## @BufferSize
	.comm	_Buffer,4,2                     ## @Buffer
	.comm	_BufferIn,8,3                   ## @BufferIn
	.comm	_BufferWrite,8,3                ## @BufferWrite
	.comm	_BufferRead,8,3                 ## @BufferRead
.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 InitSound
lCPI0_0:
	.long	1                               ; 0x1
	.long	256                             ; 0x100
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_InitSound
	.p2align	2
_InitSound:                             ; @InitSound
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	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
Lloh0:
	adrp	x8, __sound@GOTPAGE
Lloh1:
	ldr	x8, [x8, __sound@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cbz	w8, LBB0_5
; %bb.1:
	mov	x0, sp
	mov	w1, #0
	mov	w2, #32
	bl	_memset
Lloh3:
	adrp	x8, _SDL_INIT_AUDIO@GOTPAGE
Lloh4:
	ldr	x8, [x8, _SDL_INIT_AUDIO@GOTPAGEOFF]
Lloh5:
	ldr	w0, [x8]
	bl	_SDL_InitSubSystem
	tbnz	x0, #63, LBB0_4
; %bb.2:
Lloh6:
	adrp	x19, _soundrate@GOTPAGE
Lloh7:
	ldr	x19, [x19, _soundrate@GOTPAGEOFF]
	ldr	w8, [x19]
	str	w8, [sp]
Lloh8:
	adrp	x9, _AUDIO_S16SYS@GOTPAGE
Lloh9:
	ldr	x9, [x9, _AUDIO_S16SYS@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
Lloh11:
	adrp	x10, lCPI0_0@PAGE
Lloh12:
	ldr	d0, [x10, lCPI0_0@PAGEOFF]
	stur	d0, [sp, #4]
Lloh13:
	adrp	x10, _fillaudio@GOTPAGE
Lloh14:
	ldr	x10, [x10, _fillaudio@GOTPAGEOFF]
Lloh15:
	ldr	w10, [x10]
	stp	w10, w9, [sp, #24]
	str	xzr, [sp, #16]
Lloh16:
	adrp	x9, _soundbufsize@GOTPAGE
Lloh17:
	ldr	x9, [x9, _soundbufsize@GOTPAGEOFF]
Lloh18:
	ldr	w9, [x9]
	mul	w8, w9, w8
	mov	w9, #19923
	movk	w9, #4194, lsl #16
	smull	x8, w8, w9
	lsr	x9, x8, #63
	asr	x8, x8, #38
	add	w8, w8, w9
	mov	w9, #768
	cmp	w8, #768
	csel	w8, w8, w9, gt
	sub	w8, w8, #512
Lloh19:
	adrp	x9, _BufferSize@GOTPAGE
Lloh20:
	ldr	x9, [x9, _BufferSize@GOTPAGEOFF]
Lloh21:
	str	w8, [x9]
	lsl	w0, w8, #2
	bl	_malloc
Lloh22:
	adrp	x8, _Buffer@GOTPAGE
Lloh23:
	ldr	x8, [x8, _Buffer@GOTPAGEOFF]
Lloh24:
	str	w0, [x8]
Lloh25:
	adrp	x8, _BufferIn@GOTPAGE
Lloh26:
	ldr	x8, [x8, _BufferIn@GOTPAGEOFF]
Lloh27:
	str	xzr, [x8]
Lloh28:
	adrp	x8, _BufferWrite@GOTPAGE
Lloh29:
	ldr	x8, [x8, _BufferWrite@GOTPAGEOFF]
Lloh30:
	str	xzr, [x8]
Lloh31:
	adrp	x8, _BufferRead@GOTPAGE
Lloh32:
	ldr	x8, [x8, _BufferRead@GOTPAGEOFF]
Lloh33:
	str	xzr, [x8]
	mov	x0, sp
	mov	w1, #0
	bl	_SDL_OpenAudio
	tbnz	x0, #63, LBB0_4
; %bb.3:
	mov	w0, #0
	bl	_SDL_PauseAudio
	ldr	w0, [x19]
	bl	_FCEUI_Sound
	mov	w0, #1
	b	LBB0_6
LBB0_4:
	bl	_SDL_GetError
	bl	_puts
	bl	_KillSound
LBB0_5:
	mov	w0, #0
LBB0_6:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotStr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotStr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotStr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotStr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotStr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdrp	Lloh11, Lloh13
	.loh AdrpLdr	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	__sound,4,2                     ; @_sound
	.comm	_SDL_INIT_AUDIO,4,2             ; @SDL_INIT_AUDIO
	.comm	_soundrate,4,2                  ; @soundrate
	.comm	_AUDIO_S16SYS,4,2               ; @AUDIO_S16SYS
	.comm	_fillaudio,4,2                  ; @fillaudio
	.comm	_soundbufsize,4,2               ; @soundbufsize
	.comm	_BufferSize,4,2                 ; @BufferSize
	.comm	_Buffer,4,2                     ; @Buffer
	.comm	_BufferIn,8,3                   ; @BufferIn
	.comm	_BufferWrite,8,3                ; @BufferWrite
	.comm	_BufferRead,8,3                 ; @BufferRead
.subsections_via_symbols
