	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_IDirectSoundBufferImpl_Duplicate ## -- Begin function IDirectSoundBufferImpl_Duplicate
	.p2align	4, 0x90
_IDirectSoundBufferImpl_Duplicate:      ## @IDirectSoundBufferImpl_Duplicate
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %rbx
	movq	%rsi, %r12
	movq	%rdi, %r15
	leaq	L_.str(%rip), %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%rbx, %rcx
	xorl	%eax, %eax
	callq	_TRACE
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movl	%eax, %edi
	xorl	%esi, %esi
	movl	$128, %edx
	callq	_HeapAlloc
	testq	%rax, %rax
	je	LBB0_1
## %bb.3:
	movq	%rax, %r13
	movq	%rax, %r14
	movq	%r13, %rdi
	movq	%rbx, %rsi
	movl	$128, %edx
	callq	_CopyMemory
	movq	8(%rbx), %rdi
	callq	_DSOUND_CopyFormat
	movq	%rax, 8(%r13)
	testq	%rax, %rax
	je	LBB0_4
## %bb.5:
	movq	%r12, -48(%rbp)                 ## 8-byte Spill
	cmpq	$0, 120(%rbx)
	je	LBB0_8
## %bb.6:
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_TRACE
	movl	(%r15), %edi
	movq	120(%rbx), %rsi
	leaq	120(%r13), %rdx
	callq	_IDsDriver_DuplicateSoundBuffer
	movq	%rax, %r12
	movq	%rax, %rdi
	callq	_FAILED
	testq	%rax, %rax
	je	LBB0_8
## %bb.7:
	leaq	L_.str.3(%rip), %rdi
	movq	%r12, %rsi
	xorl	%eax, %eax
	callq	_WARN
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	8(%r14), %rdx
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_HeapFree
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movl	%eax, %edi
	xorl	%esi, %esi
	movq	%r14, %rdx
	callq	_HeapFree
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	$0, (%rax)
	jmp	LBB0_11
LBB0_1:
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_WARN
	jmp	LBB0_2
LBB0_4:
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movl	%eax, %edi
	xorl	%esi, %esi
	movq	%r14, %rdx
	callq	_HeapFree
LBB0_2:
	movq	$0, (%r12)
	movq	_DSERR_OUTOFMEMORY@GOTPCREL(%rip), %rax
	movq	(%rax), %r12
	jmp	LBB0_11
LBB0_8:
	movq	16(%r14), %rdi
	incl	(%rdi)
	addq	$4, %rdi
	leaq	24(%r13), %rbx
	movq	%rbx, %rsi
	callq	_list_add_head
	movabsq	$4294967297, %rax               ## imm = 0x100000001
	movq	%rax, (%r14)
	movq	_STATE_STOPPED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 112(%r14)
	xorps	%xmm0, %xmm0
	movups	%xmm0, 88(%r14)
	movups	%xmm0, 72(%r14)
	movq	$0, 104(%r14)
	movq	%r15, 64(%r14)
	movq	$0, 32(%r14)
	movups	%xmm0, 48(%r14)
	movq	%r14, %rdi
	callq	_DSOUND_RecalcFormat
	movl	44(%r14), %edx
	movq	_FALSE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_DSOUND_MixToTemporary
	addq	$40, %r13
	movq	%r13, %rdi
	callq	_RtlInitializeResource
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_DirectSoundDevice_AddBuffer
	movq	%rax, %r12
	movq	_DS_OK@GOTPCREL(%rip), %rax
	cmpq	(%rax), %r12
	je	LBB0_10
## %bb.9:
	movq	%r13, %rdi
	callq	_RtlDeleteResource
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	32(%r14), %rdx
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_HeapFree
	movq	%rbx, %rdi
	callq	_list_remove
	movq	16(%r14), %rax
	decl	(%rax)
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	8(%r14), %rdx
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_HeapFree
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movl	%eax, %edi
	xorl	%esi, %esi
	movq	%r14, %rdx
	callq	_HeapFree
	xorl	%r14d, %r14d
LBB0_10:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	%r14, (%rax)
LBB0_11:
	movq	%r12, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DS_OK,8,3                      ## @DS_OK
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"(%p,%p,%p)\n"

L_.str.1:                               ## @.str.1
	.asciz	"out of memory\n"

	.comm	_DSERR_OUTOFMEMORY,8,3          ## @DSERR_OUTOFMEMORY
L_.str.2:                               ## @.str.2
	.asciz	"duplicating hardware buffer\n"

L_.str.3:                               ## @.str.3
	.asciz	"IDsDriver_DuplicateSoundBuffer failed (%08x)\n"

	.comm	_STATE_STOPPED,4,2              ## @STATE_STOPPED
	.comm	_FALSE,4,2                      ## @FALSE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_IDirectSoundBufferImpl_Duplicate ; -- Begin function IDirectSoundBufferImpl_Duplicate
	.p2align	2
_IDirectSoundBufferImpl_Duplicate:      ; @IDirectSoundBufferImpl_Duplicate
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	mov	x22, x2
	mov	x19, x1
	mov	x21, x0
	stp	x1, x2, [sp, #8]
	str	x0, [sp]
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_TRACE
	bl	_GetProcessHeap
	mov	w1, #0
	mov	w2, #128
	bl	_HeapAlloc
	cbz	x0, LBB0_5
; %bb.1:
	mov	x20, x0
	mov	x1, x22
	mov	w2, #128
	bl	_CopyMemory
	ldr	x0, [x22, #8]
	bl	_DSOUND_CopyFormat
	str	x0, [x20, #8]
	cbz	x0, LBB0_6
; %bb.2:
	ldr	x8, [x22, #120]
	cbz	x8, LBB0_8
; %bb.3:
Lloh2:
	adrp	x0, l_.str.2@PAGE
Lloh3:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_TRACE
	ldr	w0, [x21]
	ldr	x1, [x22, #120]
	add	x2, x20, #120
	bl	_IDsDriver_DuplicateSoundBuffer
	mov	x22, x0
	bl	_FAILED
	cbz	x0, LBB0_8
; %bb.4:
	str	x22, [sp]
Lloh4:
	adrp	x0, l_.str.3@PAGE
Lloh5:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_WARN
	bl	_GetProcessHeap
	ldr	x2, [x20, #8]
	mov	w1, #0
	bl	_HeapFree
	bl	_GetProcessHeap
	mov	w1, #0
	mov	x2, x20
	bl	_HeapFree
	str	xzr, [x19]
	b	LBB0_11
LBB0_5:
Lloh6:
	adrp	x0, l_.str.1@PAGE
Lloh7:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_WARN
	b	LBB0_7
LBB0_6:
	bl	_GetProcessHeap
	mov	w1, #0
	mov	x2, x20
	bl	_HeapFree
LBB0_7:
	str	xzr, [x19]
Lloh8:
	adrp	x8, _DSERR_OUTOFMEMORY@GOTPAGE
Lloh9:
	ldr	x8, [x8, _DSERR_OUTOFMEMORY@GOTPAGEOFF]
Lloh10:
	ldr	x22, [x8]
	b	LBB0_11
LBB0_8:
	ldr	x0, [x20, #16]
	ldr	w8, [x0]
	add	w8, w8, #1
	str	w8, [x0], #4
	add	x23, x20, #24
	mov	x1, x23
	bl	_list_add_head
	movi.2s	v0, #1
	str	d0, [x20]
Lloh11:
	adrp	x8, _STATE_STOPPED@GOTPAGE
Lloh12:
	ldr	x8, [x8, _STATE_STOPPED@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	str	w8, [x20, #112]
	movi.2d	v0, #0000000000000000
	stur	q0, [x20, #72]
	stur	q0, [x20, #88]
	str	xzr, [x20, #104]
	stp	xzr, x21, [x20, #56]
	str	xzr, [x20, #32]
	str	xzr, [x20, #48]
	mov	x0, x20
	bl	_DSOUND_RecalcFormat
	ldr	w2, [x20, #44]
Lloh14:
	adrp	x8, _FALSE@GOTPAGE
Lloh15:
	ldr	x8, [x8, _FALSE@GOTPAGEOFF]
Lloh16:
	ldr	w3, [x8]
	mov	x0, x20
	mov	w1, #0
	bl	_DSOUND_MixToTemporary
	add	x24, x20, #40
	mov	x0, x24
	bl	_RtlInitializeResource
	mov	x0, x21
	mov	x1, x20
	bl	_DirectSoundDevice_AddBuffer
	mov	x22, x0
Lloh17:
	adrp	x8, _DS_OK@GOTPAGE
Lloh18:
	ldr	x8, [x8, _DS_OK@GOTPAGEOFF]
Lloh19:
	ldr	x8, [x8]
	cmp	x0, x8
	b.eq	LBB0_10
; %bb.9:
	mov	x0, x24
	bl	_RtlDeleteResource
	bl	_GetProcessHeap
	ldr	x2, [x20, #32]
	mov	w1, #0
	bl	_HeapFree
	mov	x0, x23
	bl	_list_remove
	ldr	x8, [x20, #16]
	ldr	w9, [x8]
	sub	w9, w9, #1
	str	w9, [x8]
	bl	_GetProcessHeap
	ldr	x2, [x20, #8]
	mov	w1, #0
	bl	_HeapFree
	bl	_GetProcessHeap
	mov	w1, #0
	mov	x2, x20
	bl	_HeapFree
	mov	x20, #0
LBB0_10:
	str	x20, [x19]
LBB0_11:
	mov	x0, x22
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_DS_OK,8,3                      ; @DS_OK
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"(%p,%p,%p)\n"

l_.str.1:                               ; @.str.1
	.asciz	"out of memory\n"

	.comm	_DSERR_OUTOFMEMORY,8,3          ; @DSERR_OUTOFMEMORY
l_.str.2:                               ; @.str.2
	.asciz	"duplicating hardware buffer\n"

l_.str.3:                               ; @.str.3
	.asciz	"IDsDriver_DuplicateSoundBuffer failed (%08x)\n"

	.comm	_STATE_STOPPED,4,2              ; @STATE_STOPPED
	.comm	_FALSE,4,2                      ; @FALSE
.subsections_via_symbols
