	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_IDirectSoundBufferImpl_Create  ## -- Begin function IDirectSoundBufferImpl_Create
	.p2align	4, 0x90
_IDirectSoundBufferImpl_Create:         ## @IDirectSoundBufferImpl_Create
	.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
	subq	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %r13
	movq	16(%rdx), %r12
	movq	_DS_OK@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
	leaq	L_.str(%rip), %rdi
	movq	%r13, %rsi
	movq	%r15, %rdx
	movq	%r14, %rcx
	xorl	%eax, %eax
	callq	_TRACE
	movq	(%r14), %rsi
	movq	_DSBSIZE_MIN@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rsi
	jl	LBB0_6
## %bb.1:
	movq	_DSBSIZE_MAX@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rsi
	jg	LBB0_6
## %bb.2:
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	_HEAP_ZERO_MEMORY@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movl	%eax, %edi
	movl	$272, %edx                      ## imm = 0x110
	callq	_HeapAlloc
	testq	%rax, %rax
	je	LBB0_7
## %bb.3:
	movq	%rbx, -80(%rbp)                 ## 8-byte Spill
	movq	%rax, %rbx
	leaq	L_.str.3(%rip), %rdi
	movq	%rax, %rsi
	movq	%r12, -72(%rbp)                 ## 8-byte Spill
	movq	%rax, %r12
	xorl	%eax, %eax
	callq	_TRACE
	movabsq	$4294967297, %rax               ## imm = 0x100000001
	movq	%rax, (%rbx)
	movq	%r13, 264(%rbx)
	movq	_dsbvt@GOTPCREL(%rip), %rax
	movq	%rax, 256(%rbx)
	movq	$0, 248(%rbx)
	movq	%r12, -64(%rbp)                 ## 8-byte Spill
	leaq	176(%r12), %rdi
	movq	-72(%rbp), %r12                 ## 8-byte Reload
	movl	24(%r14), %edx
	movq	%r14, %rsi
	callq	_CopyMemory
	movq	%r12, %rdi
	callq	_DSOUND_CopyFormat
	movq	%rax, 24(%rbx)
	testq	%rax, %rax
	je	LBB0_8
## %bb.4:
	movq	(%r14), %rcx
	movq	16(%r14), %rsi
	movslq	(%rsi), %rdi
	movq	%rcx, %rax
	orq	%rdi, %rax
	shrq	$32, %rax
	je	LBB0_13
## %bb.5:
	movq	%rcx, %rax
	cqto
	idivq	%rdi
	jmp	LBB0_14
LBB0_6:
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_WARN
	movq	$0, (%r15)
	movq	_DSERR_INVALIDPARAM@GOTPCREL(%rip), %rax
	jmp	LBB0_11
LBB0_7:
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_WARN
	jmp	LBB0_9
LBB0_8:
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movl	%eax, %edi
	xorl	%esi, %esi
	movq	%rbx, %rdx
	callq	_HeapFree
LBB0_9:
	movq	$0, (%r15)
LBB0_10:
	movq	_DSERR_OUTOFMEMORY@GOTPCREL(%rip), %rax
LBB0_11:
	movq	(%rax), %rbx
LBB0_12:
	movq	%rbx, %rax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_13:
	movl	%ecx, %eax
	xorl	%edx, %edx
	divl	%edi
                                        ## kill: def $edx killed $edx def $rdx
LBB0_14:
	movl	%ecx, %eax
	subl	%edx, %eax
	addl	%edi, %eax
	testq	%rdx, %rdx
	cmovel	%ecx, %eax
	movl	%eax, 8(%rbx)
	movl	4(%rsi), %eax
	movl	%eax, 12(%rbx)
	xorps	%xmm0, %xmm0
	movups	%xmm0, 216(%rbx)
	movups	%xmm0, 232(%rbx)
	movl	12(%r12), %ecx
	cmpl	$2, 8(%r12)
	jne	LBB0_16
## %bb.15:
	movq	_DSCAPS_SECONDARYSTEREO@GOTPCREL(%rip), %rax
	jmp	LBB0_17
LBB0_16:
	movq	_DSCAPS_SECONDARYMONO@GOTPCREL(%rip), %rax
LBB0_17:
	cmpl	$16, %ecx
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	movq	%r13, -48(%rbp)                 ## 8-byte Spill
	jne	LBB0_19
## %bb.18:
	movq	_DSCAPS_SECONDARY16BIT@GOTPCREL(%rip), %rcx
	jmp	LBB0_20
LBB0_19:
	movq	_DSCAPS_SECONDARY8BIT@GOTPCREL(%rip), %rcx
LBB0_20:
	movl	(%rcx), %r15d
	orl	(%rax), %r15d
	movq	_DSBCAPS_LOCHARDWARE@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	movl	8(%r14), %r12d
	xorl	%esi, %esi
	movl	%r13d, %eax
	andl	%r12d, %eax
	setne	%sil
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	24(%rax), %ecx
	leaq	L_.str.4(%rip), %rdi
	movl	%r15d, %edx
	xorl	%eax, %eax
	callq	_TRACE
	andl	%r12d, %r13d
	movq	%rbx, %r12
	je	LBB0_23
## %bb.21:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	24(%rax), %ecx
	notl	%ecx
	movq	16(%rax), %rax
	testl	%ecx, %r15d
	jne	LBB0_32
## %bb.22:
	testq	%rax, %rax
	je	LBB0_34
LBB0_23:
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movl	%eax, %edi
	xorl	%esi, %esi
	movl	$272, %edx                      ## imm = 0x110
	callq	_HeapAlloc
	movq	%rax, 40(%r12)
	testq	%rax, %rax
	je	LBB0_36
## %bb.24:
	movq	_DSDDESC_USESYSTEMMEMORY@GOTPCREL(%rip), %r15
	movl	(%r15), %ecx
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	testl	%ecx, 8(%rdx)
	jne	LBB0_26
## %bb.25:
	testl	%r13d, %r13d
	jne	LBB0_27
LBB0_26:
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movl	8(%r12), %edx
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_HeapAlloc
	movq	%rax, %rcx
	movq	40(%r12), %rax
	movq	%rcx, 48(%rax)
	testq	%rcx, %rcx
	je	LBB0_39
LBB0_27:
	testl	%r13d, %r13d
	je	LBB0_38
## %bb.28:
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	leaq	8(%rcx), %r8
	movq	-48(%rbp), %r13                 ## 8-byte Reload
	movq	16(%r13), %rdi
	movl	8(%r14), %edx
	addq	$48, %rax
	addq	$208, %rcx
	movq	%rcx, (%rsp)
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	xorl	%ecx, %ecx
	movq	%rax, %r9
	callq	_IDsDriver_CreateSoundBuffer
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	_FAILED
	testq	%rax, %rax
	je	LBB0_41
## %bb.29:
	leaq	L_.str.6(%rip), %rdi
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	_WARN
	movl	(%r15), %eax
	testl	%eax, 8(%r13)
	je	LBB0_31
## %bb.30:
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	40(%r12), %rcx
	movq	48(%rcx), %rdx
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_HeapFree
LBB0_31:
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	40(%r12), %rdx
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_HeapFree
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	24(%r12), %rdx
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_HeapFree
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movl	%eax, %edi
	xorl	%esi, %esi
	movq	%r12, %rdx
	callq	_HeapFree
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	$0, (%rax)
	jmp	LBB0_35
LBB0_32:
	testq	%rax, %rax
	je	LBB0_34
## %bb.33:
	leaq	L_.str.5(%rip), %rdi
	xorl	%eax, %eax
	callq	_WARN
LBB0_34:
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	24(%r12), %rdx
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_HeapFree
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movl	%eax, %edi
	xorl	%esi, %esi
	movq	%r12, %rdx
	callq	_HeapFree
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	$0, (%rax)
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	24(%rax), %eax
	notl	%eax
	testl	%eax, %r15d
	jne	LBB0_37
LBB0_35:
	movq	_DSERR_GENERIC@GOTPCREL(%rip), %rax
	jmp	LBB0_11
LBB0_36:
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_WARN
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	24(%r12), %rdx
	jmp	LBB0_40
LBB0_37:
	movq	_DSERR_BADFORMAT@GOTPCREL(%rip), %rax
	jmp	LBB0_11
LBB0_38:
	movq	-80(%rbp), %rbx                 ## 8-byte Reload
	movq	-48(%rbp), %r13                 ## 8-byte Reload
	jmp	LBB0_42
LBB0_39:
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_WARN
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	24(%r12), %rdx
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_HeapFree
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	40(%r12), %rdx
LBB0_40:
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_HeapFree
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movl	%eax, %edi
	xorl	%esi, %esi
	movq	%r12, %rdx
	callq	_HeapFree
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	$0, (%rax)
	jmp	LBB0_10
LBB0_41:
	movq	40(%r12), %rax
LBB0_42:
	movl	$1, (%rax)
	addq	$204, %rax
	movq	%rax, %rdi
	callq	_list_init
	movl	$204, %edi
	addq	40(%r12), %rdi
	movq	-64(%rbp), %r15                 ## 8-byte Reload
	leaq	200(%r15), %rsi
	callq	_list_add_head
	movq	40(%r12), %rax
	movq	48(%rax), %rdi
	movl	8(%r12), %esi
	movq	16(%r14), %rax
	xorl	%edx, %edx
	cmpl	$8, 12(%rax)
	sete	%dl
	shll	$7, %edx
	callq	_FillMemory
	xorps	%xmm0, %xmm0
	movups	%xmm0, 184(%r12)
	movq	_STATE_STOPPED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 180(%r12)
	movl	12(%r12), %esi
	movq	_DSOUND_FREQSHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	movl	%esi, %eax
	shll	%cl, %eax
	movq	(%r13), %rcx
	cltd
	idivl	(%rcx)
	movl	%eax, 16(%r12)
	movq	16(%r14), %rax
	imull	(%rax), %esi
	movl	%esi, 20(%r12)
	movq	%r12, %rdi
	callq	_DSOUND_RecalcFormat
	movq	_DSBCAPS_CTRL3D@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 176(%r12)
	je	LBB0_44
## %bb.43:
	movl	$4, 64(%r12)
	xorps	%xmm0, %xmm0
	movups	%xmm0, 128(%r12)
	movups	%xmm0, 144(%r12)
	movups	%xmm0, 160(%r12)
	movq	_DS3D_DEFAULTCONEANGLE@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 120(%r12)
	movq	%rax, 112(%r12)
	movups	%xmm0, 88(%r12)
	movq	$0, 104(%r12)
	movq	_DS3D_DEFAULTCONEOUTSIDEVOLUME@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 80(%r12)
	movq	_DS3D_DEFAULTMINDISTANCE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 76(%r12)
	movq	_DS3D_DEFAULTMAXDISTANCE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 72(%r12)
	movq	_DS3DMODE_NORMAL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 68(%r12)
	movq	_FALSE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 60(%r12)
	movq	%r12, %rdi
	callq	_DSOUND_Calc3DBuffer
	jmp	LBB0_45
LBB0_44:
	leaq	56(%r15), %rdi
	callq	_DSOUND_RecalcVolPan
LBB0_45:
	addq	$32, %r15
	movq	%r15, %rdi
	callq	_RtlInitializeResource
	movq	_DSBCAPS_PRIMARYBUFFER@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 8(%r14)
	jne	LBB0_48
## %bb.46:
	movq	%r13, %rdi
	movq	%r12, %rsi
	callq	_DirectSoundDevice_AddBuffer
	movq	%rax, %rbx
	movq	_DS_OK@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rbx
	je	LBB0_48
## %bb.47:
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	40(%r12), %rcx
	movq	48(%rcx), %rdx
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_HeapFree
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	40(%r12), %rdx
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_HeapFree
	movq	%r15, %rdi
	callq	_RtlDeleteResource
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	24(%r12), %rdx
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_HeapFree
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movl	%eax, %edi
	xorl	%esi, %esi
	movq	%r12, %rdx
	callq	_HeapFree
	xorl	%r12d, %r12d
LBB0_48:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	%r12, (%rax)
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	_DS_OK,8,3                      ## @DS_OK
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"(%p,%p,%p)\n"

	.comm	_DSBSIZE_MIN,8,3                ## @DSBSIZE_MIN
	.comm	_DSBSIZE_MAX,8,3                ## @DSBSIZE_MAX
L_.str.1:                               ## @.str.1
	.asciz	"invalid parameter: dsbd->dwBufferBytes = %d\n"

	.comm	_DSERR_INVALIDPARAM,8,3         ## @DSERR_INVALIDPARAM
	.comm	_HEAP_ZERO_MEMORY,4,2           ## @HEAP_ZERO_MEMORY
L_.str.2:                               ## @.str.2
	.asciz	"out of memory\n"

	.comm	_DSERR_OUTOFMEMORY,8,3          ## @DSERR_OUTOFMEMORY
L_.str.3:                               ## @.str.3
	.asciz	"Created buffer at %p\n"

	.comm	_dsbvt,4,2                      ## @dsbvt
	.comm	_DSCAPS_SECONDARYSTEREO,4,2     ## @DSCAPS_SECONDARYSTEREO
	.comm	_DSCAPS_SECONDARYMONO,4,2       ## @DSCAPS_SECONDARYMONO
	.comm	_DSCAPS_SECONDARY16BIT,4,2      ## @DSCAPS_SECONDARY16BIT
	.comm	_DSCAPS_SECONDARY8BIT,4,2       ## @DSCAPS_SECONDARY8BIT
	.comm	_DSBCAPS_LOCHARDWARE,4,2        ## @DSBCAPS_LOCHARDWARE
L_.str.4:                               ## @.str.4
	.asciz	"use_hw = %d, capf = 0x%08x, device->drvcaps.dwFlags = 0x%08x\n"

L_.str.5:                               ## @.str.5
	.asciz	"Format not supported for hardware buffer\n"

	.comm	_DSERR_BADFORMAT,8,3            ## @DSERR_BADFORMAT
	.comm	_DSERR_GENERIC,8,3              ## @DSERR_GENERIC
	.comm	_DSDDESC_USESYSTEMMEMORY,4,2    ## @DSDDESC_USESYSTEMMEMORY
L_.str.6:                               ## @.str.6
	.asciz	"Failed to create hardware secondary buffer: %08x\n"

	.comm	_STATE_STOPPED,4,2              ## @STATE_STOPPED
	.comm	_DSOUND_FREQSHIFT,4,2           ## @DSOUND_FREQSHIFT
	.comm	_DSBCAPS_CTRL3D,4,2             ## @DSBCAPS_CTRL3D
	.comm	_DS3D_DEFAULTCONEANGLE,8,3      ## @DS3D_DEFAULTCONEANGLE
	.comm	_DS3D_DEFAULTCONEOUTSIDEVOLUME,4,2 ## @DS3D_DEFAULTCONEOUTSIDEVOLUME
	.comm	_DS3D_DEFAULTMINDISTANCE,4,2    ## @DS3D_DEFAULTMINDISTANCE
	.comm	_DS3D_DEFAULTMAXDISTANCE,4,2    ## @DS3D_DEFAULTMAXDISTANCE
	.comm	_DS3DMODE_NORMAL,4,2            ## @DS3DMODE_NORMAL
	.comm	_FALSE,4,2                      ## @FALSE
	.comm	_DSBCAPS_PRIMARYBUFFER,4,2      ## @DSBCAPS_PRIMARYBUFFER
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_IDirectSoundBufferImpl_Create  ; -- Begin function IDirectSoundBufferImpl_Create
	.p2align	2
_IDirectSoundBufferImpl_Create:         ; @IDirectSoundBufferImpl_Create
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x23, x2
	mov	x19, x1
	mov	x22, x0
	ldr	x24, [x2, #16]
Lloh0:
	adrp	x26, _DS_OK@GOTPAGE
Lloh1:
	ldr	x26, [x26, _DS_OK@GOTPAGEOFF]
	ldr	x21, [x26]
	stp	x1, x2, [sp, #8]
	str	x0, [sp]
Lloh2:
	adrp	x0, l_.str@PAGE
Lloh3:
	add	x0, x0, l_.str@PAGEOFF
	bl	_TRACE
	ldr	x8, [x23]
Lloh4:
	adrp	x9, _DSBSIZE_MIN@GOTPAGE
Lloh5:
	ldr	x9, [x9, _DSBSIZE_MIN@GOTPAGEOFF]
Lloh6:
	ldr	x9, [x9]
Lloh7:
	adrp	x10, _DSBSIZE_MAX@GOTPAGE
Lloh8:
	ldr	x10, [x10, _DSBSIZE_MAX@GOTPAGEOFF]
Lloh9:
	ldr	x10, [x10]
	cmp	x8, x9
	ccmp	x8, x10, #0, ge
	b.le	LBB0_2
; %bb.1:
	str	x8, [sp]
Lloh10:
	adrp	x0, l_.str.1@PAGE
Lloh11:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_WARN
	str	xzr, [x19]
Lloh12:
	adrp	x8, _DSERR_INVALIDPARAM@GOTPAGE
Lloh13:
	ldr	x8, [x8, _DSERR_INVALIDPARAM@GOTPAGEOFF]
	b	LBB0_27
LBB0_2:
	bl	_GetProcessHeap
Lloh14:
	adrp	x8, _HEAP_ZERO_MEMORY@GOTPAGE
Lloh15:
	ldr	x8, [x8, _HEAP_ZERO_MEMORY@GOTPAGEOFF]
Lloh16:
	ldr	w1, [x8]
	mov	w2, #272
	bl	_HeapAlloc
	cbz	x0, LBB0_16
; %bb.3:
	mov	x20, x0
	str	x0, [sp]
Lloh17:
	adrp	x0, l_.str.3@PAGE
Lloh18:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_TRACE
	movi.2s	v0, #1
	str	d0, [x20]
	str	x22, [x20, #264]
Lloh19:
	adrp	x8, _dsbvt@GOTPAGE
Lloh20:
	ldr	x8, [x8, _dsbvt@GOTPAGEOFF]
	stp	xzr, x8, [x20, #248]
	add	x0, x20, #176
	ldr	w2, [x23, #24]
	mov	x1, x23
	bl	_CopyMemory
	mov	x0, x24
	bl	_DSOUND_CopyFormat
	str	x0, [x20, #24]
	cbz	x0, LBB0_25
; %bb.4:
	ldr	x8, [x23]
	ldr	x9, [x23, #16]
	ldp	w10, w9, [x9]
                                        ; kill: def $w10 killed $w10 def $x10
	sxtw	x10, w10
	sdiv	x11, x8, x10
	msub	x11, x11, x10, x8
	sub	w12, w8, w11
	add	w10, w10, w12
	cmp	x11, #0
	csel	w8, w8, w10, eq
	mov	x25, x20
	stp	w8, w9, [x25, #8]!
	movi.2d	v0, #0000000000000000
	stp	q0, q0, [x25, #208]
Lloh21:
	adrp	x8, _DSCAPS_SECONDARYSTEREO@GOTPAGE
Lloh22:
	ldr	x8, [x8, _DSCAPS_SECONDARYSTEREO@GOTPAGEOFF]
Lloh23:
	adrp	x9, _DSCAPS_SECONDARYMONO@GOTPAGE
Lloh24:
	ldr	x9, [x9, _DSCAPS_SECONDARYMONO@GOTPAGEOFF]
	ldp	w10, w11, [x24, #8]
	cmp	w10, #2
	csel	x8, x8, x9, eq
Lloh25:
	adrp	x9, _DSCAPS_SECONDARY16BIT@GOTPAGE
Lloh26:
	ldr	x9, [x9, _DSCAPS_SECONDARY16BIT@GOTPAGEOFF]
Lloh27:
	adrp	x10, _DSCAPS_SECONDARY8BIT@GOTPAGE
Lloh28:
	ldr	x10, [x10, _DSCAPS_SECONDARY8BIT@GOTPAGEOFF]
	ldr	w8, [x8]
	cmp	w11, #16
	csel	x9, x9, x10, eq
	ldr	w9, [x9]
	orr	w28, w9, w8
	ldr	w8, [x23, #8]
Lloh29:
	adrp	x9, _DSBCAPS_LOCHARDWARE@GOTPAGE
Lloh30:
	ldr	x9, [x9, _DSBCAPS_LOCHARDWARE@GOTPAGEOFF]
Lloh31:
	ldr	w9, [x9]
	ands	w27, w9, w8
	cset	w8, ne
	ldr	w9, [x22, #24]
	stp	x28, x9, [sp, #8]
	str	x8, [sp]
Lloh32:
	adrp	x0, l_.str.4@PAGE
Lloh33:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_TRACE
	cbz	w27, LBB0_7
; %bb.5:
	ldr	w9, [x22, #24]
	ldr	x8, [x22, #16]
	bics	wzr, w28, w9
	b.ne	LBB0_17
; %bb.6:
	cbz	x8, LBB0_19
LBB0_7:
	bl	_GetProcessHeap
	mov	w1, #0
	mov	w2, #272
	bl	_HeapAlloc
	str	x0, [x20, #40]
	cbz	x0, LBB0_21
; %bb.8:
	ldr	w8, [x22, #8]
Lloh34:
	adrp	x28, _DSDDESC_USESYSTEMMEMORY@GOTPAGE
Lloh35:
	ldr	x28, [x28, _DSDDESC_USESYSTEMMEMORY@GOTPAGEOFF]
	ldr	w9, [x28]
	tst	w9, w8
	b.ne	LBB0_10
; %bb.9:
	cbnz	w27, LBB0_11
LBB0_10:
	bl	_GetProcessHeap
	ldr	w2, [x20, #8]
	mov	w1, #0
	bl	_HeapAlloc
	mov	x8, x0
	ldr	x0, [x20, #40]
	str	x8, [x0, #48]
	cbz	x8, LBB0_23
LBB0_11:
	cbz	w27, LBB0_30
; %bb.12:
	ldr	x8, [x22, #16]
	ldr	w2, [x23, #8]
	add	x5, x0, #48
	add	x6, x20, #208
	mov	x0, x8
	mov	x1, x24
	mov	w3, #0
	mov	x4, x25
	bl	_IDsDriver_CreateSoundBuffer
	mov	x21, x0
	bl	_FAILED
	cbz	x0, LBB0_29
; %bb.13:
	str	x21, [sp]
Lloh36:
	adrp	x0, l_.str.6@PAGE
Lloh37:
	add	x0, x0, l_.str.6@PAGEOFF
	bl	_WARN
	ldr	w8, [x22, #8]
	ldr	w9, [x28]
	tst	w9, w8
	b.eq	LBB0_15
; %bb.14:
	bl	_GetProcessHeap
	ldr	x8, [x20, #40]
	ldr	x2, [x8, #48]
	mov	w1, #0
	bl	_HeapFree
LBB0_15:
	bl	_GetProcessHeap
	ldr	x2, [x20, #40]
	mov	w1, #0
	bl	_HeapFree
	bl	_GetProcessHeap
	ldr	x2, [x20, #24]
	mov	w1, #0
	bl	_HeapFree
	bl	_GetProcessHeap
	mov	w1, #0
	mov	x2, x20
	bl	_HeapFree
	str	xzr, [x19]
	b	LBB0_20
LBB0_16:
Lloh38:
	adrp	x0, l_.str.2@PAGE
Lloh39:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_WARN
	b	LBB0_26
LBB0_17:
	cbz	x8, LBB0_19
; %bb.18:
Lloh40:
	adrp	x0, l_.str.5@PAGE
Lloh41:
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_WARN
LBB0_19:
	bl	_GetProcessHeap
	ldr	x2, [x20, #24]
	mov	w1, #0
	bl	_HeapFree
	bl	_GetProcessHeap
	mov	w1, #0
	mov	x2, x20
	bl	_HeapFree
	str	xzr, [x19]
	ldr	w8, [x22, #24]
	bics	wzr, w28, w8
	b.ne	LBB0_22
LBB0_20:
Lloh42:
	adrp	x8, _DSERR_GENERIC@GOTPAGE
Lloh43:
	ldr	x8, [x8, _DSERR_GENERIC@GOTPAGEOFF]
	b	LBB0_27
LBB0_21:
Lloh44:
	adrp	x0, l_.str.2@PAGE
Lloh45:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_WARN
	bl	_GetProcessHeap
	ldr	x2, [x20, #24]
	b	LBB0_24
LBB0_22:
Lloh46:
	adrp	x8, _DSERR_BADFORMAT@GOTPAGE
Lloh47:
	ldr	x8, [x8, _DSERR_BADFORMAT@GOTPAGEOFF]
	b	LBB0_27
LBB0_23:
Lloh48:
	adrp	x0, l_.str.2@PAGE
Lloh49:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_WARN
	bl	_GetProcessHeap
	ldr	x2, [x20, #24]
	mov	w1, #0
	bl	_HeapFree
	bl	_GetProcessHeap
	ldr	x2, [x20, #40]
LBB0_24:
	mov	w1, #0
	bl	_HeapFree
LBB0_25:
	bl	_GetProcessHeap
	mov	w1, #0
	mov	x2, x20
	bl	_HeapFree
LBB0_26:
	str	xzr, [x19]
Lloh50:
	adrp	x8, _DSERR_OUTOFMEMORY@GOTPAGE
Lloh51:
	ldr	x8, [x8, _DSERR_OUTOFMEMORY@GOTPAGEOFF]
LBB0_27:
	ldr	x21, [x8]
LBB0_28:
	mov	x0, x21
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_29:
	ldr	x0, [x20, #40]
LBB0_30:
	mov	w8, #1
	str	w8, [x0], #204
	bl	_list_init
	ldr	x8, [x20, #40]
	add	x0, x8, #204
	add	x1, x20, #200
	bl	_list_add_head
	ldr	x8, [x20, #40]
	ldr	x0, [x8, #48]
	ldr	w1, [x20, #8]
	ldr	x8, [x23, #16]
	ldr	w8, [x8, #12]
	cmp	w8, #8
	cset	w8, eq
	lsl	w2, w8, #7
	bl	_FillMemory
	stp	xzr, xzr, [x20, #184]
Lloh52:
	adrp	x8, _STATE_STOPPED@GOTPAGE
Lloh53:
	ldr	x8, [x8, _STATE_STOPPED@GOTPAGEOFF]
Lloh54:
	ldr	w8, [x8]
	str	w8, [x20, #180]
	ldr	w8, [x20, #12]
Lloh55:
	adrp	x9, _DSOUND_FREQSHIFT@GOTPAGE
Lloh56:
	ldr	x9, [x9, _DSOUND_FREQSHIFT@GOTPAGEOFF]
Lloh57:
	ldr	w9, [x9]
	lsl	w9, w8, w9
	ldr	x10, [x22]
	ldr	w10, [x10]
	sdiv	w9, w9, w10
	ldr	x10, [x23, #16]
	ldr	w10, [x10]
	mul	w8, w10, w8
	stp	w9, w8, [x20, #16]
	mov	x0, x20
	bl	_DSOUND_RecalcFormat
	ldr	w8, [x20, #176]
Lloh58:
	adrp	x9, _DSBCAPS_CTRL3D@GOTPAGE
Lloh59:
	ldr	x9, [x9, _DSBCAPS_CTRL3D@GOTPAGEOFF]
Lloh60:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_32
; %bb.31:
	mov	w8, #4
	movi.2d	v0, #0000000000000000
	stp	q0, q0, [x20, #128]
	str	q0, [x20, #160]
Lloh61:
	adrp	x9, _DS3D_DEFAULTCONEANGLE@GOTPAGE
Lloh62:
	ldr	x9, [x9, _DS3D_DEFAULTCONEANGLE@GOTPAGEOFF]
Lloh63:
	ldr	x9, [x9]
	stp	x9, x9, [x20, #112]
	stp	xzr, xzr, [x20, #96]
	str	xzr, [x20, #88]
Lloh64:
	adrp	x9, _DS3D_DEFAULTCONEOUTSIDEVOLUME@GOTPAGE
Lloh65:
	ldr	x9, [x9, _DS3D_DEFAULTCONEOUTSIDEVOLUME@GOTPAGEOFF]
Lloh66:
	ldr	w9, [x9]
Lloh67:
	adrp	x10, _DS3D_DEFAULTMINDISTANCE@GOTPAGE
Lloh68:
	ldr	x10, [x10, _DS3D_DEFAULTMINDISTANCE@GOTPAGEOFF]
Lloh69:
	ldr	w10, [x10]
Lloh70:
	adrp	x11, _DS3D_DEFAULTMAXDISTANCE@GOTPAGE
Lloh71:
	ldr	x11, [x11, _DS3D_DEFAULTMAXDISTANCE@GOTPAGEOFF]
	stp	w10, w9, [x20, #76]
Lloh72:
	ldr	w9, [x11]
Lloh73:
	adrp	x10, _DS3DMODE_NORMAL@GOTPAGE
Lloh74:
	ldr	x10, [x10, _DS3DMODE_NORMAL@GOTPAGEOFF]
Lloh75:
	ldr	w10, [x10]
	stp	w10, w9, [x20, #68]
Lloh76:
	adrp	x9, _FALSE@GOTPAGE
Lloh77:
	ldr	x9, [x9, _FALSE@GOTPAGEOFF]
Lloh78:
	ldr	w9, [x9]
	stp	w9, w8, [x20, #60]
	mov	x0, x20
	bl	_DSOUND_Calc3DBuffer
	b	LBB0_33
LBB0_32:
	add	x0, x20, #56
	bl	_DSOUND_RecalcVolPan
LBB0_33:
	add	x24, x20, #32
	mov	x0, x24
	bl	_RtlInitializeResource
	ldr	w8, [x23, #8]
Lloh79:
	adrp	x9, _DSBCAPS_PRIMARYBUFFER@GOTPAGE
Lloh80:
	ldr	x9, [x9, _DSBCAPS_PRIMARYBUFFER@GOTPAGEOFF]
Lloh81:
	ldr	w9, [x9]
	tst	w9, w8
	b.ne	LBB0_36
; %bb.34:
	mov	x0, x22
	mov	x1, x20
	bl	_DirectSoundDevice_AddBuffer
	mov	x21, x0
	ldr	x8, [x26]
	cmp	x0, x8
	b.eq	LBB0_36
; %bb.35:
	bl	_GetProcessHeap
	ldr	x8, [x20, #40]
	ldr	x2, [x8, #48]
	mov	w1, #0
	bl	_HeapFree
	bl	_GetProcessHeap
	ldr	x2, [x20, #40]
	mov	w1, #0
	bl	_HeapFree
	mov	x0, x24
	bl	_RtlDeleteResource
	bl	_GetProcessHeap
	ldr	x2, [x20, #24]
	mov	w1, #0
	bl	_HeapFree
	bl	_GetProcessHeap
	mov	w1, #0
	mov	x2, x20
	bl	_HeapFree
	mov	x20, #0
LBB0_36:
	str	x20, [x19]
	b	LBB0_28
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh34, Lloh35
	.loh AdrpAdd	Lloh36, Lloh37
	.loh AdrpAdd	Lloh38, Lloh39
	.loh AdrpAdd	Lloh40, Lloh41
	.loh AdrpLdrGot	Lloh42, Lloh43
	.loh AdrpAdd	Lloh44, Lloh45
	.loh AdrpLdrGot	Lloh46, Lloh47
	.loh AdrpAdd	Lloh48, Lloh49
	.loh AdrpLdrGot	Lloh50, Lloh51
	.loh AdrpLdrGotLdr	Lloh58, Lloh59, Lloh60
	.loh AdrpLdrGotLdr	Lloh55, Lloh56, Lloh57
	.loh AdrpLdrGotLdr	Lloh52, Lloh53, Lloh54
	.loh AdrpLdrGotLdr	Lloh76, Lloh77, Lloh78
	.loh AdrpLdrGotLdr	Lloh73, Lloh74, Lloh75
	.loh AdrpLdrGotLdr	Lloh70, Lloh71, Lloh72
	.loh AdrpLdrGotLdr	Lloh67, Lloh68, Lloh69
	.loh AdrpLdrGotLdr	Lloh64, Lloh65, Lloh66
	.loh AdrpLdrGotLdr	Lloh61, Lloh62, Lloh63
	.loh AdrpLdrGotLdr	Lloh79, Lloh80, Lloh81
	.cfi_endproc
                                        ; -- End function
	.comm	_DS_OK,8,3                      ; @DS_OK
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"(%p,%p,%p)\n"

	.comm	_DSBSIZE_MIN,8,3                ; @DSBSIZE_MIN
	.comm	_DSBSIZE_MAX,8,3                ; @DSBSIZE_MAX
l_.str.1:                               ; @.str.1
	.asciz	"invalid parameter: dsbd->dwBufferBytes = %d\n"

	.comm	_DSERR_INVALIDPARAM,8,3         ; @DSERR_INVALIDPARAM
	.comm	_HEAP_ZERO_MEMORY,4,2           ; @HEAP_ZERO_MEMORY
l_.str.2:                               ; @.str.2
	.asciz	"out of memory\n"

	.comm	_DSERR_OUTOFMEMORY,8,3          ; @DSERR_OUTOFMEMORY
l_.str.3:                               ; @.str.3
	.asciz	"Created buffer at %p\n"

	.comm	_dsbvt,4,2                      ; @dsbvt
	.comm	_DSCAPS_SECONDARYSTEREO,4,2     ; @DSCAPS_SECONDARYSTEREO
	.comm	_DSCAPS_SECONDARYMONO,4,2       ; @DSCAPS_SECONDARYMONO
	.comm	_DSCAPS_SECONDARY16BIT,4,2      ; @DSCAPS_SECONDARY16BIT
	.comm	_DSCAPS_SECONDARY8BIT,4,2       ; @DSCAPS_SECONDARY8BIT
	.comm	_DSBCAPS_LOCHARDWARE,4,2        ; @DSBCAPS_LOCHARDWARE
l_.str.4:                               ; @.str.4
	.asciz	"use_hw = %d, capf = 0x%08x, device->drvcaps.dwFlags = 0x%08x\n"

l_.str.5:                               ; @.str.5
	.asciz	"Format not supported for hardware buffer\n"

	.comm	_DSERR_BADFORMAT,8,3            ; @DSERR_BADFORMAT
	.comm	_DSERR_GENERIC,8,3              ; @DSERR_GENERIC
	.comm	_DSDDESC_USESYSTEMMEMORY,4,2    ; @DSDDESC_USESYSTEMMEMORY
l_.str.6:                               ; @.str.6
	.asciz	"Failed to create hardware secondary buffer: %08x\n"

	.comm	_STATE_STOPPED,4,2              ; @STATE_STOPPED
	.comm	_DSOUND_FREQSHIFT,4,2           ; @DSOUND_FREQSHIFT
	.comm	_DSBCAPS_CTRL3D,4,2             ; @DSBCAPS_CTRL3D
	.comm	_DS3D_DEFAULTCONEANGLE,8,3      ; @DS3D_DEFAULTCONEANGLE
	.comm	_DS3D_DEFAULTCONEOUTSIDEVOLUME,4,2 ; @DS3D_DEFAULTCONEOUTSIDEVOLUME
	.comm	_DS3D_DEFAULTMINDISTANCE,4,2    ; @DS3D_DEFAULTMINDISTANCE
	.comm	_DS3D_DEFAULTMAXDISTANCE,4,2    ; @DS3D_DEFAULTMAXDISTANCE
	.comm	_DS3DMODE_NORMAL,4,2            ; @DS3DMODE_NORMAL
	.comm	_FALSE,4,2                      ; @FALSE
	.comm	_DSBCAPS_PRIMARYBUFFER,4,2      ; @DSBCAPS_PRIMARYBUFFER
.subsections_via_symbols
