	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function CreatePrimaryBuffer
_CreatePrimaryBuffer:                   ## @CreatePrimaryBuffer
	.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
	movq	_PrimaryBufferSize@GOTPCREL(%rip), %rcx
	movq	_GameFreq@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	imulq	(%rcx), %rax
	movq	_speed_factor@GOTPCREL(%rip), %rcx
	imulq	(%rcx), %rax
	movq	_OutputFreq@GOTPCREL(%rip), %rcx
	movslq	(%rcx), %rcx
	imulq	$100, %rcx, %rcx
	movq	%rax, %rdx
	orq	%rcx, %rdx
	shrq	$32, %rdx
	je	LBB0_1
## %bb.2:
	cqto
	idivq	%rcx
	movq	%rax, %rbx
	jmp	LBB0_3
LBB0_1:
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%ecx
	movl	%eax, %ebx
LBB0_3:
	movq	_N64_SAMPLE_BYTES@GOTPCREL(%rip), %rax
	imull	(%rax), %ebx
	movq	_primaryBuffer@GOTPCREL(%rip), %r12
	cmpq	$0, (%r12)
	je	LBB0_4
## %bb.5:
	movq	_primaryBufferBytes@GOTPCREL(%rip), %r13
	cmpl	(%r13), %ebx
	jbe	LBB0_6
## %bb.7:
	movl	%ebx, %edi
	callq	_malloc
	movq	%rax, %r15
	movq	(%r12), %r14
	xorl	%eax, %eax
	callq	_SDL_LockAudio
	movl	(%r13), %edx
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_memcpy
	movl	(%r13), %edi
	movl	%ebx, %edx
	subl	%edi, %edx
	addq	%r15, %rdi
	xorl	%esi, %esi
	callq	_memset
	movq	%r15, (%r12)
	movl	%ebx, (%r13)
	xorl	%eax, %eax
	callq	_SDL_UnlockAudio
	movq	%r14, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_free                           ## TAILCALL
LBB0_4:
	movq	_M64MSG_VERBOSE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	movl	%ebx, %edx
	callq	_DebugMessage
	movl	%ebx, %edi
	callq	_malloc
	movq	%rax, (%r12)
	movq	%rax, %rdi
	xorl	%esi, %esi
	movl	%ebx, %edx
	callq	_memset
	movq	_primaryBufferBytes@GOTPCREL(%rip), %rax
	movl	%ebx, (%rax)
LBB0_6:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PrimaryBufferSize,8,3          ## @PrimaryBufferSize
	.comm	_GameFreq,8,3                   ## @GameFreq
	.comm	_speed_factor,8,3               ## @speed_factor
	.comm	_OutputFreq,4,2                 ## @OutputFreq
	.comm	_N64_SAMPLE_BYTES,4,2           ## @N64_SAMPLE_BYTES
	.comm	_primaryBuffer,8,3              ## @primaryBuffer
	.comm	_M64MSG_VERBOSE,4,2             ## @M64MSG_VERBOSE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Allocating memory for audio buffer: %i bytes."

	.comm	_primaryBufferBytes,4,2         ## @primaryBufferBytes
	.no_dead_strip	_CreatePrimaryBuffer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function CreatePrimaryBuffer
_CreatePrimaryBuffer:                   ; @CreatePrimaryBuffer
	.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
Lloh0:
	adrp	x8, _PrimaryBufferSize@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PrimaryBufferSize@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
Lloh3:
	adrp	x9, _GameFreq@GOTPAGE
Lloh4:
	ldr	x9, [x9, _GameFreq@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	mul	x8, x9, x8
Lloh6:
	adrp	x9, _speed_factor@GOTPAGE
Lloh7:
	ldr	x9, [x9, _speed_factor@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
Lloh9:
	adrp	x10, _OutputFreq@GOTPAGE
Lloh10:
	ldr	x10, [x10, _OutputFreq@GOTPAGEOFF]
	mul	x8, x8, x9
Lloh11:
	ldrsw	x9, [x10]
	mov	w10, #100
	mul	x9, x9, x10
Lloh12:
	adrp	x10, _N64_SAMPLE_BYTES@GOTPAGE
Lloh13:
	ldr	x10, [x10, _N64_SAMPLE_BYTES@GOTPAGEOFF]
	sdiv	x8, x8, x9
Lloh14:
	ldr	w9, [x10]
	mul	w19, w9, w8
Lloh15:
	adrp	x22, _primaryBuffer@GOTPAGE
Lloh16:
	ldr	x22, [x22, _primaryBuffer@GOTPAGEOFF]
	ldr	x8, [x22]
	cbz	x8, LBB0_3
; %bb.1:
Lloh17:
	adrp	x23, _primaryBufferBytes@GOTPAGE
Lloh18:
	ldr	x23, [x23, _primaryBufferBytes@GOTPAGEOFF]
	ldr	w8, [x23]
	cmp	w19, w8
	b.ls	LBB0_4
; %bb.2:
	mov	x0, x19
	bl	_malloc
	mov	x20, x0
	ldr	x21, [x22]
	bl	_SDL_LockAudio
	ldr	w2, [x23]
	mov	x0, x20
	mov	x1, x21
	bl	_memcpy
	ldr	w8, [x23]
	add	x0, x20, x8
	sub	w2, w19, w8
	mov	w1, #0
	bl	_memset
	str	x20, [x22]
	str	w19, [x23]
	bl	_SDL_UnlockAudio
	mov	x0, x21
	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
	b	_free
LBB0_3:
Lloh19:
	adrp	x8, _M64MSG_VERBOSE@GOTPAGE
Lloh20:
	ldr	x8, [x8, _M64MSG_VERBOSE@GOTPAGEOFF]
Lloh21:
	ldr	w0, [x8]
Lloh22:
	adrp	x1, l_.str@PAGE
Lloh23:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x19
	bl	_DebugMessage
	mov	x0, x19
	bl	_malloc
	str	x0, [x22]
	mov	w1, #0
	mov	x2, x19
	bl	_memset
Lloh24:
	adrp	x8, _primaryBufferBytes@GOTPAGE
Lloh25:
	ldr	x8, [x8, _primaryBufferBytes@GOTPAGEOFF]
Lloh26:
	str	w19, [x8]
LBB0_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	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotStr	Lloh24, Lloh25, Lloh26
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_PrimaryBufferSize,8,3          ; @PrimaryBufferSize
	.comm	_GameFreq,8,3                   ; @GameFreq
	.comm	_speed_factor,8,3               ; @speed_factor
	.comm	_OutputFreq,4,2                 ; @OutputFreq
	.comm	_N64_SAMPLE_BYTES,4,2           ; @N64_SAMPLE_BYTES
	.comm	_primaryBuffer,8,3              ; @primaryBuffer
	.comm	_M64MSG_VERBOSE,4,2             ; @M64MSG_VERBOSE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Allocating memory for audio buffer: %i bytes."

	.comm	_primaryBufferBytes,4,2         ; @primaryBufferBytes
	.no_dead_strip	_CreatePrimaryBuffer
.subsections_via_symbols
