	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ctr_csnd_audio_write
_ctr_csnd_audio_write:                  ## @ctr_csnd_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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, -48(%rbp)                 ## 8-byte Spill
	movq	%rsi, %r15
	movq	%rdi, %r14
	callq	_ctr_csnd_audio_update_playpos
	movl	(%r14), %r8d
	movl	4(%r14), %eax
	movl	%r8d, %edi
	subl	%eax, %edi
	movq	_CTR_CSND_AUDIO_COUNT_MASK@GOTPCREL(%rip), %r12
	movl	(%r12), %r9d
	andl	%r9d, %edi
	movq	_CTR_CSND_AUDIO_COUNT@GOTPCREL(%rip), %r13
	movl	(%r13), %edx
	movl	%edx, %esi
	sarl	$2, %esi
	cmpl	%esi, %edi
	jl	LBB0_3
## %bb.1:
	movl	%eax, %esi
	subl	%r8d, %esi
	andl	%r9d, %esi
	movl	%edx, %ecx
	sarl	$4, %ecx
	cmpl	%ecx, %esi
	jl	LBB0_3
## %bb.2:
	movslq	%edi, %rcx
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	shrq	$2, %rsi
	cmpq	%rcx, %rsi
	jbe	LBB0_7
LBB0_3:
	cmpq	$0, 24(%r14)
	je	LBB0_5
## %bb.4:
	sarl	%edx
	addl	%r8d, %edx
	andl	%r9d, %edx
	movl	%edx, 4(%r14)
	movl	%edx, %eax
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movl	$1, %edi
	callq	_retro_sleep
	movq	%r14, %rdi
	callq	_ctr_csnd_audio_update_playpos
	movl	(%r14), %ecx
	movl	4(%r14), %eax
	movl	%ecx, %edi
	subl	%eax, %edi
	movl	(%r12), %edx
	andl	%edx, %edi
	movl	(%r13), %ebx
	movl	%ebx, %esi
	sarl	%esi
	cmpl	%esi, %edi
	jl	LBB0_5
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	%eax, %esi
	subl	%ecx, %esi
	andl	%edx, %esi
	sarl	$4, %ebx
	cmpl	%ebx, %esi
	jl	LBB0_5
LBB0_7:
	movq	16(%r14), %rdi
	movq	-48(%rbp), %r13                 ## 8-byte Reload
	cmpq	$2, %r13
	jb	LBB0_10
## %bb.8:
	movq	%r13, %rcx
	shrq	%rcx
	movq	8(%r14), %rdx
	xorl	%esi, %esi
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r15,%rsi,4), %ebx
	cltq
	movl	%ebx, (%rdi,%rax,4)
	movl	4(%r15,%rsi,4), %eax
	movslq	4(%r14), %rbx
	movl	%eax, (%rdx,%rbx,4)
	movl	4(%r14), %eax
	incl	%eax
	andl	(%r12), %eax
	movl	%eax, 4(%r14)
	addq	$2, %rsi
	cmpq	%rsi, %rcx
	ja	LBB0_9
LBB0_10:
	movq	_CTR_CSND_AUDIO_SIZE@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	callq	_GSPGPU_FlushDataCache
	movq	8(%r14), %rdi
	movl	(%rbx), %esi
	callq	_GSPGPU_FlushDataCache
	movq	%r13, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CTR_CSND_AUDIO_COUNT_MASK,4,2  ## @CTR_CSND_AUDIO_COUNT_MASK
	.comm	_CTR_CSND_AUDIO_COUNT,4,2       ## @CTR_CSND_AUDIO_COUNT
	.comm	_CTR_CSND_AUDIO_SIZE,4,2        ## @CTR_CSND_AUDIO_SIZE
	.no_dead_strip	_ctr_csnd_audio_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ctr_csnd_audio_write
_ctr_csnd_audio_write:                  ; @ctr_csnd_audio_write
	.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
	mov	x19, x2
	mov	x21, x1
	mov	x20, x0
	bl	_ctr_csnd_audio_update_playpos
	ldp	w9, w8, [x20]
Lloh0:
	adrp	x22, _CTR_CSND_AUDIO_COUNT_MASK@GOTPAGE
Lloh1:
	ldr	x22, [x22, _CTR_CSND_AUDIO_COUNT_MASK@GOTPAGEOFF]
	ldr	w10, [x22]
	sub	w11, w9, w8
	and	w12, w11, w10
Lloh2:
	adrp	x23, _CTR_CSND_AUDIO_COUNT@GOTPAGE
Lloh3:
	ldr	x23, [x23, _CTR_CSND_AUDIO_COUNT@GOTPAGEOFF]
	ldr	w11, [x23]
	cmp	w12, w11, asr #2
	b.lt	LBB0_3
; %bb.1:
	sub	w13, w8, w9
	and	w13, w13, w10
	cmp	w13, w11, asr #4
	b.lt	LBB0_3
; %bb.2:
	sxtw	x12, w12
	cmp	x12, x19, lsr #2
	b.hs	LBB0_7
LBB0_3:
	ldr	x8, [x20, #24]
	cbz	x8, LBB0_5
; %bb.4:
	add	w8, w9, w11, asr #1
	and	w8, w8, w10
	str	w8, [x20, #4]
	b	LBB0_7
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	mov	w0, #1
	bl	_retro_sleep
	mov	x0, x20
	bl	_ctr_csnd_audio_update_playpos
	ldp	w9, w8, [x20]
	ldr	w10, [x22]
	sub	w11, w9, w8
	and	w12, w11, w10
	ldr	w11, [x23]
	cmp	w12, w11, asr #1
	b.lt	LBB0_5
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	sub	w9, w8, w9
	and	w9, w9, w10
	cmp	w9, w11, asr #4
	b.lt	LBB0_5
LBB0_7:
	ldr	x0, [x20, #16]
	cmp	x19, #2
	b.lo	LBB0_10
; %bb.8:
	mov	x9, #0
	lsr	x10, x19, #1
	ldr	x11, [x20, #8]
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	add	x12, x21, x9, lsl #2
	ldr	w13, [x12]
	str	w13, [x0, w8, sxtw #2]
	ldr	w8, [x12, #4]
	ldrsw	x12, [x20, #4]
	str	w8, [x11, x12, lsl #2]
	ldr	w8, [x20, #4]
	add	w8, w8, #1
	ldr	w12, [x22]
	and	w8, w12, w8
	str	w8, [x20, #4]
	add	x9, x9, #2
	cmp	x10, x9
	b.hi	LBB0_9
LBB0_10:
Lloh4:
	adrp	x21, _CTR_CSND_AUDIO_SIZE@GOTPAGE
Lloh5:
	ldr	x21, [x21, _CTR_CSND_AUDIO_SIZE@GOTPAGEOFF]
	ldr	w1, [x21]
	bl	_GSPGPU_FlushDataCache
	ldr	x0, [x20, #8]
	ldr	w1, [x21]
	bl	_GSPGPU_FlushDataCache
	mov	x0, x19
	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	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_CTR_CSND_AUDIO_COUNT_MASK,4,2  ; @CTR_CSND_AUDIO_COUNT_MASK
	.comm	_CTR_CSND_AUDIO_COUNT,4,2       ; @CTR_CSND_AUDIO_COUNT
	.comm	_CTR_CSND_AUDIO_SIZE,4,2        ; @CTR_CSND_AUDIO_SIZE
	.no_dead_strip	_ctr_csnd_audio_write
.subsections_via_symbols
