	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_DSOUND_PrimaryDestroy          ## -- Begin function DSOUND_PrimaryDestroy
	.p2align	4, 0x90
_DSOUND_PrimaryDestroy:                 ## @DSOUND_PrimaryDestroy
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -24
	movq	%rdi, %rbx
	leaq	L_.str(%rip), %rdi
	movq	%rbx, %rsi
	callq	_TRACE
	movq	%rbx, %rdi
	callq	_EnterCriticalSection
	movq	%rbx, %rdi
	callq	_DSOUND_PrimaryClose
	cmpq	$0, 32(%rbx)
	je	LBB0_4
## %bb.1:
	movq	24(%rbx), %rdi
	testq	%rdi, %rdi
	je	LBB0_5
## %bb.2:
	callq	_IDsDriverBuffer_Release
	testq	%rax, %rax
	jne	LBB0_5
## %bb.3:
	movq	$0, 24(%rbx)
	jmp	LBB0_5
LBB0_4:
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	16(%rbx), %rdx
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_HeapFree
LBB0_5:
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	8(%rbx), %rdx
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_HeapFree
	movq	$0, 8(%rbx)
	movq	%rbx, %rdi
	callq	_LeaveCriticalSection
	movq	_DS_OK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"(%p)\n"

	.comm	_DS_OK,4,2                      ## @DS_OK
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_DSOUND_PrimaryDestroy          ; -- Begin function DSOUND_PrimaryDestroy
	.p2align	2
_DSOUND_PrimaryDestroy:                 ; @DSOUND_PrimaryDestroy
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x19
	bl	_TRACE
	mov	x0, x19
	bl	_EnterCriticalSection
	mov	x0, x19
	bl	_DSOUND_PrimaryClose
	ldr	x8, [x19, #32]
	cbz	x8, LBB0_4
; %bb.1:
	ldr	x0, [x19, #24]
	cbz	x0, LBB0_5
; %bb.2:
	bl	_IDsDriverBuffer_Release
	cbnz	x0, LBB0_5
; %bb.3:
	str	xzr, [x19, #24]
	b	LBB0_5
LBB0_4:
	bl	_GetProcessHeap
	ldr	x2, [x19, #16]
	mov	w1, #0
	bl	_HeapFree
LBB0_5:
	bl	_GetProcessHeap
	ldr	x2, [x19, #8]
	mov	w1, #0
	bl	_HeapFree
	str	xzr, [x19, #8]
	mov	x0, x19
	bl	_LeaveCriticalSection
Lloh2:
	adrp	x8, _DS_OK@GOTPAGE
Lloh3:
	ldr	x8, [x8, _DS_OK@GOTPAGEOFF]
Lloh4:
	ldr	w0, [x8]
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"(%p)\n"

	.comm	_DS_OK,4,2                      ; @DS_OK
.subsections_via_symbols
