	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_secondarybuffer_destroy        ## -- Begin function secondarybuffer_destroy
	.p2align	4, 0x90
_secondarybuffer_destroy:               ## @secondarybuffer_destroy
	.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
	movq	56(%rdi), %rdi
	movq	%rbx, %rsi
	callq	_DirectSoundDevice_RemoveBuffer
	leaq	72(%rbx), %rdi
	callq	_RtlDeleteResource
	movq	64(%rbx), %rdi
	testq	%rdi, %rdi
	je	LBB0_3
## %bb.1:
	callq	_IDsDriverBuffer_Release
	cmpq	$0, 64(%rbx)
	je	LBB0_3
## %bb.2:
	movq	56(%rbx), %rax
	movq	_DSDDESC_USESYSTEMMEMORY@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, (%rax)
	je	LBB0_5
LBB0_3:
	movq	32(%rbx), %rax
	decq	(%rax)
	leaq	48(%rbx), %rdi
	callq	_list_remove
	movq	32(%rbx), %rax
	cmpq	$0, (%rax)
	jne	LBB0_5
## %bb.4:
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	32(%rbx), %rcx
	movq	40(%rcx), %rdx
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_HeapFree
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	32(%rbx), %rdx
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_HeapFree
LBB0_5:
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	24(%rbx), %rdx
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_HeapFree
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	16(%rbx), %rdx
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_HeapFree
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	8(%rbx), %rdx
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_HeapFree
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movl	%eax, %edi
	xorl	%esi, %esi
	movq	%rbx, %rdx
	callq	_HeapFree
	leaq	L_.str(%rip), %rdi
	movq	%rbx, %rsi
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	jmp	_TRACE                          ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_DSDDESC_USESYSTEMMEMORY,4,2    ## @DSDDESC_USESYSTEMMEMORY
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"(%p) released\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_secondarybuffer_destroy        ; -- Begin function secondarybuffer_destroy
	.p2align	2
_secondarybuffer_destroy:               ; @secondarybuffer_destroy
	.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
	ldr	x0, [x0, #56]
	mov	x1, x19
	bl	_DirectSoundDevice_RemoveBuffer
	add	x0, x19, #72
	bl	_RtlDeleteResource
	ldr	x0, [x19, #64]
	cbz	x0, LBB0_3
; %bb.1:
	bl	_IDsDriverBuffer_Release
	ldr	x8, [x19, #64]
	cbz	x8, LBB0_3
; %bb.2:
	ldr	x8, [x19, #56]
	ldr	w8, [x8]
Lloh0:
	adrp	x9, _DSDDESC_USESYSTEMMEMORY@GOTPAGE
Lloh1:
	ldr	x9, [x9, _DSDDESC_USESYSTEMMEMORY@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_5
LBB0_3:
	ldr	x8, [x19, #32]
	ldr	x9, [x8]
	sub	x9, x9, #1
	str	x9, [x8]
	add	x0, x19, #48
	bl	_list_remove
	ldr	x8, [x19, #32]
	ldr	x8, [x8]
	cbnz	x8, LBB0_5
; %bb.4:
	bl	_GetProcessHeap
	ldr	x8, [x19, #32]
	ldr	x2, [x8, #40]
	mov	w1, #0
	bl	_HeapFree
	bl	_GetProcessHeap
	ldr	x2, [x19, #32]
	mov	w1, #0
	bl	_HeapFree
LBB0_5:
	bl	_GetProcessHeap
	ldr	x2, [x19, #24]
	mov	w1, #0
	bl	_HeapFree
	bl	_GetProcessHeap
	ldr	x2, [x19, #16]
	mov	w1, #0
	bl	_HeapFree
	bl	_GetProcessHeap
	ldr	x2, [x19, #8]
	mov	w1, #0
	bl	_HeapFree
	bl	_GetProcessHeap
	mov	w1, #0
	mov	x2, x19
	bl	_HeapFree
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x19
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_TRACE
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.comm	_DSDDESC_USESYSTEMMEMORY,4,2    ; @DSDDESC_USESYSTEMMEMORY
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"(%p) released\n"

.subsections_via_symbols
