	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function psp_audio_write
_psp_audio_write:                       ## @psp_audio_write
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	cmpl	$0, 48(%rdi)
	je	LBB0_1
## %bb.2:
	movq	%rdx, %r14
	movq	%rdi, %rbx
	movq	(%rdi), %r12
	cmpq	$0, 40(%rdi)
	je	LBB0_4
## %bb.3:
	movq	%r12, %rax
	subq	32(%rbx), %rax
	movq	_AUDIO_BUFFER_SIZE@GOTPCREL(%rip), %rcx
	movq	_AUDIO_BUFFER_SIZE_MASK@GOTPCREL(%rip), %rdx
	andq	(%rdx), %rax
	movq	(%rcx), %rcx
	subq	%rax, %rcx
	xorl	%eax, %eax
	cmpq	%r14, %rcx
	jb	LBB0_11
LBB0_4:
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	movl	24(%rbx), %edi
	callq	_slock_lock
	movq	_AUDIO_BUFFER_SIZE@GOTPCREL(%rip), %r15
	movq	(%r15), %rax
	movq	(%rbx), %rcx
	subq	32(%rbx), %rcx
	movq	_AUDIO_BUFFER_SIZE_MASK@GOTPCREL(%rip), %r13
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	andq	(%r13), %rcx
	subq	%rcx, %rax
	cmpq	%r14, %rax
	jae	LBB0_7
## %bb.5:                               ##   in Loop: Header=BB0_6 Depth=1
	movl	24(%rbx), %esi
	movl	28(%rbx), %edi
	callq	_scond_wait
	movq	(%r15), %rax
	movq	(%rbx), %rcx
	subq	32(%rbx), %rcx
	jmp	LBB0_6
LBB0_7:
	movl	24(%rbx), %edi
	callq	_slock_unlock
	movl	8(%rbx), %edi
	callq	_slock_lock
	movq	%r12, %rax
	addq	%r14, %r12
	movq	(%r15), %rdx
	movq	16(%rbx), %rdi
	addq	%rax, %rdi
	cmpq	%rdx, %r12
	jbe	LBB0_9
## %bb.8:
	subq	%rax, %rdx
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	callq	_memcpy
	movq	16(%rbx), %rdi
	movq	(%r15), %rsi
	movq	%r12, %rdx
	subq	%rsi, %rdx
	subq	-56(%rbp), %rsi                 ## 8-byte Folded Reload
	addq	-48(%rbp), %rsi                 ## 8-byte Folded Reload
	jmp	LBB0_10
LBB0_1:
	movl	$-1, %eax
	jmp	LBB0_11
LBB0_9:
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	movq	%r14, %rdx
LBB0_10:
	callq	_memcpy
	andq	(%r13), %r12
	movq	%r12, (%rbx)
	movl	8(%rbx), %edi
	callq	_slock_unlock
	movl	%r14d, %eax
LBB0_11:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AUDIO_BUFFER_SIZE,8,3          ## @AUDIO_BUFFER_SIZE
	.comm	_AUDIO_BUFFER_SIZE_MASK,8,3     ## @AUDIO_BUFFER_SIZE_MASK
	.no_dead_strip	_psp_audio_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function psp_audio_write
_psp_audio_write:                       ; @psp_audio_write
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	ldr	w8, [x0, #48]
	cbz	w8, LBB0_9
; %bb.1:
	mov	x19, x2
	mov	x21, x1
	mov	x20, x0
	ldr	x23, [x0]
	ldr	x8, [x0, #40]
Lloh0:
	adrp	x24, _AUDIO_BUFFER_SIZE@GOTPAGE
Lloh1:
	ldr	x24, [x24, _AUDIO_BUFFER_SIZE@GOTPAGEOFF]
Lloh2:
	adrp	x22, _AUDIO_BUFFER_SIZE_MASK@GOTPAGE
Lloh3:
	ldr	x22, [x22, _AUDIO_BUFFER_SIZE_MASK@GOTPAGEOFF]
	cbz	x8, LBB0_4
; %bb.2:
	ldr	x8, [x24]
	ldr	x9, [x20, #32]
	ldr	x10, [x22]
	sub	x9, x23, x9
	and	x9, x9, x10
	sub	x8, x8, x9
	cmp	x8, x19
	b.hs	LBB0_4
; %bb.3:
	mov	w19, #0
	b	LBB0_12
LBB0_4:
	ldr	w0, [x20, #24]
	bl	_slock_lock
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x24]
	ldr	x9, [x20]
	ldr	x10, [x20, #32]
	ldr	x11, [x22]
	sub	x9, x9, x10
	and	x9, x9, x11
	sub	x8, x8, x9
	cmp	x8, x19
	b.hs	LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	ldp	w1, w0, [x20, #24]
	bl	_scond_wait
	b	LBB0_5
LBB0_7:
	ldr	w0, [x20, #24]
	bl	_slock_unlock
	ldr	w0, [x20, #8]
	bl	_slock_lock
	ldr	x8, [x24]
	ldr	x9, [x20, #16]
	add	x0, x9, x23
	add	x25, x23, x19
	cmp	x25, x8
	b.ls	LBB0_10
; %bb.8:
	sub	x2, x8, x23
	mov	x1, x21
	bl	_memcpy
	ldr	x0, [x20, #16]
	ldr	x8, [x24]
	sub	x9, x8, x23
	add	x1, x21, x9
	sub	x2, x25, x8
	b	LBB0_11
LBB0_9:
	mov	w19, #-1
	b	LBB0_12
LBB0_10:
	mov	x1, x21
	mov	x2, x19
LBB0_11:
	bl	_memcpy
	ldr	x8, [x22]
	and	x8, x8, x25
	str	x8, [x20]
	ldr	w0, [x20, #8]
	bl	_slock_unlock
LBB0_12:
	mov	x0, x19
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_AUDIO_BUFFER_SIZE,8,3          ; @AUDIO_BUFFER_SIZE
	.comm	_AUDIO_BUFFER_SIZE_MASK,8,3     ; @AUDIO_BUFFER_SIZE_MASK
	.no_dead_strip	_psp_audio_write
.subsections_via_symbols
