	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ctr_dsp_audio_write
_ctr_dsp_audio_write:                   ## @ctr_dsp_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
	movq	%rdx, -56(%rbp)                 ## 8-byte Spill
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r14
	movl	16(%rdi), %edi
	callq	_ndspChnGetSamplePos
	movl	(%r14), %r9d
	movl	%eax, %edi
	subl	%r9d, %edi
	movq	_CTR_DSP_AUDIO_COUNT_MASK@GOTPCREL(%rip), %r15
	movl	(%r15), %r8d
	andl	%r8d, %edi
	movq	_CTR_DSP_AUDIO_COUNT@GOTPCREL(%rip), %r12
	movl	(%r12), %edx
	movl	%edx, %esi
	sarl	$2, %esi
	cmpl	%esi, %edi
	jl	LBB0_3
## %bb.1:
	movl	%r9d, %esi
	subl	%eax, %esi
	andl	%r8d, %esi
	movl	%edx, %ebx
	sarl	$4, %ebx
	cmpl	%ebx, %esi
	jl	LBB0_3
## %bb.2:
	movslq	%edi, %rsi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	shrq	$2, %rdi
	cmpq	%rsi, %rdi
	jbe	LBB0_7
LBB0_3:
	cmpq	$0, 24(%r14)
	je	LBB0_4
## %bb.11:
	sarl	%edx
	addl	%eax, %edx
	andl	%r8d, %edx
	movl	%edx, (%r14)
	movl	%edx, %r9d
	jmp	LBB0_7
LBB0_4:
	movq	-56(%rbp), %r13                 ## 8-byte Reload
	shrq	$2, %r13
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movl	$100000, %edi                   ## imm = 0x186A0
	callq	_svcSleepThread
	movl	16(%r14), %edi
	callq	_ndspChnGetSamplePos
	movslq	%eax, %rbx
	movslq	(%r14), %r9
	subq	%r13, %rbx
	subq	%r9, %rbx
	movslq	(%r15), %rdx
	andq	%rdx, %rbx
	movl	(%r12), %edi
	movl	%edi, %esi
	sarl	%esi
	movslq	%esi, %rcx
	cmpq	%rcx, %rbx
	ja	LBB0_5
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	sarl	$4, %edi
	addl	%edi, %eax
	movl	%r9d, %ecx
	subl	%eax, %ecx
	andl	%edx, %ecx
	cmpl	%esi, %ecx
	jg	LBB0_5
LBB0_7:
	shll	$2, %r9d
	movslq	%r9d, %r12
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	leaq	(%r12,%rbx), %r13
	movq	_CTR_DSP_AUDIO_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movq	8(%r14), %rdi
	addq	%r12, %rdi
	cmpq	%rdx, %r13
	jbe	LBB0_9
## %bb.8:
	subq	%r12, %rdx
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	callq	_memcpy
	movq	8(%r14), %rdi
	addq	%r12, %rdi
	movq	_CTR_DSP_AUDIO_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	subq	%r12, %rsi
	callq	_DSP_FlushDataCache
	movq	8(%r14), %rdi
	movq	_CTR_DSP_AUDIO_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	%r13, %rdx
	subq	%rsi, %rdx
	subq	%r12, %rsi
	addq	-48(%rbp), %rsi                 ## 8-byte Folded Reload
	callq	_memcpy
	movq	8(%r14), %rdi
	movq	_CTR_DSP_AUDIO_SIZE@GOTPCREL(%rip), %rax
	subq	(%rax), %r13
	movq	%r13, %rsi
	jmp	LBB0_10
LBB0_9:
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	movq	%rbx, %rdx
	callq	_memcpy
	addq	8(%r14), %r12
	movq	%r12, %rdi
	movq	%rbx, %rsi
LBB0_10:
	callq	_DSP_FlushDataCache
	movq	%rbx, %rax
	shrq	$2, %rax
	addl	(%r14), %eax
	movl	%eax, (%r14)
	andl	(%r15), %eax
	movl	%eax, (%r14)
	movq	%rbx, %rax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CTR_DSP_AUDIO_COUNT_MASK,4,2   ## @CTR_DSP_AUDIO_COUNT_MASK
	.comm	_CTR_DSP_AUDIO_COUNT,4,2        ## @CTR_DSP_AUDIO_COUNT
	.comm	_CTR_DSP_AUDIO_SIZE,8,3         ## @CTR_DSP_AUDIO_SIZE
	.no_dead_strip	_ctr_dsp_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_dsp_audio_write
_ctr_dsp_audio_write:                   ; @ctr_dsp_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
	mov	x19, x2
	mov	x21, x1
	mov	x20, x0
	ldr	w0, [x0, #16]
	bl	_ndspChnGetSamplePos
	ldr	w8, [x20]
Lloh0:
	adrp	x22, _CTR_DSP_AUDIO_COUNT_MASK@GOTPAGE
Lloh1:
	ldr	x22, [x22, _CTR_DSP_AUDIO_COUNT_MASK@GOTPAGEOFF]
	ldr	w9, [x22]
	sub	w10, w0, w8
	and	w11, w10, w9
Lloh2:
	adrp	x24, _CTR_DSP_AUDIO_COUNT@GOTPAGE
Lloh3:
	ldr	x24, [x24, _CTR_DSP_AUDIO_COUNT@GOTPAGEOFF]
	ldr	w10, [x24]
	cmp	w11, w10, asr #2
	lsr	x23, x19, #2
	b.lt	LBB0_3
; %bb.1:
	sub	w12, w8, w0
	and	w12, w12, w9
	cmp	w12, w10, asr #4
	b.lt	LBB0_3
; %bb.2:
	sxtw	x11, w11
	cmp	x11, x19, lsr #2
	b.hs	LBB0_7
LBB0_3:
	ldr	x8, [x20, #24]
	cbz	x8, LBB0_5
; %bb.4:
	add	w8, w0, w10, asr #1
	and	w8, w8, w9
	str	w8, [x20]
	b	LBB0_7
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	mov	w0, #34464
	movk	w0, #1, lsl #16
	bl	_svcSleepThread
	ldr	w0, [x20, #16]
	bl	_ndspChnGetSamplePos
                                        ; kill: def $w0 killed $w0 def $x0
	sxtw	x9, w0
	ldrsw	x8, [x20]
	add	x10, x23, x8
	sub	x10, x9, x10
	ldrsw	x9, [x22]
	and	x12, x10, x9
	ldr	w11, [x24]
	asr	w10, w11, #1
	cmp	x12, w10, sxtw
	b.hi	LBB0_5
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	add	w11, w0, w11, asr #4
	sub	w11, w8, w11
	and	w9, w11, w9
	cmp	w9, w10
	b.gt	LBB0_5
LBB0_7:
	lsl	w8, w8, #2
Lloh4:
	adrp	x24, _CTR_DSP_AUDIO_SIZE@GOTPAGE
Lloh5:
	ldr	x24, [x24, _CTR_DSP_AUDIO_SIZE@GOTPAGEOFF]
	sxtw	x25, w8
	ldr	x8, [x24]
	ldr	x9, [x20, #8]
	add	x0, x9, x25
	add	x26, x25, x19
	cmp	x26, x8
	b.ls	LBB0_9
; %bb.8:
	sub	x2, x8, x25
	mov	x1, x21
	bl	_memcpy
	ldr	x8, [x20, #8]
	add	x0, x8, x25
	ldr	x8, [x24]
	sub	x1, x8, x25
	bl	_DSP_FlushDataCache
	ldr	x0, [x20, #8]
	ldr	x8, [x24]
	sub	x9, x8, x25
	add	x1, x21, x9
	sub	x2, x26, x8
	bl	_memcpy
	ldr	x0, [x20, #8]
	ldr	x8, [x24]
	sub	x1, x26, x8
	b	LBB0_10
LBB0_9:
	mov	x1, x21
	mov	x2, x19
	bl	_memcpy
	ldr	x8, [x20, #8]
	add	x0, x8, x25
	mov	x1, x19
LBB0_10:
	bl	_DSP_FlushDataCache
	ldr	w8, [x20]
	add	w8, w8, w23
	str	w8, [x20]
	ldr	w9, [x22]
	and	w8, w9, w8
	str	w8, [x20]
	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
	.loh AdrpLdrGot	Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_CTR_DSP_AUDIO_COUNT_MASK,4,2   ; @CTR_DSP_AUDIO_COUNT_MASK
	.comm	_CTR_DSP_AUDIO_COUNT,4,2        ; @CTR_DSP_AUDIO_COUNT
	.comm	_CTR_DSP_AUDIO_SIZE,8,3         ; @CTR_DSP_AUDIO_SIZE
	.no_dead_strip	_ctr_dsp_audio_write
.subsections_via_symbols
