	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ax_audio_write
_ax_audio_write:                        ## @ax_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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, -88(%rbp)                 ## 8-byte Spill
	xorl	%r15d, %r15d
	testq	%rdx, %rdx
	je	LBB0_25
## %bb.1:
	movq	%rdx, %r12
	movl	%r12d, %eax
	andl	$3, %eax
	testq	%rax, %rax
	jne	LBB0_25
## %bb.2:
	movq	%rdi, %rbx
	shrq	$2, %r12
	movq	_AX_AUDIO_MAX_FREE@GOTPCREL(%rip), %r13
	movq	(%r13), %rax
	cmpq	%rax, %r12
	cmovaeq	%rax, %r12
	xorl	%r15d, %r15d
	subq	(%rdi), %rax
	cmovaeq	%rax, %r15
	cmpq	$0, 40(%rdi)
	je	LBB0_4
## %bb.3:
	movq	_AX_AUDIO_SAMPLE_COUNT@GOTPCREL(%rip), %rax
	xorl	%ecx, %ecx
	cmpq	(%rax), %r15
	cmovbq	%rcx, %r12
	jmp	LBB0_8
LBB0_4:
	cmpq	%r12, %r15
	jae	LBB0_8
## %bb.5:
	movl	16(%rbx), %edi
	callq	_AXIsMultiVoiceRunning
	testq	%rax, %rax
	je	LBB0_8
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	xorl	%eax, %eax
	callq	_OSYieldThread
	movq	(%r13), %rax
	subq	(%rbx), %rax
	movl	$0, %r15d
	cmovaeq	%rax, %r15
	movl	16(%rbx), %edi
	callq	_AXIsMultiVoiceRunning
	testq	%rax, %rax
	je	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	cmpq	%r12, %r15
	jb	LBB0_6
LBB0_8:
	cmpq	%r15, %r12
	cmovbq	%r12, %r15
	testq	%r15, %r15
	je	LBB0_22
## %bb.9:
	movq	8(%rbx), %rdi
	movq	%r15, %rax
	addq	%r15, %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	je	LBB0_16
## %bb.10:
	leal	(%r15,%r15), %r13d
	xorl	%r14d, %r14d
	movl	$2, %r12d
	leaq	(,%rdi,4), %rax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
	movq	%r15, -80(%rbp)                 ## 8-byte Spill
	.p2align	4, 0x90
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	movq	-88(%rbp), %rdx                 ## 8-byte Reload
	movl	-8(%rdx,%r12,4), %eax
	movq	32(%rbx), %rcx
	movl	%eax, (%rcx,%rdi,4)
	movl	-4(%rdx,%r12,4), %eax
	movq	24(%rbx), %rcx
	movl	%eax, (%rcx,%rdi,4)
	incl	%edi
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_ax_audio_limit
	movq	%rax, 8(%rbx)
	testq	%rax, %rax
	jne	LBB0_13
## %bb.12:                              ##   in Loop: Header=BB0_11 Depth=1
	movq	32(%rbx), %rdi
	movq	-72(%rbp), %r14                 ## 8-byte Reload
	addq	%r14, %rdi
	movq	_AX_AUDIO_COUNT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	subl	%r15d, %esi
	addl	%esi, %esi
	callq	_DCStoreRangeNoSync
	movq	24(%rbx), %rdi
	addq	%r14, %rdi
	movq	_AX_AUDIO_COUNT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	subl	%r15d, %esi
	movq	-80(%rbp), %r15                 ## 8-byte Reload
	addl	%esi, %esi
	callq	_DCStoreRangeNoSync
	movl	$1, -44(%rbp)                   ## 4-byte Folded Spill
	movl	%r13d, %r14d
LBB0_13:                                ##   in Loop: Header=BB0_11 Depth=1
	cmpq	%r12, -64(%rbp)                 ## 8-byte Folded Reload
	jbe	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_11 Depth=1
	movq	8(%rbx), %rdi
	addq	$2, %r12
	addl	$-2, %r13d
	jmp	LBB0_11
LBB0_15:
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	je	LBB0_16
## %bb.17:
	testl	%r14d, %r14d
	jle	LBB0_20
## %bb.18:
	movq	32(%rbx), %rdi
	movl	%r14d, %esi
	callq	_DCStoreRangeNoSync
	movq	24(%rbx), %rdi
	movl	%r14d, %esi
	jmp	LBB0_19
LBB0_16:
	shlq	$2, %rdi
	movq	%rdi, %r12
	movq	32(%rbx), %rdi
	addq	%r12, %rdi
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movl	%r14d, %esi
	callq	_DCStoreRangeNoSync
	addq	24(%rbx), %r12
	movq	%r12, %rdi
	movl	%r14d, %esi
LBB0_19:
	callq	_DCStoreRange
LBB0_20:
	leaq	20(%rbx), %r14
	movq	%r14, %rdi
	callq	_OSUninterruptibleSpinLock_Acquire
	testq	%rax, %rax
	je	LBB0_22
## %bb.21:
	addq	%r15, (%rbx)
	movq	%r14, %rdi
	callq	_OSUninterruptibleSpinLock_Release
LBB0_22:
	movl	16(%rbx), %edi
	callq	_AXIsMultiVoiceRunning
	testq	%rax, %rax
	jne	LBB0_24
## %bb.23:
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_ax_audio_start
LBB0_24:
	shlq	$2, %r15
LBB0_25:
	movq	%r15, %rax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AX_AUDIO_MAX_FREE,8,3          ## @AX_AUDIO_MAX_FREE
	.comm	_AX_AUDIO_SAMPLE_COUNT,8,3      ## @AX_AUDIO_SAMPLE_COUNT
	.comm	_AX_AUDIO_COUNT,8,3             ## @AX_AUDIO_COUNT
	.no_dead_strip	_ax_audio_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ax_audio_write
_ax_audio_write:                        ; @ax_audio_write
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x0
	mov	x0, #0
	cbz	x2, LBB0_24
; %bb.1:
	and	x8, x2, #0x3
	cbnz	x8, LBB0_24
; %bb.2:
	mov	x20, x1
	lsr	x8, x2, #2
Lloh0:
	adrp	x23, _AX_AUDIO_MAX_FREE@GOTPAGE
Lloh1:
	ldr	x23, [x23, _AX_AUDIO_MAX_FREE@GOTPAGEOFF]
	ldr	x9, [x23]
	cmp	x8, x9
	csel	x21, x8, x9, lo
	ldr	x8, [x19]
	subs	x8, x9, x8
	csel	x22, xzr, x8, lo
	ldr	x8, [x19, #40]
	cbz	x8, LBB0_4
; %bb.3:
Lloh2:
	adrp	x8, _AX_AUDIO_SAMPLE_COUNT@GOTPAGE
Lloh3:
	ldr	x8, [x8, _AX_AUDIO_SAMPLE_COUNT@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
	cmp	x22, x8
	csel	x21, xzr, x21, lo
	b	LBB0_7
LBB0_4:
	cmp	x22, x21
	b.hs	LBB0_7
; %bb.5:
	ldr	w0, [x19, #16]
	bl	_AXIsMultiVoiceRunning
	cbz	x0, LBB0_7
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	bl	_OSYieldThread
	ldr	x8, [x19]
	ldr	x9, [x23]
	subs	x8, x9, x8
	csel	x22, xzr, x8, lo
	ldr	w0, [x19, #16]
	bl	_AXIsMultiVoiceRunning
	cmp	x0, #0
	ccmp	x22, x21, #2, ne
	b.lo	LBB0_6
LBB0_7:
	cmp	x21, x22
	csel	x27, x21, x22, lo
	cbz	x27, LBB0_21
; %bb.8:
	ldr	x25, [x19, #8]
	lsl	x21, x27, #1
	lsl	x24, x25, #2
	cbz	x21, LBB0_17
; %bb.9:
	mov	w22, #0
	mov	w23, #0
	mov	x26, #0
	str	x27, [sp, #8]                   ; 8-byte Folded Spill
	lsl	w27, w27, #1
Lloh5:
	adrp	x28, _AX_AUDIO_COUNT@GOTPAGE
Lloh6:
	ldr	x28, [x28, _AX_AUDIO_COUNT@GOTPAGEOFF]
	mov	x8, x25
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	add	x9, x20, x26, lsl #2
	ldr	w10, [x9]
	lsl	x11, x8, #2
	ldp	x13, x12, [x19, #24]
	str	w10, [x12, x11]
	ldr	w9, [x9, #4]
	str	w9, [x13, x11]
	add	w0, w8, #1
	bl	_ax_audio_limit
	str	x0, [x19, #8]
	cbnz	x0, LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	ldr	x8, [x19, #32]
	add	x0, x8, x24
	ldr	w8, [x28]
	sub	w8, w8, w25
	lsl	w1, w8, #1
	bl	_DCStoreRangeNoSync
	ldr	x8, [x19, #24]
	add	x0, x8, x24
	ldr	w8, [x28]
	sub	w8, w8, w25
	lsl	w1, w8, #1
	bl	_DCStoreRangeNoSync
	mov	w23, #1
	mov	x22, x27
LBB0_12:                                ;   in Loop: Header=BB0_10 Depth=1
	add	x26, x26, #2
	cmp	x21, x26
	b.ls	LBB0_14
; %bb.13:                               ;   in Loop: Header=BB0_10 Depth=1
	ldr	x8, [x19, #8]
	sub	w27, w27, #2
	b	LBB0_10
LBB0_14:
	ldr	x27, [sp, #8]                   ; 8-byte Folded Reload
	cbz	w23, LBB0_17
; %bb.15:
	cmp	w22, #1
	b.lt	LBB0_19
; %bb.16:
	ldr	x0, [x19, #32]
	mov	x1, x22
	bl	_DCStoreRangeNoSync
	ldr	x0, [x19, #24]
	mov	x1, x22
	b	LBB0_18
LBB0_17:
	ldr	x8, [x19, #32]
	add	x0, x8, x24
	mov	x1, x21
	bl	_DCStoreRangeNoSync
	ldr	x8, [x19, #24]
	add	x0, x8, x24
	mov	x1, x21
LBB0_18:
	bl	_DCStoreRange
LBB0_19:
	add	x20, x19, #20
	mov	x0, x20
	bl	_OSUninterruptibleSpinLock_Acquire
	cbz	x0, LBB0_21
; %bb.20:
	ldr	x8, [x19]
	add	x8, x8, x27
	str	x8, [x19]
	mov	x0, x20
	bl	_OSUninterruptibleSpinLock_Release
LBB0_21:
	ldr	w0, [x19, #16]
	bl	_AXIsMultiVoiceRunning
	cbnz	x0, LBB0_23
; %bb.22:
	mov	x0, x19
	mov	w1, #0
	bl	_ax_audio_start
LBB0_23:
	lsl	x0, x27, #2
LBB0_24:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.comm	_AX_AUDIO_MAX_FREE,8,3          ; @AX_AUDIO_MAX_FREE
	.comm	_AX_AUDIO_SAMPLE_COUNT,8,3      ; @AX_AUDIO_SAMPLE_COUNT
	.comm	_AX_AUDIO_COUNT,8,3             ; @AX_AUDIO_COUNT
	.no_dead_strip	_ax_audio_write
.subsections_via_symbols
