	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sound_thread
_sound_thread:                          ## @sound_thread
	.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
	xorl	%eax, %eax
	callq	_sceKernelGetThreadCurrentPriority
	leaq	L_.str(%rip), %rdi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	_lprintf
	movq	_sound_thread_exit@GOTPCREL(%rip), %r12
	cmpl	$0, (%r12)
	je	LBB0_1
LBB0_9:
	leaq	L_.str.3(%rip), %rdi
	xorl	%eax, %eax
	callq	_lprintf
	xorl	%edi, %edi
	callq	_sceKernelExitDeleteThread
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	movq	_samples_made@GOTPCREL(%rip), %r13
	movq	_samples_done@GOTPCREL(%rip), %r14
	movq	_samples_block@GOTPCREL(%rip), %r15
	xorl	%ebx, %ebx
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_2 Depth=1
	testl	%ebx, %ebx
	js	LBB0_7
LBB0_8:                                 ##   in Loop: Header=BB0_2 Depth=1
	cmpl	$0, (%r12)
	jne	LBB0_9
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_4 Depth 2
	movl	(%r13), %eax
	subl	(%r14), %eax
	movl	(%r15), %ecx
	cmpl	%ecx, %eax
	jge	LBB0_10
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	addl	%ecx, %ecx
	cmpl	%ecx, %eax
	jg	LBB0_6
	.p2align	4, 0x90
LBB0_4:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	_sound_sem@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	$1, %esi
	xorl	%edx, %edx
	callq	_sceKernelWaitSema
	movl	(%r13), %ecx
	subl	(%r14), %ecx
	movl	%eax, %ebx
	movl	(%r15), %eax
	addl	%eax, %eax
	cmpl	%eax, %ecx
	jg	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=2
	cmpl	$0, (%r12)
	je	LBB0_4
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	_PSP_AUDIO_VOLUME_MAX@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_snd_playptr@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	callq	_sceAudio_E0727056
	movl	%eax, %ebx
	movslq	(%r15), %rax
	movl	(%r14), %edx
	addl	%eax, %edx
	movq	%rax, %rcx
	movq	_snd_playptr@GOTPCREL(%rip), %rsi
	addq	(%rsi), %rcx
	movl	%edx, (%r14)
	movq	%rcx, (%rsi)
	movq	_sndBuffer_endptr@GOTPCREL(%rip), %rsi
	cmpq	(%rsi), %rcx
	jl	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	_sndBuffer@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	_snd_playptr@GOTPCREL(%rip), %rsi
	movq	%rcx, (%rsi)
LBB0_12:                                ##   in Loop: Header=BB0_2 Depth=1
	testl	%ebx, %ebx
	jns	LBB0_14
## %bb.13:                              ##   in Loop: Header=BB0_2 Depth=1
	movl	(%r13), %ecx
	leaq	L_.str.2(%rip), %rdi
	movl	%ebx, %esi
	xorl	%eax, %eax
	callq	_lprintf
	movl	(%r14), %edx
	movl	(%r15), %eax
LBB0_14:                                ##   in Loop: Header=BB0_2 Depth=1
	movl	(%r13), %ecx
	subl	%edx, %ecx
	leal	(%rax,%rax,2), %esi
	cmpl	%esi, %ecx
	jl	LBB0_8
## %bb.15:                              ##   in Loop: Header=BB0_2 Depth=1
	addl	%eax, %edx
	movl	%edx, (%r14)
	cltq
	movq	_snd_playptr@GOTPCREL(%rip), %rcx
	addq	%rax, (%rcx)
	jmp	LBB0_8
LBB0_7:                                 ##   in Loop: Header=BB0_2 Depth=1
	leaq	L_.str.1(%rip), %rdi
	movl	%ebx, %esi
	xorl	%eax, %eax
	callq	_lprintf
	jmp	LBB0_8
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"sthr: started, priority %i\n"

	.comm	_sound_thread_exit,4,2          ## @sound_thread_exit
	.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
L_.str.1:                               ## @.str.1
	.asciz	"sthr: sceKernelWaitSema: %i\n"

	.comm	_PSP_AUDIO_VOLUME_MAX,4,2       ## @PSP_AUDIO_VOLUME_MAX
	.comm	_snd_playptr,8,3                ## @snd_playptr
	.comm	_sndBuffer_endptr,8,3           ## @sndBuffer_endptr
	.comm	_sndBuffer,8,3                  ## @sndBuffer
L_.str.2:                               ## @.str.2
	.asciz	"sthr: sceAudio_E0727056: %08x; pos %i/%i\n"

L_.str.3:                               ## @.str.3
	.asciz	"sthr: exit\n"

	.no_dead_strip	_sound_thread
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sound_thread
_sound_thread:                          ; @sound_thread
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	bl	_sceKernelGetThreadCurrentPriority
                                        ; kill: def $w0 killed $w0 def $x0
	str	x0, [sp]
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_lprintf
Lloh2:
	adrp	x22, _sound_thread_exit@GOTPAGE
Lloh3:
	ldr	x22, [x22, _sound_thread_exit@GOTPAGEOFF]
	ldr	w8, [x22]
	cbz	w8, LBB0_2
LBB0_1:
Lloh4:
	adrp	x0, l_.str.3@PAGE
Lloh5:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_lprintf
	mov	w0, #0
	bl	_sceKernelExitDeleteThread
	mov	w0, #0
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_2:
	mov	w21, #0
Lloh6:
	adrp	x23, _samples_made@GOTPAGE
Lloh7:
	ldr	x23, [x23, _samples_made@GOTPAGEOFF]
Lloh8:
	adrp	x24, _samples_done@GOTPAGE
Lloh9:
	ldr	x24, [x24, _samples_done@GOTPAGEOFF]
Lloh10:
	adrp	x25, _samples_block@GOTPAGE
Lloh11:
	ldr	x25, [x25, _samples_block@GOTPAGEOFF]
Lloh12:
	adrp	x26, _sound_sem@GOTPAGE
Lloh13:
	ldr	x26, [x26, _sound_sem@GOTPAGEOFF]
Lloh14:
	adrp	x27, _PSP_AUDIO_VOLUME_MAX@GOTPAGE
Lloh15:
	ldr	x27, [x27, _PSP_AUDIO_VOLUME_MAX@GOTPAGEOFF]
Lloh16:
	adrp	x28, _snd_playptr@GOTPAGE
Lloh17:
	ldr	x28, [x28, _snd_playptr@GOTPAGEOFF]
Lloh18:
	adrp	x19, _sndBuffer_endptr@GOTPAGE
Lloh19:
	ldr	x19, [x19, _sndBuffer_endptr@GOTPAGEOFF]
Lloh20:
	adrp	x20, _sndBuffer@GOTPAGE
Lloh21:
	ldr	x20, [x20, _sndBuffer@GOTPAGEOFF]
	b	LBB0_5
LBB0_3:                                 ;   in Loop: Header=BB0_5 Depth=1
	tbnz	w21, #31, LBB0_15
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	ldr	w8, [x22]
	cbnz	w8, LBB0_1
LBB0_5:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_7 Depth 2
	ldr	w9, [x23]
	ldr	w10, [x24]
	ldr	w8, [x25]
	sub	w9, w9, w10
	cmp	w9, w8
	b.ge	LBB0_9
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	cmp	w9, w8, lsl #1
	b.gt	LBB0_3
LBB0_7:                                 ;   Parent Loop BB0_5 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w0, [x26]
	mov	w1, #1
	mov	w2, #0
	bl	_sceKernelWaitSema
	ldr	w8, [x23]
	ldr	w9, [x24]
	sub	w8, w8, w9
	ldr	w9, [x25]
	ldr	w10, [x22]
	cmp	w8, w9, lsl #1
	ccmp	w10, #0, #0, le
	b.eq	LBB0_7
; %bb.8:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x21, x0
	b	LBB0_3
LBB0_9:                                 ;   in Loop: Header=BB0_5 Depth=1
	ldr	w0, [x27]
	ldr	x1, [x28]
	bl	_sceAudio_E0727056
	mov	x21, x0
	ldrsw	x9, [x25]
	ldr	w8, [x24]
	add	w8, w8, w9
	str	w8, [x24]
	ldr	x10, [x28]
	ldr	x11, [x19]
	add	x10, x10, x9
	cmp	x10, x11
	str	x10, [x28]
	b.lt	LBB0_11
; %bb.10:                               ;   in Loop: Header=BB0_5 Depth=1
	ldr	x10, [x20]
	str	x10, [x28]
LBB0_11:                                ;   in Loop: Header=BB0_5 Depth=1
	tbz	w21, #31, LBB0_13
; %bb.12:                               ;   in Loop: Header=BB0_5 Depth=1
	ldr	w9, [x23]
	stp	x8, x9, [sp, #8]
	mov	x9, x21
	str	x9, [sp]
Lloh22:
	adrp	x0, l_.str.2@PAGE
Lloh23:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_lprintf
	ldr	w8, [x24]
	ldr	w9, [x25]
LBB0_13:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	w10, [x23]
	add	w11, w9, w9, lsl #1
	sub	w10, w10, w8
	cmp	w10, w11
	b.lt	LBB0_4
; %bb.14:                               ;   in Loop: Header=BB0_5 Depth=1
	add	w8, w9, w8
	str	w8, [x24]
	ldr	x8, [x28]
	add	x8, x8, w9, sxtw
	str	x8, [x28]
	b	LBB0_4
LBB0_15:                                ;   in Loop: Header=BB0_5 Depth=1
	str	x21, [sp]
Lloh24:
	adrp	x0, l_.str.1@PAGE
Lloh25:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_lprintf
	b	LBB0_4
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpAdd	Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"sthr: started, priority %i\n"

	.comm	_sound_thread_exit,4,2          ; @sound_thread_exit
	.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
l_.str.1:                               ; @.str.1
	.asciz	"sthr: sceKernelWaitSema: %i\n"

	.comm	_PSP_AUDIO_VOLUME_MAX,4,2       ; @PSP_AUDIO_VOLUME_MAX
	.comm	_snd_playptr,8,3                ; @snd_playptr
	.comm	_sndBuffer_endptr,8,3           ; @sndBuffer_endptr
	.comm	_sndBuffer,8,3                  ; @sndBuffer
l_.str.2:                               ; @.str.2
	.asciz	"sthr: sceAudio_E0727056: %08x; pos %i/%i\n"

l_.str.3:                               ; @.str.3
	.asciz	"sthr: exit\n"

	.no_dead_strip	_sound_thread
.subsections_via_symbols
