	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_DSOUND_CopyFormat              ## -- Begin function DSOUND_CopyFormat
	.p2align	4, 0x90
_DSOUND_CopyFormat:                     ## @DSOUND_CopyFormat
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	callq	_DSOUND_GetFormatSize
	movl	%eax, %r15d
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movl	%eax, %edi
	xorl	%esi, %esi
	movl	%r15d, %edx
	callq	_HeapAlloc
	movq	%rax, %r14
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	(%rbx), %rax
	movq	_WAVE_FORMAT_PCM@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_3
## %bb.4:
	movq	%r14, %rdi
	movq	%rbx, %rsi
	movl	$4, %edx
	callq	_CopyMemory
	movq	$0, 24(%r14)
	movl	(%r14), %esi
	movl	8(%r14), %eax
	imull	4(%r14), %eax
	leal	7(%rax), %ecx
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	sarl	$3, %ecx
	cmpl	%ecx, %esi
	je	LBB0_6
## %bb.5:
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_WARN
	movl	8(%r14), %eax
	imull	4(%r14), %eax
	leal	7(%rax), %esi
	testl	%eax, %eax
	cmovnsl	%eax, %esi
	sarl	$3, %esi
	movl	%esi, (%r14)
LBB0_6:
	movl	12(%r14), %eax
	imull	16(%r14), %esi
	cmpl	%esi, %eax
	je	LBB0_8
## %bb.7:
	leaq	L_.str.2(%rip), %rdi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	_WARN
	movl	(%r14), %eax
	imull	16(%r14), %eax
	movl	%eax, 12(%r14)
	jmp	LBB0_8
LBB0_1:
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_WARN
	jmp	LBB0_8
LBB0_3:
	movq	%r14, %rdi
	movq	%rbx, %rsi
	movl	%r15d, %edx
	callq	_CopyMemory
LBB0_8:
	movq	%r14, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"out of memory\n"

	.comm	_WAVE_FORMAT_PCM,8,3            ## @WAVE_FORMAT_PCM
L_.str.1:                               ## @.str.1
	.asciz	"Fixing bad nBlockAlign (%u)\n"

L_.str.2:                               ## @.str.2
	.asciz	"Fixing bad nAvgBytesPerSec (%u)\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_DSOUND_CopyFormat              ; -- Begin function DSOUND_CopyFormat
	.p2align	2
_DSOUND_CopyFormat:                     ; @DSOUND_CopyFormat
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x20, x0
	bl	_DSOUND_GetFormatSize
	mov	x21, x0
	bl	_GetProcessHeap
	mov	w1, #0
	mov	x2, x21
	bl	_HeapAlloc
	mov	x19, x0
	cbz	x0, LBB0_6
; %bb.1:
	ldr	x8, [x20]
Lloh0:
	adrp	x9, _WAVE_FORMAT_PCM@GOTPAGE
Lloh1:
	ldr	x9, [x9, _WAVE_FORMAT_PCM@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	mov	x0, x19
	mov	x1, x20
	cmp	x8, x9
	b.ne	LBB0_7
; %bb.2:
	mov	w2, #4
	bl	_CopyMemory
	str	xzr, [x19, #24]
	ldp	w8, w9, [x19]
	ldr	w10, [x19, #8]
	mul	w9, w10, w9
	add	w10, w9, #7
	cmp	w9, #0
	csel	w9, w10, w9, lt
	cmp	w8, w9, asr #3
	b.eq	LBB0_4
; %bb.3:
	str	x8, [sp]
Lloh3:
	adrp	x0, l_.str.1@PAGE
Lloh4:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_WARN
	ldp	w8, w9, [x19, #4]
	mul	w8, w9, w8
	add	w9, w8, #7
	cmp	w8, #0
	csel	w8, w9, w8, lt
	asr	w8, w8, #3
	str	w8, [x19]
LBB0_4:
	ldp	w9, w10, [x19, #12]
	mul	w8, w8, w10
	cmp	w9, w8
	b.eq	LBB0_8
; %bb.5:
	str	x9, [sp]
Lloh5:
	adrp	x0, l_.str.2@PAGE
Lloh6:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_WARN
	ldr	w8, [x19, #16]
	ldr	w9, [x19]
	mul	w8, w9, w8
	str	w8, [x19, #12]
	b	LBB0_8
LBB0_6:
Lloh7:
	adrp	x0, l_.str@PAGE
Lloh8:
	add	x0, x0, l_.str@PAGEOFF
	bl	_WARN
	b	LBB0_8
LBB0_7:
	mov	x2, x21
	bl	_CopyMemory
LBB0_8:
	mov	x0, x19
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"out of memory\n"

	.comm	_WAVE_FORMAT_PCM,8,3            ; @WAVE_FORMAT_PCM
l_.str.1:                               ; @.str.1
	.asciz	"Fixing bad nBlockAlign (%u)\n"

l_.str.2:                               ; @.str.2
	.asciz	"Fixing bad nAvgBytesPerSec (%u)\n"

.subsections_via_symbols
