	.file	"extr_emu.c_writeSound.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"snd oflow %i!\n"
	.text
	.p2align 4
	.type	writeSound, @function
writeSound:
.LFB0:
	.cfi_startproc
	endbr64
	mov	eax, edi
	push	rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	shr	eax, 31
	lea	ebx, [rax+rdi]
	mov	rax, QWORD PTR sndBuffer_endptr[rip]
	sar	ebx
	movsx	rsi, ebx
	add	rsi, QWORD PTR PsndOut[rip]
	mov	QWORD PTR PsndOut[rip], rsi
	cmp	rsi, rax
	jg	.L7
.L2:
	cmp	rsi, rax
	jl	.L3
	mov	rax, QWORD PTR sndBuffer[rip]
	mov	QWORD PTR PsndOut[rip], rax
.L3:
	mov	eax, DWORD PTR samples_block[rip]
	add	ebx, DWORD PTR samples_made[rip]
	mov	DWORD PTR samples_made[rip], ebx
	sub	ebx, DWORD PTR samples_done[rip]
	add	eax, eax
	cmp	ebx, eax
	jg	.L8
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	.cfi_restore_state
	sub	rsi, rax
	lea	rdi, .LC0[rip]
	call	lprintf@PLT
	mov	rsi, QWORD PTR PsndOut[rip]
	mov	rax, QWORD PTR sndBuffer_endptr[rip]
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L8:
	mov	edi, DWORD PTR sound_sem[rip]
	mov	esi, 1
	pop	rbx
	.cfi_def_cfa_offset 8
	jmp	sceKernelSignalSema@PLT
	.cfi_endproc
.LFE0:
	.size	writeSound, .-writeSound
	.comm	sound_sem,4,4
	.comm	sndBuffer_endptr,8,8
	.comm	sndBuffer,8,8
	.comm	samples_made,4,4
	.comm	samples_done,4,4
	.comm	samples_block,4,4
	.comm	PsndOut,8,8
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_emu.c_writeSound.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"snd oflow %i!\012\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	writeSound, %function
writeSound:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, lr}
	ldr	r5, .L8
	ldr	r6, .L8+4
	ldr	r3, [r5]
	add	r0, r0, r0, lsr #31
	ldr	r1, [r6]
	add	r3, r3, r0, asr #1
	cmp	r3, r1
	str	r3, [r5]
	asr	r4, r0, #1
	bgt	.L7
.L2:
	cmp	r3, r1
	ldrge	r3, .L8+8
	ldr	r2, .L8+12
	ldrge	r3, [r3]
	ldr	r0, [r2]
	strge	r3, [r5]
	ldr	r3, .L8+16
	ldr	r1, .L8+20
	ldr	r3, [r3]
	add	r0, r4, r0
	ldr	r1, [r1]
	sub	r3, r0, r3
	cmp	r3, r1, lsl #1
	str	r0, [r2]
	pople	{r4, r5, r6, pc}
	ldr	r3, .L8+24
	mov	r1, #1
	pop	{r4, r5, r6, lr}
	ldr	r0, [r3]
	b	sceKernelSignalSema
.L7:
	sub	r1, r3, r1
	ldr	r0, .L8+28
	bl	lprintf
	ldr	r1, [r6]
	ldr	r3, [r5]
	b	.L2
.L9:
	.align	2
.L8:
	.word	PsndOut
	.word	sndBuffer_endptr
	.word	sndBuffer
	.word	samples_made
	.word	samples_done
	.word	samples_block
	.word	sound_sem
	.word	.LC0
	.size	writeSound, .-writeSound
	.comm	sound_sem,4,4
	.comm	sndBuffer_endptr,4,4
	.comm	sndBuffer,4,4
	.comm	samples_made,4,4
	.comm	samples_done,4,4
	.comm	samples_block,4,4
	.comm	PsndOut,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
