	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_primarybuffer_SetFormat        ## -- Begin function primarybuffer_SetFormat
	.p2align	4, 0x90
_primarybuffer_SetFormat:               ## @primarybuffer_SetFormat
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	movq	%rdi, %r12
	movq	_DSERR_BUFFERLOST@GOTPCREL(%rip), %rax
	movq	(%rax), %r13
	movq	(%rdi), %rbx
	movq	_DSSCL_WRITEPRIMARY@GOTPCREL(%rip), %rax
	movq	(%rax), %r15
	leaq	L_.str(%rip), %rdi
	movq	%r12, %rsi
	movq	%r14, %rdx
	xorl	%eax, %eax
	callq	_TRACE
	movq	(%r12), %rax
	movq	_DSSCL_NORMAL@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_2
## %bb.1:
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_WARN
	movq	_DSERR_PRIOLEVELNEEDED@GOTPCREL(%rip), %rax
	movq	(%rax), %r13
	jmp	LBB0_52
LBB0_2:
	movq	%r15, -64(%rbp)                 ## 8-byte Spill
	testq	%r14, %r14
	je	LBB0_6
## %bb.3:
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	movslq	28(%r14), %rsi
	movq	(%r14), %rdx
	movl	8(%r14), %ecx
	movl	36(%r14), %r8d
	movl	32(%r14), %r9d
	movl	24(%r14), %ebx
	leaq	L_.str.3(%rip), %rdi
	xorl	%eax, %eax
	pushq	%rbx
	pushq	16(%r14)
	callq	_TRACE
	addq	$16, %rsp
	leaq	20(%r12), %rdi
	movq	_TRUE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	callq	_RtlAcquireResourceExclusive
	leaq	24(%r12), %rdi
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	callq	_EnterCriticalSection
	movq	32(%r12), %rbx
	movl	8(%rbx), %eax
	movl	%eax, -84(%rbp)                 ## 4-byte Spill
	movq	16(%rbx), %rax
	movq	%rax, -104(%rbp)                ## 8-byte Spill
	movq	(%rbx), %rax
	movq	%rax, -96(%rbp)                 ## 8-byte Spill
	movq	%r14, %rdi
	callq	_DSOUND_CopyFormat
	movq	%rax, 32(%r12)
	testq	%rax, %rax
	je	LBB0_7
## %bb.4:
	movq	%rbx, -80(%rbp)                 ## 8-byte Spill
	movq	_DSDDESC_DOMMSYSTEMSETFORMAT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, 120(%r12)
	je	LBB0_8
## %bb.5:
	movq	_DSERR_BUFFERLOST@GOTPCREL(%rip), %r15
	jmp	LBB0_27
LBB0_6:
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_WARN
	movq	_DSERR_INVALIDPARAM@GOTPCREL(%rip), %rax
	movq	(%rax), %r13
	jmp	LBB0_52
LBB0_7:
	movq	%rbx, 32(%r12)
	movq	_DSERR_OUTOFMEMORY@GOTPCREL(%rip), %rax
	movq	(%rax), %r13
	xorl	%r15d, %r15d
	jmp	LBB0_38
LBB0_8:
	movq	112(%r12), %rdi
	testq	%rdi, %rdi
	movq	_DSERR_BUFFERLOST@GOTPCREL(%rip), %r15
	je	LBB0_27
## %bb.9:
	movq	%rax, %rsi
	callq	_IDsDriverBuffer_SetFormat
	movq	%rax, %rbx
	movq	-64(%rbp), %r13                 ## 8-byte Reload
	cmpq	%r13, -72(%rbp)                 ## 8-byte Folded Reload
	jne	LBB0_15
## %bb.10:
	movq	32(%r12), %rdi
	movslq	8(%rdi), %rax
	imulq	$1374389535, %rax, %rax         ## imm = 0x51EB851F
	movq	%rax, %rcx
	shrq	$63, %rcx
	shrq	$32, %rax
	sarl	$5, %eax
	addl	%ecx, %eax
	movslq	8(%r14), %rcx
	imulq	$1374389535, %rcx, %rcx         ## imm = 0x51EB851F
	movq	%rcx, %rdx
	shrq	$63, %rdx
	shrq	$32, %rcx
	sarl	$5, %ecx
	addl	%edx, %ecx
	cmpl	%ecx, %eax
	jne	LBB0_12
## %bb.11:
	movq	_DSERR_BADFORMAT@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rbx
	jne	LBB0_15
LBB0_12:
	movl	28(%r14), %eax
	movq	_WAVE_FORMAT_PCM@GOTPCREL(%rip), %rcx
	movl	$4, %edx
	cmpl	(%rcx), %eax
	je	LBB0_14
## %bb.13:
	movslq	24(%r14), %rdx
	addq	$4, %rdx
LBB0_14:
	movq	(%r15), %rbx
	movq	%r14, %rsi
	callq	_CopyMemory
LBB0_15:
	cmpq	(%r15), %rbx
	je	LBB0_19
## %bb.16:
	movq	%rbx, %rdi
	callq	_FAILED
	testq	%rax, %rax
	je	LBB0_19
## %bb.17:
	movq	-80(%rbp), %r15                 ## 8-byte Reload
	movq	%r15, %rdi
	callq	_DSOUND_GetFormatSize
	movq	%rax, %r14
	leaq	L_.str.4(%rip), %rdi
	xorl	%eax, %eax
	callq	_WARN
	cmpq	%r13, -72(%rbp)                 ## 8-byte Folded Reload
	jne	LBB0_37
## %bb.18:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movq	%rbx, %r13
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	jmp	LBB0_51
LBB0_19:
	movq	_S_FALSE@GOTPCREL(%rip), %rax
	movq	%rbx, %r13
	cmpq	(%rax), %rbx
	jne	LBB0_26
## %bb.20:
	movq	112(%r12), %rdi
	leaq	72(%r12), %rsi
	leaq	64(%r12), %rdx
	movq	_DSBLOCK_ENTIREBUFFER@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	pushq	%rax
	pushq	$0
	callq	_IDsDriverBuffer_Lock
	addq	$16, %rsp
	movq	72(%r12), %rsi
	movq	112(%r12), %rdi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	callq	_IDsDriverBuffer_Unlock
	movq	8(%r12), %rax
	movq	_STATE_PLAYING@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_22
## %bb.21:
	movq	_STATE_STARTING@GOTPCREL(%rip), %rax
	jmp	LBB0_24
LBB0_22:
	movq	_STATE_STOPPING@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_25
## %bb.23:
	movq	_STATE_STOPPED@GOTPCREL(%rip), %rax
LBB0_24:
	movq	(%rax), %rax
	movq	%rax, 8(%r12)
LBB0_25:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 96(%r12)
	movups	%xmm0, 80(%r12)
	movq	_DS_OK@GOTPCREL(%rip), %rax
	movq	(%rax), %r13
LBB0_26:
	movq	%r12, %rdi
	callq	_DSOUND_RecalcPrimary
LBB0_27:
	cmpq	(%r15), %r13
	movq	-80(%rbp), %r15                 ## 8-byte Reload
	jne	LBB0_42
## %bb.28:
	movq	%r12, %rdi
	callq	_DSOUND_PrimaryClose
	movq	_FALSE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_DSOUND_ReopenDevice
	movq	%rax, %r13
	movq	%rax, %rdi
	callq	_FAILED
	testq	%rax, %rax
	je	LBB0_30
## %bb.29:
	leaq	L_.str.5(%rip), %rdi
	movq	%r13, %rsi
	xorl	%eax, %eax
	callq	_WARN
	jmp	LBB0_38
LBB0_30:
	movq	%r12, %rdi
	callq	_DSOUND_PrimaryOpen
	movq	%rax, %r13
	movq	_DS_OK@GOTPCREL(%rip), %rax
	cmpq	(%rax), %r13
	jne	LBB0_36
## %bb.31:
	movslq	8(%r14), %rax
	imulq	$1374389535, %rax, %rax         ## imm = 0x51EB851F
	movq	%rax, %rcx
	shrq	$63, %rcx
	shrq	$32, %rax
	sarl	$5, %eax
	addl	%ecx, %eax
	movq	32(%r12), %rcx
	movslq	8(%rcx), %rcx
	imulq	$1374389535, %rcx, %rcx         ## imm = 0x51EB851F
	movq	%rcx, %rdx
	shrq	$63, %rdx
	shrq	$32, %rcx
	sarl	$5, %ecx
	addl	%edx, %ecx
	cmpl	%ecx, %eax
	je	LBB0_42
## %bb.32:
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	cmpq	%rax, -72(%rbp)                 ## 8-byte Folded Reload
	jne	LBB0_42
## %bb.33:
	cmpq	$0, 72(%r12)
	je	LBB0_42
## %bb.34:
	movq	%r12, %rdi
	callq	_DSOUND_PrimaryClose
	movl	8(%r14), %eax
	movq	32(%r12), %rcx
	movl	%eax, 8(%rcx)
	movq	_TRUE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_DSOUND_ReopenDevice
	movq	%rax, %r13
	movq	%rax, %rdi
	callq	_FAILED
	testq	%rax, %rax
	je	LBB0_39
## %bb.35:
	leaq	L_.str.7(%rip), %rdi
	jmp	LBB0_41
LBB0_36:
	leaq	L_.str.6(%rip), %rdi
	xorl	%eax, %eax
	callq	_WARN
	jmp	LBB0_38
LBB0_37:
	movq	32(%r12), %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	_CopyMemory
	movq	_DS_OK@GOTPCREL(%rip), %rax
	movq	(%rax), %r13
LBB0_38:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	jmp	LBB0_51
LBB0_39:
	movq	%r12, %rdi
	callq	_DSOUND_PrimaryOpen
	movq	%rax, %r13
	movq	%rax, %rdi
	callq	_FAILED
	testq	%rax, %rax
	je	LBB0_42
## %bb.40:
	leaq	L_.str.8(%rip), %rdi
LBB0_41:
	movq	%r13, %rsi
	xorl	%eax, %eax
	callq	_WARN
LBB0_42:
	movl	64(%r12), %esi
	movq	%r12, %rdi
	callq	_DSOUND_bufpos_to_mixpos
	movl	%eax, 56(%r12)
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movl	56(%r12), %ecx
	movl	60(%r12), %edx
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_HeapReAlloc
	movl	%eax, 60(%r12)
	movl	56(%r12), %esi
	movl	%eax, %edi
	xorl	%edx, %edx
	callq	_FillMemory
	movq	_mixfunctions@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movq	32(%r12), %rax
	movq	16(%rax), %rcx
	leaq	7(%rcx), %rsi
	testq	%rcx, %rcx
	cmovnsq	%rcx, %rsi
	sarq	$3, %rsi
	movl	-4(%rdx,%rsi,4), %edx
	movl	%edx, 52(%r12)
	movq	_normfunctions@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	movl	-4(%rdx,%rsi,4), %edx
	movl	%edx, 48(%r12)
	movl	-84(%rbp), %edx                 ## 4-byte Reload
	cmpl	8(%rax), %edx
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	jne	LBB0_46
## %bb.43:
	cmpq	%rcx, -104(%rbp)                ## 8-byte Folded Reload
	jne	LBB0_46
## %bb.44:
	movq	-96(%rbp), %rcx                 ## 8-byte Reload
	cmpq	(%rax), %rcx
	je	LBB0_50
LBB0_46:
	cmpl	$0, 16(%r12)
	jle	LBB0_50
## %bb.47:
	movq	%r13, -64(%rbp)                 ## 8-byte Spill
	movq	40(%r12), %r14
	xorl	%ebx, %ebx
	movq	_FALSE@GOTPCREL(%rip), %r13
	movq	_TRUE@GOTPCREL(%rip), %r15
	.p2align	4, 0x90
LBB0_48:                                ## =>This Inner Loop Header: Depth=1
	movq	(%r14,%rbx,8), %rdi
	addq	$4, %rdi
	movl	(%r15), %esi
	callq	_RtlAcquireResourceExclusive
	movq	(%r14,%rbx,8), %rdi
	movl	24(%rdi), %eax
	movq	_DSOUND_FREQSHIFT@GOTPCREL(%rip), %rcx
	movzbl	(%rcx), %ecx
	shll	%cl, %eax
	movq	32(%r12), %rcx
	cltd
	idivl	8(%rcx)
	movl	%eax, (%rdi)
	callq	_DSOUND_RecalcFormat
	movq	(%r14,%rbx,8), %rdi
	movl	16(%rdi), %edx
	movl	(%r13), %ecx
	xorl	%esi, %esi
	callq	_DSOUND_MixToTemporary
	movq	(%r14,%rbx,8), %rdi
	movq	$0, 8(%rdi)
	addq	$4, %rdi
	callq	_RtlReleaseResource
	incq	%rbx
	cmpl	16(%r12), %ebx
	jl	LBB0_48
## %bb.49:
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movq	-80(%rbp), %r15                 ## 8-byte Reload
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movq	-64(%rbp), %r13                 ## 8-byte Reload
	jmp	LBB0_51
LBB0_50:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
LBB0_51:
	callq	_LeaveCriticalSection
	movq	%rbx, %rdi
	callq	_RtlReleaseResource
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movl	%eax, %edi
	xorl	%esi, %esi
	movq	%r15, %rdx
	callq	_HeapFree
LBB0_52:
	movq	%r13, %rax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DSERR_BUFFERLOST,8,3           ## @DSERR_BUFFERLOST
	.comm	_DSSCL_WRITEPRIMARY,8,3         ## @DSSCL_WRITEPRIMARY
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"(%p,%p)\n"

	.comm	_DSSCL_NORMAL,8,3               ## @DSSCL_NORMAL
L_.str.1:                               ## @.str.1
	.asciz	"failed priority check!\n"

	.comm	_DSERR_PRIOLEVELNEEDED,8,3      ## @DSERR_PRIOLEVELNEEDED
L_.str.2:                               ## @.str.2
	.asciz	"invalid parameter: wfex==NULL!\n"

	.comm	_DSERR_INVALIDPARAM,8,3         ## @DSERR_INVALIDPARAM
L_.str.3:                               ## @.str.3
	.asciz	"(formattag=0x%04x,chans=%d,samplerate=%d,bytespersec=%d,blockalign=%d,bitspersamp=%d,cbSize=%d)\n"

	.comm	_TRUE,4,2                       ## @TRUE
	.comm	_DSERR_OUTOFMEMORY,8,3          ## @DSERR_OUTOFMEMORY
	.comm	_DSDDESC_DOMMSYSTEMSETFORMAT,4,2 ## @DSDDESC_DOMMSYSTEMSETFORMAT
	.comm	_DSERR_BADFORMAT,8,3            ## @DSERR_BADFORMAT
	.comm	_WAVE_FORMAT_PCM,4,2            ## @WAVE_FORMAT_PCM
L_.str.4:                               ## @.str.4
	.asciz	"IDsDriverBuffer_SetFormat failed\n"

	.comm	_DS_OK,8,3                      ## @DS_OK
	.comm	_S_FALSE,8,3                    ## @S_FALSE
	.comm	_DSBLOCK_ENTIREBUFFER,4,2       ## @DSBLOCK_ENTIREBUFFER
	.comm	_STATE_PLAYING,8,3              ## @STATE_PLAYING
	.comm	_STATE_STARTING,8,3             ## @STATE_STARTING
	.comm	_STATE_STOPPING,8,3             ## @STATE_STOPPING
	.comm	_STATE_STOPPED,8,3              ## @STATE_STOPPED
	.comm	_FALSE,4,2                      ## @FALSE
L_.str.5:                               ## @.str.5
	.asciz	"DSOUND_ReopenDevice failed: %08x\n"

L_.str.6:                               ## @.str.6
	.asciz	"DSOUND_PrimaryOpen failed\n"

L_.str.7:                               ## @.str.7
	.asciz	"DSOUND_ReopenDevice(2) failed: %08x\n"

L_.str.8:                               ## @.str.8
	.asciz	"DSOUND_PrimaryOpen(2) failed: %08x\n"

	.comm	_mixfunctions,8,3               ## @mixfunctions
	.comm	_normfunctions,8,3              ## @normfunctions
	.comm	_DSOUND_FREQSHIFT,4,2           ## @DSOUND_FREQSHIFT
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_primarybuffer_SetFormat        ; -- Begin function primarybuffer_SetFormat
	.p2align	2
_primarybuffer_SetFormat:               ; @primarybuffer_SetFormat
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #160
	.cfi_def_cfa_offset 160
	stp	x28, x27, [sp, #64]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #80]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #96]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #112]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #128]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #144]            ; 16-byte Folded Spill
	add	x29, sp, #144
	.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	x24, x1
	mov	x22, x0
Lloh0:
	adrp	x28, _DSERR_BUFFERLOST@GOTPAGE
Lloh1:
	ldr	x28, [x28, _DSERR_BUFFERLOST@GOTPAGEOFF]
	ldr	x23, [x28]
	ldr	x26, [x0]
Lloh2:
	adrp	x8, _DSSCL_WRITEPRIMARY@GOTPAGE
Lloh3:
	ldr	x8, [x8, _DSSCL_WRITEPRIMARY@GOTPAGEOFF]
Lloh4:
	ldr	x27, [x8]
Lloh5:
	adrp	x0, l_.str@PAGE
Lloh6:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x22
	mov	x2, x24
	bl	_TRACE
	ldr	x8, [x22]
Lloh7:
	adrp	x9, _DSSCL_NORMAL@GOTPAGE
Lloh8:
	ldr	x9, [x9, _DSSCL_NORMAL@GOTPAGEOFF]
Lloh9:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_2
; %bb.1:
Lloh10:
	adrp	x0, l_.str.1@PAGE
Lloh11:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_WARN
Lloh12:
	adrp	x8, _DSERR_PRIOLEVELNEEDED@GOTPAGE
Lloh13:
	ldr	x8, [x8, _DSERR_PRIOLEVELNEEDED@GOTPAGEOFF]
Lloh14:
	ldr	x23, [x8]
	b	LBB0_48
LBB0_2:
	cbz	x24, LBB0_11
; %bb.3:
	ldr	x2, [x24]
	ldr	x8, [x24, #16]
	ldr	w9, [x24, #8]
	ldp	w11, w10, [x24, #32]
	ldp	w12, w1, [x24, #24]
                                        ; kill: def $w1 killed $w1 def $x1
	sxtw	x1, w1
	stp	x8, x12, [sp, #24]
	stp	x10, x11, [sp, #8]
	str	x9, [sp]
Lloh15:
	adrp	x0, l_.str.3@PAGE
Lloh16:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_TRACE
	add	x19, x22, #20
Lloh17:
	adrp	x25, _TRUE@GOTPAGE
Lloh18:
	ldr	x25, [x25, _TRUE@GOTPAGEOFF]
	ldr	w1, [x25]
	mov	x0, x19
	bl	_RtlAcquireResourceExclusive
	add	x21, x22, #24
	mov	x0, x21
	bl	_EnterCriticalSection
	ldr	x20, [x22, #32]
	ldr	w8, [x20, #8]
	str	w8, [sp, #56]                   ; 4-byte Folded Spill
	ldr	x9, [x20, #16]
	ldr	x8, [x20]
	stp	x8, x9, [sp, #40]               ; 16-byte Folded Spill
	mov	x0, x24
	bl	_DSOUND_CopyFormat
	str	x0, [x22, #32]
	cbz	x0, LBB0_12
; %bb.4:
	ldr	w8, [x22, #120]
Lloh19:
	adrp	x9, _DSDDESC_DOMMSYSTEMSETFORMAT@GOTPAGE
Lloh20:
	ldr	x9, [x9, _DSDDESC_DOMMSYSTEMSETFORMAT@GOTPAGEOFF]
Lloh21:
	ldr	w9, [x9]
	tst	w9, w8
	b.ne	LBB0_27
; %bb.5:
	mov	x1, x0
	ldr	x0, [x22, #112]
	cbz	x0, LBB0_27
; %bb.6:
	bl	_IDsDriverBuffer_SetFormat
	mov	x23, x0
	cmp	x26, x27
	b.ne	LBB0_15
; %bb.7:
	ldr	x0, [x22, #32]
	ldrsw	x8, [x0, #8]
	mov	w9, #34079
	movk	w9, #20971, lsl #16
	mul	x8, x8, x9
	lsr	x10, x8, #32
	lsr	x8, x8, #63
	add	w8, w8, w10, asr #5
	ldrsw	x10, [x24, #8]
	mul	x9, x10, x9
	lsr	x10, x9, #32
	lsr	x9, x9, #63
	add	w9, w9, w10, asr #5
	cmp	w8, w9
	b.ne	LBB0_9
; %bb.8:
Lloh22:
	adrp	x8, _DSERR_BADFORMAT@GOTPAGE
Lloh23:
	ldr	x8, [x8, _DSERR_BADFORMAT@GOTPAGEOFF]
Lloh24:
	ldr	x8, [x8]
	cmp	x23, x8
	b.ne	LBB0_15
LBB0_9:
	ldr	w8, [x24, #28]
Lloh25:
	adrp	x9, _WAVE_FORMAT_PCM@GOTPAGE
Lloh26:
	ldr	x9, [x9, _WAVE_FORMAT_PCM@GOTPAGEOFF]
Lloh27:
	ldr	w9, [x9]
	cmp	w8, w9
	b.ne	LBB0_13
; %bb.10:
	mov	w2, #4
	b	LBB0_14
LBB0_11:
Lloh28:
	adrp	x0, l_.str.2@PAGE
Lloh29:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_WARN
Lloh30:
	adrp	x8, _DSERR_INVALIDPARAM@GOTPAGE
Lloh31:
	ldr	x8, [x8, _DSERR_INVALIDPARAM@GOTPAGEOFF]
Lloh32:
	ldr	x23, [x8]
	b	LBB0_48
LBB0_12:
	str	x20, [x22, #32]
Lloh33:
	adrp	x8, _DSERR_OUTOFMEMORY@GOTPAGE
Lloh34:
	ldr	x8, [x8, _DSERR_OUTOFMEMORY@GOTPAGEOFF]
Lloh35:
	ldr	x23, [x8]
	mov	x20, #0
	b	LBB0_47
LBB0_13:
	ldrsw	x8, [x24, #24]
	add	x2, x8, #4
LBB0_14:
	ldr	x23, [x28]
	mov	x1, x24
	bl	_CopyMemory
LBB0_15:
	ldr	x8, [x28]
	cmp	x23, x8
	b.eq	LBB0_19
; %bb.16:
	mov	x0, x23
	bl	_FAILED
	cbz	x0, LBB0_19
; %bb.17:
	mov	x0, x20
	bl	_DSOUND_GetFormatSize
	mov	x24, x0
Lloh36:
	adrp	x0, l_.str.4@PAGE
Lloh37:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_WARN
	cmp	x26, x27
	b.eq	LBB0_47
; %bb.18:
	ldr	x0, [x22, #32]
	mov	x1, x20
	mov	x2, x24
	bl	_CopyMemory
Lloh38:
	adrp	x8, _DS_OK@GOTPAGE
Lloh39:
	ldr	x8, [x8, _DS_OK@GOTPAGEOFF]
Lloh40:
	ldr	x23, [x8]
	b	LBB0_47
LBB0_19:
Lloh41:
	adrp	x8, _S_FALSE@GOTPAGE
Lloh42:
	ldr	x8, [x8, _S_FALSE@GOTPAGEOFF]
Lloh43:
	ldr	x8, [x8]
	cmp	x23, x8
	b.ne	LBB0_26
; %bb.20:
	ldr	x0, [x22, #112]
	add	x1, x22, #72
	add	x2, x22, #64
Lloh44:
	adrp	x8, _DSBLOCK_ENTIREBUFFER@GOTPAGE
Lloh45:
	ldr	x8, [x8, _DSBLOCK_ENTIREBUFFER@GOTPAGEOFF]
Lloh46:
	ldr	w7, [x8]
	mov	x3, #0
	mov	x4, #0
	mov	w5, #0
	mov	w6, #0
	bl	_IDsDriverBuffer_Lock
	ldr	x0, [x22, #112]
	ldr	x1, [x22, #72]
	mov	w2, #0
	mov	x3, #0
	mov	w4, #0
	bl	_IDsDriverBuffer_Unlock
	ldr	x8, [x22, #8]
Lloh47:
	adrp	x9, _STATE_PLAYING@GOTPAGE
Lloh48:
	ldr	x9, [x9, _STATE_PLAYING@GOTPAGEOFF]
Lloh49:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_22
; %bb.21:
Lloh50:
	adrp	x8, _STATE_STARTING@GOTPAGE
Lloh51:
	ldr	x8, [x8, _STATE_STARTING@GOTPAGEOFF]
	b	LBB0_24
LBB0_22:
Lloh52:
	adrp	x9, _STATE_STOPPING@GOTPAGE
Lloh53:
	ldr	x9, [x9, _STATE_STOPPING@GOTPAGEOFF]
Lloh54:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_25
; %bb.23:
Lloh55:
	adrp	x8, _STATE_STOPPED@GOTPAGE
Lloh56:
	ldr	x8, [x8, _STATE_STOPPED@GOTPAGEOFF]
LBB0_24:
	ldr	x8, [x8]
	str	x8, [x22, #8]
LBB0_25:
	movi.2d	v0, #0000000000000000
	stp	q0, q0, [x22, #80]
Lloh57:
	adrp	x8, _DS_OK@GOTPAGE
Lloh58:
	ldr	x8, [x8, _DS_OK@GOTPAGEOFF]
Lloh59:
	ldr	x23, [x8]
LBB0_26:
	mov	x0, x22
	bl	_DSOUND_RecalcPrimary
LBB0_27:
	ldr	x8, [x28]
	cmp	x23, x8
	b.ne	LBB0_40
; %bb.28:
	mov	x0, x22
	bl	_DSOUND_PrimaryClose
Lloh60:
	adrp	x8, _FALSE@GOTPAGE
Lloh61:
	ldr	x8, [x8, _FALSE@GOTPAGEOFF]
Lloh62:
	ldr	w1, [x8]
	mov	x0, x22
	bl	_DSOUND_ReopenDevice
	mov	x23, x0
	bl	_FAILED
	cbz	x0, LBB0_30
; %bb.29:
	str	x23, [sp]
Lloh63:
	adrp	x0, l_.str.5@PAGE
Lloh64:
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_WARN
	b	LBB0_47
LBB0_30:
	mov	x0, x22
	bl	_DSOUND_PrimaryOpen
	mov	x23, x0
Lloh65:
	adrp	x8, _DS_OK@GOTPAGE
Lloh66:
	ldr	x8, [x8, _DS_OK@GOTPAGEOFF]
Lloh67:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_36
; %bb.31:
	ldrsw	x8, [x24, #8]
	mov	w9, #34079
	movk	w9, #20971, lsl #16
	mul	x8, x8, x9
	lsr	x10, x8, #32
	lsr	x8, x8, #63
	add	w8, w8, w10, asr #5
	ldr	x10, [x22, #32]
	ldrsw	x10, [x10, #8]
	mul	x9, x10, x9
	lsr	x10, x9, #32
	lsr	x9, x9, #63
	add	w9, w9, w10, asr #5
	cmp	w8, w9
	b.eq	LBB0_40
; %bb.32:
	cmp	x26, x27
	b.ne	LBB0_40
; %bb.33:
	ldr	x8, [x22, #72]
	cbz	x8, LBB0_40
; %bb.34:
	mov	x0, x22
	bl	_DSOUND_PrimaryClose
	ldr	w8, [x24, #8]
	ldr	x9, [x22, #32]
	str	w8, [x9, #8]
	ldr	w1, [x25]
	mov	x0, x22
	bl	_DSOUND_ReopenDevice
	mov	x23, x0
	bl	_FAILED
	cbz	x0, LBB0_37
; %bb.35:
	str	x23, [sp]
Lloh68:
	adrp	x0, l_.str.7@PAGE
Lloh69:
	add	x0, x0, l_.str.7@PAGEOFF
	b	LBB0_39
LBB0_36:
Lloh70:
	adrp	x0, l_.str.6@PAGE
Lloh71:
	add	x0, x0, l_.str.6@PAGEOFF
	bl	_WARN
	b	LBB0_47
LBB0_37:
	mov	x0, x22
	bl	_DSOUND_PrimaryOpen
	mov	x23, x0
	bl	_FAILED
	cbz	x0, LBB0_40
; %bb.38:
	str	x23, [sp]
Lloh72:
	adrp	x0, l_.str.8@PAGE
Lloh73:
	add	x0, x0, l_.str.8@PAGEOFF
LBB0_39:
	bl	_WARN
LBB0_40:
	ldr	w1, [x22, #64]
	mov	x0, x22
	bl	_DSOUND_bufpos_to_mixpos
	str	w0, [x22, #56]
	bl	_GetProcessHeap
	ldp	w3, w2, [x22, #56]
	mov	w1, #0
	bl	_HeapReAlloc
	str	w0, [x22, #60]
	ldr	w1, [x22, #56]
	mov	w2, #0
	bl	_FillMemory
Lloh74:
	adrp	x8, _mixfunctions@GOTPAGE
Lloh75:
	ldr	x8, [x8, _mixfunctions@GOTPAGEOFF]
Lloh76:
	ldr	x10, [x8]
	ldr	x8, [x22, #32]
	ldr	x9, [x8, #16]
	add	x11, x9, #7
	cmp	x9, #0
	csel	x11, x11, x9, lt
	asr	x11, x11, #3
	lsl	x11, x11, #2
	sub	x11, x11, #4
	ldr	w10, [x10, x11]
	str	w10, [x22, #52]
Lloh77:
	adrp	x10, _normfunctions@GOTPAGE
Lloh78:
	ldr	x10, [x10, _normfunctions@GOTPAGEOFF]
Lloh79:
	ldr	x10, [x10]
	ldr	w10, [x10, x11]
	str	w10, [x22, #48]
	ldr	w10, [x8, #8]
	ldr	w11, [sp, #56]                  ; 4-byte Folded Reload
	cmp	w11, w10
	b.ne	LBB0_43
; %bb.41:
	ldr	x10, [sp, #48]                  ; 8-byte Folded Reload
	cmp	x10, x9
	b.ne	LBB0_43
; %bb.42:
	ldr	x8, [x8]
	ldr	x9, [sp, #40]                   ; 8-byte Folded Reload
	cmp	x9, x8
	b.eq	LBB0_47
LBB0_43:
	ldr	w8, [x22, #16]
	cmp	w8, #1
	b.lt	LBB0_47
; %bb.44:
	str	x19, [sp, #56]                  ; 8-byte Folded Spill
	mov	x24, #0
	ldr	x26, [x22, #40]
Lloh80:
	adrp	x27, _DSOUND_FREQSHIFT@GOTPAGE
Lloh81:
	ldr	x27, [x27, _DSOUND_FREQSHIFT@GOTPAGEOFF]
Lloh82:
	adrp	x28, _FALSE@GOTPAGE
Lloh83:
	ldr	x28, [x28, _FALSE@GOTPAGEOFF]
LBB0_45:                                ; =>This Inner Loop Header: Depth=1
	lsl	x19, x24, #3
	ldr	x8, [x26, x19]
	add	x0, x8, #4
	ldr	w1, [x25]
	bl	_RtlAcquireResourceExclusive
	ldr	x0, [x26, x19]
	ldr	w8, [x0, #24]
	ldr	w9, [x27]
	lsl	w8, w8, w9
	ldr	x9, [x22, #32]
	ldr	w9, [x9, #8]
	sdiv	w8, w8, w9
	str	w8, [x0]
	bl	_DSOUND_RecalcFormat
	ldr	x0, [x26, x19]
	ldr	w2, [x0, #16]
	ldr	w3, [x28]
	mov	w1, #0
	bl	_DSOUND_MixToTemporary
	ldr	x8, [x26, x19]
	str	xzr, [x8, #8]
	add	x0, x8, #4
	bl	_RtlReleaseResource
	ldr	w8, [x22, #16]
	add	x24, x24, #1
	cmp	w24, w8
	b.lt	LBB0_45
; %bb.46:
	ldr	x19, [sp, #56]                  ; 8-byte Folded Reload
LBB0_47:
	mov	x0, x21
	bl	_LeaveCriticalSection
	mov	x0, x19
	bl	_RtlReleaseResource
	bl	_GetProcessHeap
	mov	w1, #0
	mov	x2, x20
	bl	_HeapFree
LBB0_48:
	mov	x0, x23
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #96]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #80]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #160
	ret
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpAdd	Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpLdrGotLdr	Lloh41, Lloh42, Lloh43
	.loh AdrpLdrGotLdr	Lloh47, Lloh48, Lloh49
	.loh AdrpLdrGotLdr	Lloh44, Lloh45, Lloh46
	.loh AdrpLdrGot	Lloh50, Lloh51
	.loh AdrpLdrGotLdr	Lloh52, Lloh53, Lloh54
	.loh AdrpLdrGot	Lloh55, Lloh56
	.loh AdrpLdrGotLdr	Lloh57, Lloh58, Lloh59
	.loh AdrpLdrGotLdr	Lloh60, Lloh61, Lloh62
	.loh AdrpAdd	Lloh63, Lloh64
	.loh AdrpLdrGotLdr	Lloh65, Lloh66, Lloh67
	.loh AdrpAdd	Lloh68, Lloh69
	.loh AdrpAdd	Lloh70, Lloh71
	.loh AdrpAdd	Lloh72, Lloh73
	.loh AdrpLdrGotLdr	Lloh77, Lloh78, Lloh79
	.loh AdrpLdrGotLdr	Lloh74, Lloh75, Lloh76
	.loh AdrpLdrGot	Lloh82, Lloh83
	.loh AdrpLdrGot	Lloh80, Lloh81
	.cfi_endproc
                                        ; -- End function
	.comm	_DSERR_BUFFERLOST,8,3           ; @DSERR_BUFFERLOST
	.comm	_DSSCL_WRITEPRIMARY,8,3         ; @DSSCL_WRITEPRIMARY
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"(%p,%p)\n"

	.comm	_DSSCL_NORMAL,8,3               ; @DSSCL_NORMAL
l_.str.1:                               ; @.str.1
	.asciz	"failed priority check!\n"

	.comm	_DSERR_PRIOLEVELNEEDED,8,3      ; @DSERR_PRIOLEVELNEEDED
l_.str.2:                               ; @.str.2
	.asciz	"invalid parameter: wfex==NULL!\n"

	.comm	_DSERR_INVALIDPARAM,8,3         ; @DSERR_INVALIDPARAM
l_.str.3:                               ; @.str.3
	.asciz	"(formattag=0x%04x,chans=%d,samplerate=%d,bytespersec=%d,blockalign=%d,bitspersamp=%d,cbSize=%d)\n"

	.comm	_TRUE,4,2                       ; @TRUE
	.comm	_DSERR_OUTOFMEMORY,8,3          ; @DSERR_OUTOFMEMORY
	.comm	_DSDDESC_DOMMSYSTEMSETFORMAT,4,2 ; @DSDDESC_DOMMSYSTEMSETFORMAT
	.comm	_DSERR_BADFORMAT,8,3            ; @DSERR_BADFORMAT
	.comm	_WAVE_FORMAT_PCM,4,2            ; @WAVE_FORMAT_PCM
l_.str.4:                               ; @.str.4
	.asciz	"IDsDriverBuffer_SetFormat failed\n"

	.comm	_DS_OK,8,3                      ; @DS_OK
	.comm	_S_FALSE,8,3                    ; @S_FALSE
	.comm	_DSBLOCK_ENTIREBUFFER,4,2       ; @DSBLOCK_ENTIREBUFFER
	.comm	_STATE_PLAYING,8,3              ; @STATE_PLAYING
	.comm	_STATE_STARTING,8,3             ; @STATE_STARTING
	.comm	_STATE_STOPPING,8,3             ; @STATE_STOPPING
	.comm	_STATE_STOPPED,8,3              ; @STATE_STOPPED
	.comm	_FALSE,4,2                      ; @FALSE
l_.str.5:                               ; @.str.5
	.asciz	"DSOUND_ReopenDevice failed: %08x\n"

l_.str.6:                               ; @.str.6
	.asciz	"DSOUND_PrimaryOpen failed\n"

l_.str.7:                               ; @.str.7
	.asciz	"DSOUND_ReopenDevice(2) failed: %08x\n"

l_.str.8:                               ; @.str.8
	.asciz	"DSOUND_PrimaryOpen(2) failed: %08x\n"

	.comm	_mixfunctions,8,3               ; @mixfunctions
	.comm	_normfunctions,8,3              ; @normfunctions
	.comm	_DSOUND_FREQSHIFT,4,2           ; @DSOUND_FREQSHIFT
.subsections_via_symbols
