	.file	"extr_buffer.c_IDirectSoundBufferImpl_Duplicate.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"(%p,%p,%p)\n"
.LC1:
	.string	"out of memory\n"
.LC2:
	.string	"duplicating hardware buffer\n"
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC3:
	.string	"IDsDriver_DuplicateSoundBuffer failed (%08x)\n"
	.text
	.p2align 4
	.globl	IDirectSoundBufferImpl_Duplicate
	.type	IDirectSoundBufferImpl_Duplicate, @function
IDirectSoundBufferImpl_Duplicate:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	mov	rcx, rdx
	xor	eax, eax
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	mov	r14, rsi
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	rbx, rdx
	mov	rdx, rsi
	mov	rsi, rdi
	lea	rdi, .LC0[rip]
	sub	rsp, 8
	.cfi_def_cfa_offset 64
	call	TRACE@PLT
	xor	eax, eax
	call	GetProcessHeap@PLT
	xor	esi, esi
	mov	edx, 128
	mov	edi, eax
	call	HeapAlloc@PLT
	test	rax, rax
	je	.L12
	mov	edx, 128
	mov	rsi, rbx
	mov	rdi, rax
	mov	r12, rax
	call	CopyMemory@PLT
	mov	rdi, QWORD PTR 8[rbx]
	call	DSOUND_CopyFormat@PLT
	mov	QWORD PTR 8[r12], rax
	test	rax, rax
	je	.L13
	cmp	QWORD PTR 120[rbx], 0
	je	.L5
	lea	rdi, .LC2[rip]
	xor	eax, eax
	call	TRACE@PLT
	mov	edi, DWORD PTR 0[rbp]
	mov	rsi, QWORD PTR 120[rbx]
	lea	rdx, 120[r12]
	call	IDsDriver_DuplicateSoundBuffer@PLT
	mov	rdi, rax
	mov	r13, rax
	call	FAILED@PLT
	test	rax, rax
	jne	.L14
.L5:
	mov	rdi, QWORD PTR 16[r12]
	lea	rbx, 24[r12]
	lea	r15, 40[r12]
	mov	rsi, rbx
	add	DWORD PTR [rdi], 1
	add	rdi, 4
	call	list_add_head@PLT
	mov	QWORD PTR 64[r12], rbp
	mov	rdi, r12
	movabs	rax, 4294967297
	mov	QWORD PTR [r12], rax
	mov	eax, DWORD PTR STATE_STOPPED[rip]
	mov	QWORD PTR 96[r12], 0
	mov	DWORD PTR 112[r12], eax
	mov	QWORD PTR 104[r12], 0
	mov	QWORD PTR 88[r12], 0
	mov	QWORD PTR 80[r12], 0
	mov	QWORD PTR 72[r12], 0
	mov	QWORD PTR 56[r12], 0
	mov	QWORD PTR 48[r12], 0
	mov	QWORD PTR 32[r12], 0
	call	DSOUND_RecalcFormat@PLT
	mov	edx, DWORD PTR 44[r12]
	xor	esi, esi
	mov	rdi, r12
	mov	ecx, DWORD PTR FALSE[rip]
	call	DSOUND_MixToTemporary@PLT
	mov	rdi, r15
	call	RtlInitializeResource@PLT
	mov	rsi, r12
	mov	rdi, rbp
	call	DirectSoundDevice_AddBuffer@PLT
	cmp	QWORD PTR DS_OK[rip], rax
	mov	r13, rax
	jne	.L15
.L6:
	mov	QWORD PTR [r14], r12
.L1:
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	rax, r13
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L15:
	.cfi_restore_state
	mov	rdi, r15
	call	RtlDeleteResource@PLT
	mov	r15, QWORD PTR 32[r12]
	xor	eax, eax
	call	GetProcessHeap@PLT
	xor	esi, esi
	mov	rdx, r15
	mov	edi, eax
	call	HeapFree@PLT
	mov	rdi, rbx
	call	list_remove@PLT
	mov	rax, QWORD PTR 16[r12]
	mov	r15, QWORD PTR 8[r12]
	sub	DWORD PTR [rax], 1
	xor	eax, eax
	call	GetProcessHeap@PLT
	mov	rdx, r15
	xor	esi, esi
	mov	edi, eax
	call	HeapFree@PLT
	xor	eax, eax
	call	GetProcessHeap@PLT
	mov	rdx, r12
	xor	esi, esi
	xor	r12d, r12d
	mov	edi, eax
	call	HeapFree@PLT
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L14:
	mov	rsi, r13
	lea	rdi, .LC3[rip]
	xor	eax, eax
	call	WARN@PLT
	mov	r15, QWORD PTR 8[r12]
	xor	eax, eax
	call	GetProcessHeap@PLT
	xor	esi, esi
	mov	edi, eax
	mov	rdx, r15
	call	HeapFree@PLT
	xor	eax, eax
	call	GetProcessHeap@PLT
	mov	rdx, r12
	xor	esi, esi
	mov	edi, eax
	call	HeapFree@PLT
	mov	QWORD PTR [r14], 0
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L12:
	lea	rdi, .LC1[rip]
	xor	eax, eax
	call	WARN@PLT
	mov	QWORD PTR [r14], 0
	mov	r13, QWORD PTR DSERR_OUTOFMEMORY[rip]
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L13:
	call	GetProcessHeap@PLT
	mov	rdx, r12
	xor	esi, esi
	mov	edi, eax
	call	HeapFree@PLT
	mov	QWORD PTR [r14], 0
	mov	r13, QWORD PTR DSERR_OUTOFMEMORY[rip]
	jmp	.L1
	.cfi_endproc
.LFE0:
	.size	IDirectSoundBufferImpl_Duplicate, .-IDirectSoundBufferImpl_Duplicate
	.comm	STATE_STOPPED,4,4
	.comm	FALSE,4,4
	.comm	DS_OK,8,8
	.comm	DSERR_OUTOFMEMORY,8,8
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_buffer.c_IDirectSoundBufferImpl_Duplicate.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"(%p,%p,%p)\012\000"
	.align	2
.LC1:
	.ascii	"out of memory\012\000"
	.align	2
.LC2:
	.ascii	"duplicating hardware buffer\012\000"
	.align	2
.LC3:
	.ascii	"IDsDriver_DuplicateSoundBuffer failed (%08x)\012\000"
	.text
	.align	2
	.global	IDirectSoundBufferImpl_Duplicate
	.syntax unified
	.arm
	.fpu softvfp
	.type	IDirectSoundBufferImpl_Duplicate, %function
IDirectSoundBufferImpl_Duplicate:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	mov	r5, r2
	mov	r6, r0
	mov	r2, r1
	mov	r3, r5
	mov	r8, r1
	mov	r1, r0
	ldr	r0, .L19
	bl	TRACE
	bl	GetProcessHeap
	mov	r2, #72
	mov	r1, #0
	bl	HeapAlloc
	subs	r4, r0, #0
	beq	.L15
	mov	r2, #72
	mov	r1, r5
	bl	CopyMemory
	ldr	r0, [r5, #8]
	bl	DSOUND_CopyFormat
	cmp	r0, #0
	mov	r7, r0
	str	r0, [r4, #8]
	beq	.L16
	ldr	r3, [r5, #68]
	cmp	r3, #0
	beq	.L5
	ldr	r0, .L19+4
	bl	TRACE
	ldr	r1, [r5, #68]
	add	r2, r4, #68
	ldr	r0, [r6]
	bl	IDsDriver_DuplicateSoundBuffer
	mov	r7, r0
	bl	FAILED
	cmp	r0, #0
	bne	.L17
.L5:
	ldr	r3, [r4, #12]
	add	r9, r4, #16
	mov	r0, r3
	ldr	r3, [r3]
	mov	r1, r9
	add	r3, r3, #1
	str	r3, [r0], #4
	bl	list_add_head
	mov	r5, #0
	mov	r3, #1
	ldr	r2, .L19+8
	str	r3, [r4, #4]
	ldr	r2, [r2]
	mov	r0, r4
	str	r3, [r4]
	str	r2, [r4, #64]
	str	r6, [r4, #40]
	str	r5, [r4, #56]
	str	r5, [r4, #60]
	str	r5, [r4, #52]
	str	r5, [r4, #48]
	str	r5, [r4, #44]
	str	r5, [r4, #36]
	str	r5, [r4, #32]
	str	r5, [r4, #20]
	bl	DSOUND_RecalcFormat
	ldr	r3, .L19+12
	mov	r1, r5
	ldr	r3, [r3]
	ldr	r2, [r4, #28]
	mov	r0, r4
	add	r10, r4, #24
	bl	DSOUND_MixToTemporary
	mov	r0, r10
	bl	RtlInitializeResource
	mov	r1, r4
	mov	r0, r6
	bl	DirectSoundDevice_AddBuffer
	ldr	r3, .L19+16
	mov	r7, r0
	ldr	r3, [r3]
	cmp	r3, r0
	bne	.L18
.L6:
	str	r4, [r8]
.L1:
	mov	r0, r7
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L18:
	mov	r0, r10
	bl	RtlDeleteResource
	bl	GetProcessHeap
	mov	r1, r5
	ldr	r2, [r4, #20]
	bl	HeapFree
	mov	r0, r9
	bl	list_remove
	ldr	r2, [r4, #12]
	ldr	r3, [r2]
	sub	r3, r3, #1
	str	r3, [r2]
	bl	GetProcessHeap
	ldr	r2, [r4, #8]
	mov	r1, r5
	bl	HeapFree
	bl	GetProcessHeap
	mov	r2, r4
	mov	r1, r5
	bl	HeapFree
	mov	r4, r5
	b	.L6
.L17:
	mov	r1, r7
	ldr	r0, .L19+20
	bl	WARN
	bl	GetProcessHeap
	mov	r1, #0
	ldr	r2, [r4, #8]
	bl	HeapFree
	bl	GetProcessHeap
	mov	r2, r4
	mov	r1, #0
	bl	HeapFree
	mov	r3, #0
	str	r3, [r8]
	b	.L1
.L15:
	ldr	r0, .L19+24
	bl	WARN
	ldr	r3, .L19+28
	str	r4, [r8]
	ldr	r7, [r3]
	mov	r0, r7
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L16:
	bl	GetProcessHeap
	mov	r1, r7
	mov	r2, r4
	bl	HeapFree
	ldr	r3, .L19+28
	str	r7, [r8]
	ldr	r7, [r3]
	b	.L1
.L20:
	.align	2
.L19:
	.word	.LC0
	.word	.LC2
	.word	STATE_STOPPED
	.word	FALSE
	.word	DS_OK
	.word	.LC3
	.word	.LC1
	.word	DSERR_OUTOFMEMORY
	.size	IDirectSoundBufferImpl_Duplicate, .-IDirectSoundBufferImpl_Duplicate
	.comm	STATE_STOPPED,4,4
	.comm	FALSE,4,4
	.comm	DS_OK,4,4
	.comm	DSERR_OUTOFMEMORY,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
