	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function switch_audio_write
_switch_audio_write:                    ## @switch_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
	testq	%rdi, %rdi
	je	LBB0_11
## %bb.1:
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %rbx
	cmpq	$0, 8(%rdi)
	je	LBB0_9
LBB0_2:
	xorl	%edi, %edi
	callq	_switch_audio_buffer_size
	movq	8(%rbx), %rcx
	movslq	(%rcx), %rdi
	subq	%rdi, %rax
	cmpq	%r14, %rax
	jae	LBB0_4
## %bb.3:
	xorl	%edi, %edi
	callq	_switch_audio_buffer_size
	movq	%rax, %r14
	movq	8(%rbx), %rcx
	movslq	(%rcx), %rdi
	subq	%rdi, %r14
LBB0_4:
	shlq	$2, %rdi
	addq	24(%rcx), %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	_memcpy
	movq	8(%rbx), %rax
	addl	%r14d, (%rax)
	xorl	%edi, %edi
	callq	_switch_audio_buffer_size
	movq	8(%rbx), %rsi
	movq	%rax, 8(%rsi)
	movl	(%rbx), %eax
	shll	$4, %eax
	leal	(%rax,%rax,2), %eax
	cmpl	%eax, (%rsi)
	jle	LBB0_7
## %bb.5:
	movq	%rbx, %rdi
	callq	_switch_audio_ipc_output_append_buffer
	movl	$-1, %r12d
	testq	%rax, %rax
	jne	LBB0_12
## %bb.6:
	movq	$0, 8(%rbx)
LBB0_7:
	xorl	%eax, %eax
	callq	_svcGetSystemTick
	movl	%eax, 4(%rbx)
	movl	%r14d, %r12d
	jmp	LBB0_12
LBB0_9:
	xorl	%r12d, %r12d
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_switch_audio_ipc_output_get_released_buffer
	testq	%rax, %rax
	je	LBB0_13
## %bb.10:
	leaq	L_.str(%rip), %rdi
	callq	_RARCH_LOG
LBB0_11:
	movl	$-1, %r12d
LBB0_12:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_13:
	movq	$0, 8(%rbx)
	cmpq	$0, 24(%rbx)
	je	LBB0_12
## %bb.14:
	leaq	16(%rbx), %r12
	leaq	-44(%rbp), %r13
	.p2align	4, 0x90
LBB0_15:                                ## =>This Inner Loop Header: Depth=1
	movl	$0, -44(%rbp)
	movq	%r13, %rdi
	movq	%r12, %rsi
	movl	$1, %edx
	movl	$33333333, %ecx                 ## imm = 0x1FCA055
	callq	_svcWaitSynchronization
	movl	16(%rbx), %edi
	callq	_svcResetSignal
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_switch_audio_ipc_output_get_released_buffer
	testq	%rax, %rax
	jne	LBB0_11
## %bb.16:                              ##   in Loop: Header=BB0_15 Depth=1
	movq	8(%rbx), %rax
	testq	%rax, %rax
	je	LBB0_15
## %bb.17:
	movl	$0, (%rax)
	jmp	LBB0_2
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to get released buffer?\n"

	.comm	_U64_MAX,4,2                    ## @U64_MAX
	.no_dead_strip	_switch_audio_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function switch_audio_write
_switch_audio_write:                    ; @switch_audio_write
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	cbz	x0, LBB0_6
; %bb.1:
	mov	x19, x2
	mov	x21, x1
	mov	x20, x0
	ldr	x8, [x0, #8]
	cbz	x8, LBB0_7
LBB0_2:
	mov	x0, #0
	bl	_switch_audio_buffer_size
	ldr	x8, [x20, #8]
	ldrsw	x9, [x8]
	sub	x10, x0, x9
	cmp	x10, x19
	b.hs	LBB0_4
; %bb.3:
	mov	x0, #0
	bl	_switch_audio_buffer_size
	ldr	x8, [x20, #8]
	ldrsw	x9, [x8]
	sub	x19, x0, x9
LBB0_4:
	ldr	x8, [x8, #24]
	add	x0, x8, x9, lsl #2
	mov	x1, x21
	mov	x2, x19
	bl	_memcpy
	ldr	x8, [x20, #8]
	ldr	w9, [x8]
	add	w9, w9, w19
	str	w9, [x8]
	mov	x0, #0
	bl	_switch_audio_buffer_size
	ldr	x1, [x20, #8]
	str	x0, [x1, #8]
	ldr	w8, [x1]
	ldr	w9, [x20]
	add	w9, w9, w9, lsl #1
	cmp	w8, w9, lsl #4
	b.le	LBB0_15
; %bb.5:
	mov	x0, x20
	bl	_switch_audio_ipc_output_append_buffer
	cbz	x0, LBB0_14
LBB0_6:
	mov	w19, #-1
	b	LBB0_16
LBB0_7:
	mov	x0, x20
	mov	w1, #0
	bl	_switch_audio_ipc_output_get_released_buffer
	cbz	x0, LBB0_9
; %bb.8:
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_RARCH_LOG
	mov	w19, #-1
	b	LBB0_16
LBB0_9:
	str	xzr, [x20, #8]
	ldr	x8, [x20, #24]
	cbz	x8, LBB0_17
; %bb.10:
	add	x22, x20, #16
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	str	wzr, [sp, #12]
	add	x0, sp, #12
	mov	x1, x22
	mov	w2, #1
	mov	w3, #41045
	movk	w3, #508, lsl #16
	bl	_svcWaitSynchronization
	ldr	w0, [x20, #16]
	bl	_svcResetSignal
	mov	x0, x20
	mov	w1, #0
	bl	_switch_audio_ipc_output_get_released_buffer
	cbnz	x0, LBB0_6
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	ldr	x8, [x20, #8]
	cbz	x8, LBB0_11
; %bb.13:
	str	wzr, [x8]
	b	LBB0_2
LBB0_14:
	str	xzr, [x20, #8]
LBB0_15:
	bl	_svcGetSystemTick
	str	w0, [x20, #4]
LBB0_16:
	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
	add	sp, sp, #64
	ret
LBB0_17:
	mov	w19, #0
	b	LBB0_16
	.loh AdrpAdd	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to get released buffer?\n"

	.comm	_U64_MAX,4,2                    ; @U64_MAX
	.no_dead_strip	_switch_audio_write
.subsections_via_symbols
