	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function writeSound
_writeSound:                            ## @writeSound
	.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
	movl	%edi, %ebx
	shrl	$31, %ebx
	addl	%edi, %ebx
	sarl	%ebx
	movslq	%ebx, %rax
	movq	_PsndOut@GOTPCREL(%rip), %r14
	addq	(%r14), %rax
	movq	%rax, (%r14)
	movq	_sndBuffer_endptr@GOTPCREL(%rip), %r15
	movq	(%r15), %rcx
	movq	%rax, %rsi
	subq	%rcx, %rsi
	jle	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rdi
	callq	_lprintf
	movq	(%r14), %rax
	movq	(%r15), %rcx
LBB0_2:
	cmpq	%rcx, %rax
	jl	LBB0_4
## %bb.3:
	movq	_sndBuffer@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, (%r14)
LBB0_4:
	movq	_samples_made@GOTPCREL(%rip), %rax
	addl	(%rax), %ebx
	movl	%ebx, (%rax)
	movq	_samples_done@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	movq	_samples_block@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%eax, %eax
	cmpl	%eax, %ebx
	jle	LBB0_5
## %bb.6:
	movq	_sound_sem@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	$1, %esi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_sceKernelSignalSema            ## TAILCALL
LBB0_5:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PsndOut,8,3                    ## @PsndOut
	.comm	_sndBuffer_endptr,8,3           ## @sndBuffer_endptr
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"snd oflow %i!\n"

	.comm	_sndBuffer,8,3                  ## @sndBuffer
	.comm	_samples_made,4,2               ## @samples_made
	.comm	_samples_done,4,2               ## @samples_done
	.comm	_samples_block,4,2              ## @samples_block
	.comm	_sound_sem,4,2                  ## @sound_sem
	.no_dead_strip	_writeSound
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function writeSound
_writeSound:                            ; @writeSound
	.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	w0, #0
	cinc	w8, w0, lt
	asr	w19, w8, #1
Lloh0:
	adrp	x20, _PsndOut@GOTPAGE
Lloh1:
	ldr	x20, [x20, _PsndOut@GOTPAGEOFF]
	ldr	x8, [x20]
	add	x8, x8, w19, sxtw
	str	x8, [x20]
Lloh2:
	adrp	x21, _sndBuffer_endptr@GOTPAGE
Lloh3:
	ldr	x21, [x21, _sndBuffer_endptr@GOTPAGEOFF]
	ldr	x9, [x21]
	subs	x1, x8, x9
	b.le	LBB0_2
; %bb.1:
Lloh4:
	adrp	x0, l_.str@PAGE
Lloh5:
	add	x0, x0, l_.str@PAGEOFF
	bl	_lprintf
	ldr	x8, [x20]
	ldr	x9, [x21]
LBB0_2:
	cmp	x8, x9
	b.lt	LBB0_4
; %bb.3:
Lloh6:
	adrp	x8, _sndBuffer@GOTPAGE
Lloh7:
	ldr	x8, [x8, _sndBuffer@GOTPAGEOFF]
Lloh8:
	ldr	x8, [x8]
	str	x8, [x20]
LBB0_4:
Lloh9:
	adrp	x8, _samples_made@GOTPAGE
Lloh10:
	ldr	x8, [x8, _samples_made@GOTPAGEOFF]
	ldr	w9, [x8]
Lloh11:
	adrp	x10, _samples_done@GOTPAGE
Lloh12:
	ldr	x10, [x10, _samples_done@GOTPAGEOFF]
Lloh13:
	ldr	w10, [x10]
	add	w9, w9, w19
	sub	w10, w9, w10
	str	w9, [x8]
Lloh14:
	adrp	x8, _samples_block@GOTPAGE
Lloh15:
	ldr	x8, [x8, _samples_block@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	cmp	w10, w8, lsl #1
	b.le	LBB0_6
; %bb.5:
Lloh17:
	adrp	x8, _sound_sem@GOTPAGE
Lloh18:
	ldr	x8, [x8, _sound_sem@GOTPAGEOFF]
Lloh19:
	ldr	w0, [x8]
	mov	w1, #1
	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	_sceKernelSignalSema
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
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_PsndOut,8,3                    ; @PsndOut
	.comm	_sndBuffer_endptr,8,3           ; @sndBuffer_endptr
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"snd oflow %i!\n"

	.comm	_sndBuffer,8,3                  ; @sndBuffer
	.comm	_samples_made,4,2               ; @samples_made
	.comm	_samples_done,4,2               ; @samples_done
	.comm	_samples_block,4,2              ; @samples_block
	.comm	_sound_sem,4,2                  ; @sound_sem
	.no_dead_strip	_writeSound
.subsections_via_symbols
