	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function xa_write
_xa_write:                              ## @xa_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	$104, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	(%rdi), %rbx
	cmpq	$0, 8(%rdi)
	je	LBB0_2
## %bb.1:
	movq	%rbx, %rdi
	callq	_XAUDIO2_WRITE_AVAILABLE
	cmpq	%r14, %rax
	cmovbq	%rax, %r14
	testq	%rax, %rax
	je	LBB0_14
LBB0_2:
	testl	%r14d, %r14d
	je	LBB0_14
## %bb.3:
	leaq	12(%rbx), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	_MAX_BUFFERS@GOTPCREL(%rip), %r12
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	movl	%r14d, %r13d
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_4:                                 ##   in Loop: Header=BB0_5 Depth=1
	movl	%r14d, %eax
	leaq	(%r15,%rax,4), %r15
	subl	%r14d, %r13d
	je	LBB0_12
LBB0_5:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_8 Depth 2
	movl	(%rbx), %esi
	subl	4(%rbx), %esi
	movl	%r13d, %edi
	callq	_MIN
	movl	%eax, %r14d
	movl	(%rbx), %eax
	imull	8(%rbx), %eax
	movl	4(%rbx), %edi
	addq	24(%rbx), %rax
	addq	%rax, %rdi
	movq	%r15, %rsi
	movl	%r14d, %edx
	callq	_memcpy
	movl	4(%rbx), %eax
	addl	%r14d, %eax
	movl	%eax, 4(%rbx)
	cmpl	(%rbx), %eax
	jne	LBB0_4
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	(%r12), %ecx
	decl	%ecx
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	cmpl	%ecx, (%rdx)
	jne	LBB0_10
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	%r15, -64(%rbp)                 ## 8-byte Spill
	movq	%r12, %r15
	movq	_INFINITE@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_8:                                 ##   Parent Loop BB0_5 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	32(%rbx), %edi
	movl	(%r12), %esi
	callq	_WaitForSingleObject
	movl	(%r15), %eax
	decl	%eax
	cmpl	%eax, 12(%rbx)
	je	LBB0_8
## %bb.9:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	(%rbx), %eax
	movq	%r15, %r12
	movq	-64(%rbp), %r15                 ## 8-byte Reload
LBB0_10:                                ##   in Loop: Header=BB0_5 Depth=1
	movq	$0, -72(%rbp)
	movl	%eax, -136(%rbp)
	imull	8(%rbx), %eax
	addq	24(%rbx), %rax
	movq	%rax, -80(%rbp)
	leaq	-128(%rbp), %rax
	xorps	%xmm0, %xmm0
	movups	%xmm0, 32(%rax)
	movups	%xmm0, 16(%rax)
	movups	%xmm0, (%rax)
	movl	16(%rbx), %edi
	leaq	-136(%rbp), %rsi
	xorl	%edx, %edx
	callq	_IXAudio2SourceVoice_SubmitSourceBuffer
	movl	%eax, %edi
	callq	_FAILED
	testq	%rax, %rax
	jne	LBB0_15
## %bb.11:                              ##   in Loop: Header=BB0_5 Depth=1
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_InterlockedIncrement
	movl	$0, 4(%rbx)
	movl	8(%rbx), %eax
	incl	%eax
	movq	_MAX_BUFFERS_MASK@GOTPCREL(%rip), %rcx
	andl	(%rcx), %eax
	movl	%eax, 8(%rbx)
	jmp	LBB0_4
LBB0_14:
	xorl	%eax, %eax
	jmp	LBB0_16
LBB0_12:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	jmp	LBB0_16
LBB0_15:
	xorl	%eax, %eax
	negq	-48(%rbp)                       ## 8-byte Folded Spill
	sbbl	%eax, %eax
                                        ## kill: def $eax killed $eax def $rax
LBB0_16:
                                        ## kill: def $eax killed $eax killed $rax
	addq	$104, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_BUFFERS,4,2                ## @MAX_BUFFERS
	.comm	_INFINITE,4,2                   ## @INFINITE
	.comm	_MAX_BUFFERS_MASK,4,2           ## @MAX_BUFFERS_MASK
	.no_dead_strip	_xa_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function xa_write
_xa_write:                              ; @xa_write
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #176
	.cfi_def_cfa_offset 176
	stp	x28, x27, [sp, #80]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #96]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #112]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #128]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #144]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #160]            ; 16-byte Folded Spill
	add	x29, sp, #160
	.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, x2
	mov	x20, x1
	ldp	x21, x8, [x0]
	cbz	x8, LBB0_2
; %bb.1:
	mov	x0, x21
	bl	_XAUDIO2_WRITE_AVAILABLE
	cmp	x0, x19
	csel	x19, x0, x19, lo
	cbz	x0, LBB0_11
LBB0_2:
	cbz	w19, LBB0_13
; %bb.3:
	add	x22, x21, #12
	add	x8, sp, #8
	add	x25, x8, #8
Lloh0:
	adrp	x26, _MAX_BUFFERS@GOTPAGE
Lloh1:
	ldr	x26, [x26, _MAX_BUFFERS@GOTPAGEOFF]
Lloh2:
	adrp	x27, _INFINITE@GOTPAGE
Lloh3:
	ldr	x27, [x27, _INFINITE@GOTPAGEOFF]
Lloh4:
	adrp	x28, _MAX_BUFFERS_MASK@GOTPAGE
Lloh5:
	ldr	x28, [x28, _MAX_BUFFERS_MASK@GOTPAGEOFF]
	mov	x23, x19
	b	LBB0_5
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	add	x20, x20, w24, uxtw #2
	sub	w23, w23, w24
	cbz	w23, LBB0_13
LBB0_5:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_7 Depth 2
	ldp	w8, w9, [x21]
	sub	w1, w8, w9
	mov	x0, x23
	bl	_MIN
	mov	x24, x0
	ldr	x8, [x21, #24]
	ldp	w11, w9, [x21, #4]
	ldr	w10, [x21]
	mul	w9, w10, w9
	add	x8, x8, x9
	add	x0, x8, x11
	mov	x1, x20
	mov	x2, x24
	bl	_memcpy
	ldp	w9, w8, [x21]
	add	w8, w8, w24
	cmp	w8, w9
	str	w8, [x21, #4]
	b.ne	LBB0_4
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	w9, [x22]
	ldr	w10, [x26]
	sub	w10, w10, #1
	cmp	w9, w10
	b.ne	LBB0_9
LBB0_7:                                 ;   Parent Loop BB0_5 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w0, [x21, #32]
	ldr	w1, [x27]
	bl	_WaitForSingleObject
	ldr	w8, [x21, #12]
	ldr	w9, [x26]
	sub	w9, w9, #1
	cmp	w8, w9
	b.eq	LBB0_7
; %bb.8:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	w8, [x21]
LBB0_9:                                 ;   in Loop: Header=BB0_5 Depth=1
	str	xzr, [sp, #72]
	str	w8, [sp, #8]
	ldr	x9, [x21, #24]
	ldr	w10, [x21, #8]
	mul	w8, w10, w8
	add	x8, x9, x8
	str	x8, [sp, #64]
	movi.2d	v0, #0000000000000000
	stp	q0, q0, [x25, #16]
	str	q0, [x25]
	ldr	w0, [x21, #16]
	add	x1, sp, #8
	mov	x2, #0
	bl	_IXAudio2SourceVoice_SubmitSourceBuffer
	bl	_FAILED
	cbnz	x0, LBB0_12
; %bb.10:                               ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x22
	bl	_InterlockedIncrement
	ldr	w8, [x21, #8]
	add	w8, w8, #1
	ldr	w9, [x28]
	and	w8, w8, w9
	stp	wzr, w8, [x21, #4]
	b	LBB0_4
LBB0_11:
	mov	w19, #0
	b	LBB0_13
LBB0_12:
	cmp	x19, #0
	csetm	w19, ne
LBB0_13:
	mov	x0, x19
	ldp	x29, x30, [sp, #160]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #144]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #128]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #112]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #96]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #80]             ; 16-byte Folded Reload
	add	sp, sp, #176
	ret
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_BUFFERS,4,2                ; @MAX_BUFFERS
	.comm	_INFINITE,4,2                   ; @INFINITE
	.comm	_MAX_BUFFERS_MASK,4,2           ; @MAX_BUFFERS_MASK
	.no_dead_strip	_xa_write
.subsections_via_symbols
