	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function DSOUND_PrimaryClose
_DSOUND_PrimaryClose:                   ## @DSOUND_PrimaryClose
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	leaq	L_.str(%rip), %rdi
	movq	%r15, %rsi
	callq	_TRACE
	movq	8(%r15), %rdi
	testq	%rdi, %rdi
	je	LBB0_1
## %bb.5:
	callq	_IDsDriverBuffer_Release
	testl	%eax, %eax
	je	LBB0_6
## %bb.8:
	leaq	L_.str.1(%rip), %rdi
	movl	%eax, %esi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ERR                            ## TAILCALL
LBB0_1:
	leaq	24(%r15), %r14
	movq	%r14, %rdi
	callq	_LeaveCriticalSection
	movq	$-1, 16(%r15)
	movl	40(%r15), %edi
	callq	_waveOutReset
	cmpl	$0, (%r15)
	je	LBB0_4
## %bb.2:
	xorl	%r12d, %r12d
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movl	40(%r15), %edi
	movq	32(%r15), %rsi
	addq	%r12, %rsi
	movl	$4, %edx
	callq	_waveOutUnprepareHeader
	incq	%rbx
	movl	(%r15), %eax
	addq	$4, %r12
	cmpq	%rax, %rbx
	jb	LBB0_3
LBB0_4:
	movq	%r14, %rdi
	callq	_EnterCriticalSection
	movq	$0, 16(%r15)
	jmp	LBB0_7
LBB0_6:
	movq	$0, 8(%r15)
LBB0_7:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"(%p)\n"

L_.str.1:                               ## @.str.1
	.asciz	"Still %d references on primary buffer, refcount leak?\n"

	.no_dead_strip	_DSOUND_PrimaryClose
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function DSOUND_PrimaryClose
_DSOUND_PrimaryClose:                   ; @DSOUND_PrimaryClose
	.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	x19, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x19
	bl	_TRACE
	ldr	x0, [x19, #8]
	cbz	x0, LBB0_3
; %bb.1:
	bl	_IDsDriverBuffer_Release
	cbz	w0, LBB0_7
; %bb.2:
	mov	x1, x0
Lloh2:
	adrp	x0, l_.str.1@PAGE
Lloh3:
	add	x0, x0, l_.str.1@PAGEOFF
	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
	b	_ERR
LBB0_3:
	add	x20, x19, #24
	mov	x0, x20
	bl	_LeaveCriticalSection
	mov	x8, #-1
	str	x8, [x19, #16]
	ldr	w0, [x19, #40]
	bl	_waveOutReset
	ldr	w8, [x19]
	cbz	w8, LBB0_6
; %bb.4:
	mov	x21, #0
	mov	x22, #0
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x19, #40]
	ldr	x8, [x19, #32]
	add	x1, x8, x21
	mov	w2, #4
	bl	_waveOutUnprepareHeader
	add	x22, x22, #1
	ldr	w8, [x19]
	add	x21, x21, #4
	cmp	x22, x8
	b.lo	LBB0_5
LBB0_6:
	mov	x0, x20
	bl	_EnterCriticalSection
	str	xzr, [x19, #16]
	b	LBB0_8
LBB0_7:
	str	xzr, [x19, #8]
LBB0_8:
	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
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"(%p)\n"

l_.str.1:                               ; @.str.1
	.asciz	"Still %d references on primary buffer, refcount leak?\n"

	.no_dead_strip	_DSOUND_PrimaryClose
.subsections_via_symbols
