	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function libnx_audren_audio_append
_libnx_audren_audio_append:             ## @libnx_audren_audio_append
	.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, %r12
	movq	%rsi, %r15
	movq	%rdi, %r14
	cmpq	$0, 32(%rdi)
	je	LBB0_2
## %bb.1:
	movl	16(%r14), %ecx
	movq	24(%r14), %rax
	movq	(%r14), %r13
	jmp	LBB0_5
LBB0_2:
	movq	%r14, %rdi
	callq	_libnx_audren_audio_get_free_wavebuf_idx
	cmpl	$-1, %eax
	je	LBB0_3
## %bb.4:
	movslq	%eax, %rcx
	shlq	$2, %rcx
	addq	48(%r14), %rcx
	movq	%rcx, 32(%r14)
	movl	16(%r14), %ecx
	imull	%ecx, %eax
	movslq	%eax, %r13
	addq	8(%r14), %r13
	movq	%r13, (%r14)
	movq	$0, 24(%r14)
	xorl	%eax, %eax
LBB0_5:
	movslq	%ecx, %rbx
	subq	%rax, %rbx
	cmpq	%r12, %rbx
	cmovaeq	%r12, %rbx
	addq	%rax, %r13
	movq	%r13, %rdi
	movq	%r15, %rsi
	movq	%rbx, %rdx
	callq	_memcpy
	movq	%r13, %rdi
	movq	%rbx, %rsi
	callq	_armDCacheFlush
	movq	24(%r14), %rax
	addq	%rbx, %rax
	movq	%rax, 24(%r14)
	movslq	16(%r14), %rcx
	cmpq	%rcx, %rax
	jne	LBB0_9
## %bb.6:
	leaq	40(%r14), %r15
	movq	32(%r14), %rdx
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	_audrvVoiceAddWaveBuf
	leaq	44(%r14), %r12
	movq	%r12, %rdi
	callq	_mutexLock
	movq	%r15, %rdi
	callq	_audrvUpdate
	movq	%r12, %rdi
	callq	_mutexUnlock
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	_audrvVoiceIsPlaying
	testl	%eax, %eax
	jne	LBB0_8
## %bb.7:
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	_audrvVoiceStart
LBB0_8:
	movq	$0, 32(%r14)
	jmp	LBB0_9
LBB0_3:
	xorl	%ebx, %ebx
LBB0_9:
	movq	%rbx, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_libnx_audren_audio_append
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function libnx_audren_audio_append
_libnx_audren_audio_append:             ; @libnx_audren_audio_append
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x20, x2
	mov	x21, x1
	mov	x19, x0
	ldr	x8, [x0, #32]
	cbz	x8, LBB0_2
; %bb.1:
	ldr	w9, [x19, #16]
	ldr	x8, [x19, #24]
	ldr	x10, [x19]
	b	LBB0_4
LBB0_2:
	mov	x0, x19
	bl	_libnx_audren_audio_get_free_wavebuf_idx
	cmn	w0, #1
	b.eq	LBB0_8
; %bb.3:
	mov	x8, #0
	ldr	x11, [x19, #48]
	ldr	x10, [x19, #8]
	ldr	w9, [x19, #16]
	mul	w12, w9, w0
	add	x10, x10, w12, sxtw
	str	x10, [x19]
	add	x11, x11, w0, sxtw #2
	stp	xzr, x11, [x19, #24]
LBB0_4:
	sxtw	x9, w9
	sub	x9, x9, x8
	cmp	x9, x20
	csel	x20, x9, x20, lo
	add	x22, x10, x8
	mov	x0, x22
	mov	x1, x21
	mov	x2, x20
	bl	_memcpy
	mov	x0, x22
	mov	x1, x20
	bl	_armDCacheFlush
	ldr	x8, [x19, #24]
	ldrsw	x9, [x19, #16]
	add	x8, x8, x20
	cmp	x8, x9
	str	x8, [x19, #24]
	b.ne	LBB0_9
; %bb.5:
	add	x21, x19, #40
	ldr	x2, [x19, #32]
	mov	x0, x21
	mov	w1, #0
	bl	_audrvVoiceAddWaveBuf
	add	x22, x19, #44
	mov	x0, x22
	bl	_mutexLock
	mov	x0, x21
	bl	_audrvUpdate
	mov	x0, x22
	bl	_mutexUnlock
	mov	x0, x21
	mov	w1, #0
	bl	_audrvVoiceIsPlaying
	cbnz	w0, LBB0_7
; %bb.6:
	mov	x0, x21
	mov	w1, #0
	bl	_audrvVoiceStart
LBB0_7:
	str	xzr, [x19, #32]
	b	LBB0_9
LBB0_8:
	mov	x20, #0
LBB0_9:
	mov	x0, x20
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_libnx_audren_audio_append
.subsections_via_symbols
