	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function DSOUND_MixInBuffer
_DSOUND_MixInBuffer:                    ## @DSOUND_MixInBuffer
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r15
	movq	%rsi, %r12
	movq	%rdi, %rbx
	movq	80(%rdi), %r13
	testq	%r13, %r13
	jne	LBB0_2
## %bb.1:
	movq	72(%rbx), %rax
	movq	(%rax), %r13
LBB0_2:
	movslq	(%rbx), %rsi
	movq	8(%rbx), %rdx
	movq	16(%rbx), %rcx
	movl	60(%rbx), %r8d
	leaq	L_.str(%rip), %rdi
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
                                        ## kill: def $esi killed $esi killed $rsi
	xorl	%eax, %eax
	callq	_TRACE
	leaq	L_.str.1(%rip), %rdi
	movq	%rbx, %rsi
	movq	%r12, %rdx
	movq	%r15, %rcx
	xorl	%eax, %eax
	callq	_TRACE
	movslq	(%rbx), %rax
	movslq	%r15d, %r14
	addq	%r14, %rax
	xorl	%edi, %edi
	cmpq	%rax, 8(%rbx)
	setge	%dil
	callq	_assert
	movq	48(%rbx), %rax
	movq	32(%rax), %rax
	movl	(%rax), %ecx
	movl	%r14d, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	movq	%r12, -48(%rbp)                 ## 8-byte Spill
	je	LBB0_4
## %bb.3:
	movl	%edx, %r14d
	leaq	L_.str.2(%rip), %rdi
	movl	%r15d, %esi
	movl	%ecx, %edx
	callq	_ERR
	subl	%r14d, %r15d
LBB0_4:
	movq	16(%rbx), %r12
	movslq	(%rbx), %rsi
	movslq	%r15d, %r14
	addq	%r14, %rsi
	movq	%rbx, %rdi
	callq	_DSOUND_bufpos_to_secpos
	subq	16(%rbx), %rax
	movq	_TRUE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movq	%rbx, %rdi
	movq	%r12, %rsi
	movq	%rax, %rdx
	callq	_DSOUND_MixToTemporary
	cmpq	$0, 64(%rbx)
	je	LBB0_5
## %bb.6:
	movq	48(%rbx), %rax
	movq	24(%rax), %r13
	jmp	LBB0_7
LBB0_5:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	leaq	(%r13,%rax,4), %r13
LBB0_7:
	movq	-48(%rbp), %r12                 ## 8-byte Reload
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_DSOUND_MixerVol
	testq	%rax, %rax
	cmovneq	%rax, %r13
	movq	48(%rbx), %rdi
	movq	%r12, %rsi
	callq	_DSOUND_bufpos_to_mixpos
	leaq	(%r14,%r12), %rdx
	movq	48(%rbx), %rcx
	movq	%r12, %rsi
	movq	(%rcx), %r12
	cmpq	%r12, %rdx
	jle	LBB0_8
## %bb.9:
	subq	%rsi, %r12
	addq	8(%rcx), %rax
	movq	%r13, %rdi
	movq	%rax, %rsi
	movl	%r12d, %edx
	callq	*16(%rcx)
	movq	48(%rbx), %rax
	leaq	(,%r12,4), %rdi
	addq	%r13, %rdi
	movq	8(%rax), %rsi
	subl	%r12d, %r15d
	movl	%r15d, %edx
	callq	*16(%rax)
	jmp	LBB0_10
LBB0_8:
	addq	8(%rcx), %rax
	movq	%r13, %rdi
	movq	%rax, %rsi
	movl	%r15d, %edx
	callq	*16(%rcx)
LBB0_10:
	movq	8(%rbx), %rdx
	movq	16(%rbx), %r15
	movslq	(%rbx), %rsi
	addq	%r14, %rsi
	movl	%esi, (%rbx)
	cmpq	%rsi, %rdx
	jg	LBB0_18
## %bb.11:
	jge	LBB0_13
## %bb.12:
	leaq	L_.str.3(%rip), %rdi
                                        ## kill: def $esi killed $esi killed $rsi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_ERR
LBB0_13:
	movq	_DSBPLAY_LOOPING@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 24(%rbx)
	je	LBB0_15
## %bb.14:
	movl	8(%rbx), %eax
	subl	%eax, (%rbx)
	jmp	LBB0_17
LBB0_15:
	movslq	(%rbx), %rax
	cmpq	%rax, 8(%rbx)
	jg	LBB0_17
## %bb.16:
	movq	$0, 16(%rbx)
	movl	$0, (%rbx)
	movq	_STATE_STOPPED@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 32(%rbx)
LBB0_17:
	movq	%rbx, %rdi
	callq	_DSOUND_RecalcFreqAcc
	movslq	(%rbx), %rsi
LBB0_18:
	movq	%rbx, %rdi
	callq	_DSOUND_bufpos_to_secpos
	movq	%rax, 16(%rbx)
	movl	60(%rbx), %edi
	movq	%rax, %rsi
	movq	%r15, %rdx
	callq	_DSOUND_BufPtrDiff
	movq	_DSBCAPS_CTRLPOSITIONNOTIFY@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, 56(%rbx)
	je	LBB0_21
## %bb.19:
	movq	32(%rbx), %rcx
	movq	_STATE_STARTING@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rcx
	je	LBB0_21
## %bb.20:
	movq	%rbx, %rdi
	movq	%r15, %rsi
	movl	%eax, %edx
	callq	_DSOUND_CheckEvent
LBB0_21:
	movq	40(%rbx), %rax
	addq	%r14, %rax
	movq	%rax, 40(%rbx)
	movq	48(%rbx), %rcx
	subq	(%rcx), %rax
	jl	LBB0_23
## %bb.22:
	movq	%rax, 40(%rbx)
LBB0_23:
	movq	%r14, %rax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"buf_mixpos=%d/%d sec_mixpos=%d/%d\n"

L_.str.1:                               ## @.str.1
	.asciz	"(%p,%d,%d)\n"

L_.str.2:                               ## @.str.2
	.asciz	"length not a multiple of block size, len = %d, block size = %d\n"

	.comm	_TRUE,4,2                       ## @TRUE
L_.str.3:                               ## @.str.3
	.asciz	"Mixpos (%u) past buflen (%u), capping...\n"

	.comm	_DSBPLAY_LOOPING,4,2            ## @DSBPLAY_LOOPING
	.comm	_STATE_STOPPED,8,3              ## @STATE_STOPPED
	.comm	_DSBCAPS_CTRLPOSITIONNOTIFY,4,2 ## @DSBCAPS_CTRLPOSITIONNOTIFY
	.comm	_STATE_STARTING,8,3             ## @STATE_STARTING
	.no_dead_strip	_DSOUND_MixInBuffer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function DSOUND_MixInBuffer
_DSOUND_MixInBuffer:                    ; @DSOUND_MixInBuffer
	.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	x20, x2
	mov	x22, x1
	mov	x19, x0
	ldr	x23, [x0, #80]
	cbnz	x23, LBB0_2
; %bb.1:
	ldr	x8, [x19, #72]
	ldr	x23, [x8]
LBB0_2:
	ldrsw	x24, [x19]
	ldp	x8, x9, [x19, #8]
	ldr	w10, [x19, #60]
	stp	x9, x10, [sp, #16]
	stp	x24, x8, [sp]
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_TRACE
	stp	x22, x20, [sp, #8]
	str	x19, [sp]
Lloh2:
	adrp	x0, l_.str.1@PAGE
Lloh3:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_TRACE
	ldrsw	x8, [x19]
	add	x8, x8, w20, sxtw
	ldr	x9, [x19, #8]
	cmp	x9, x8
	cset	w0, ge
	bl	_assert
	ldr	x8, [x19, #48]
	ldr	x8, [x8, #32]
	ldr	w2, [x8]
	sdiv	w8, w20, w2
	msub	w21, w8, w2, w20
	cbz	w21, LBB0_4
; %bb.3:
Lloh4:
	adrp	x0, l_.str.2@PAGE
Lloh5:
	add	x0, x0, l_.str.2@PAGEOFF
	mov	x1, x20
	bl	_ERR
	sub	w20, w20, w21
LBB0_4:
	ldr	x21, [x19, #16]
	ldrsw	x8, [x19]
	add	x1, x8, w20, sxtw
	mov	x0, x19
	bl	_DSOUND_bufpos_to_secpos
	ldr	x8, [x19, #16]
	sub	x2, x0, x8
Lloh6:
	adrp	x8, _TRUE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _TRUE@GOTPAGEOFF]
Lloh8:
	ldr	w3, [x8]
	mov	x0, x19
	mov	x1, x21
	bl	_DSOUND_MixToTemporary
	ldr	x8, [x19, #64]
	cbz	x8, LBB0_6
; %bb.5:
	ldr	x8, [x19, #48]
	ldr	x21, [x8, #24]
	b	LBB0_7
LBB0_6:
	add	x21, x23, x24, lsl #2
LBB0_7:
	mov	x0, x19
	mov	x1, x20
	bl	_DSOUND_MixerVol
	cmp	x0, #0
	csel	x23, x21, x0, eq
	ldr	x0, [x19, #48]
	mov	x1, x22
	bl	_DSOUND_bufpos_to_mixpos
	mov	x8, x20
	sxtw	x21, w8
	ldr	x8, [x19, #48]
	ldr	x9, [x8]
	add	x10, x21, x22
	cmp	x10, x9
	b.le	LBB0_9
; %bb.8:
	sub	x22, x9, x22
	ldp	x8, x9, [x8, #8]
	add	x1, x8, x0
	mov	x0, x23
	mov	x2, x22
	blr	x9
	ldr	x8, [x19, #48]
	add	x0, x23, x22, lsl #2
	ldp	x1, x9, [x8, #8]
	sub	w2, w20, w22
	b	LBB0_10
LBB0_9:
	ldp	x8, x9, [x8, #8]
	add	x1, x8, x0
	mov	x0, x23
	mov	x2, x20
LBB0_10:
	blr	x9
	ldrsw	x8, [x19]
	add	x1, x8, w20, sxtw
	str	w1, [x19]
	ldp	x2, x20, [x19, #8]
	cmp	x2, x1
	b.gt	LBB0_18
; %bb.11:
	b.ge	LBB0_13
; %bb.12:
Lloh9:
	adrp	x0, l_.str.3@PAGE
Lloh10:
	add	x0, x0, l_.str.3@PAGEOFF
                                        ; kill: def $w1 killed $w1 killed $x1
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_ERR
LBB0_13:
	ldr	w8, [x19, #24]
Lloh11:
	adrp	x9, _DSBPLAY_LOOPING@GOTPAGE
Lloh12:
	ldr	x9, [x9, _DSBPLAY_LOOPING@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_15
; %bb.14:
	ldr	w8, [x19, #8]
	ldr	w9, [x19]
	sub	w8, w9, w8
	str	w8, [x19]
	b	LBB0_17
LBB0_15:
	ldrsw	x8, [x19]
	ldr	x9, [x19, #8]
	cmp	x9, x8
	b.gt	LBB0_17
; %bb.16:
	str	xzr, [x19, #16]
	str	wzr, [x19]
Lloh14:
	adrp	x8, _STATE_STOPPED@GOTPAGE
Lloh15:
	ldr	x8, [x8, _STATE_STOPPED@GOTPAGEOFF]
Lloh16:
	ldr	x8, [x8]
	str	x8, [x19, #32]
LBB0_17:
	mov	x0, x19
	bl	_DSOUND_RecalcFreqAcc
	ldrsw	x1, [x19]
LBB0_18:
	mov	x0, x19
	bl	_DSOUND_bufpos_to_secpos
	mov	x1, x0
	str	x0, [x19, #16]
	ldr	w0, [x19, #60]
	mov	x2, x20
	bl	_DSOUND_BufPtrDiff
	ldr	w8, [x19, #56]
Lloh17:
	adrp	x9, _DSBCAPS_CTRLPOSITIONNOTIFY@GOTPAGE
Lloh18:
	ldr	x9, [x9, _DSBCAPS_CTRLPOSITIONNOTIFY@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_21
; %bb.19:
	ldr	x8, [x19, #32]
Lloh20:
	adrp	x9, _STATE_STARTING@GOTPAGE
Lloh21:
	ldr	x9, [x9, _STATE_STARTING@GOTPAGEOFF]
Lloh22:
	ldr	x9, [x9]
	cmp	x8, x9
	b.eq	LBB0_21
; %bb.20:
	mov	x2, x0
	mov	x0, x19
	mov	x1, x20
	bl	_DSOUND_CheckEvent
LBB0_21:
	ldp	x8, x9, [x19, #40]
	ldr	x9, [x9]
	add	x10, x8, x21
	subs	x8, x10, x9
	str	x10, [x19, #40]
	b.lt	LBB0_23
; %bb.22:
	str	x8, [x19, #40]
LBB0_23:
	mov	x0, x21
	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	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"buf_mixpos=%d/%d sec_mixpos=%d/%d\n"

l_.str.1:                               ; @.str.1
	.asciz	"(%p,%d,%d)\n"

l_.str.2:                               ; @.str.2
	.asciz	"length not a multiple of block size, len = %d, block size = %d\n"

	.comm	_TRUE,4,2                       ; @TRUE
l_.str.3:                               ; @.str.3
	.asciz	"Mixpos (%u) past buflen (%u), capping...\n"

	.comm	_DSBPLAY_LOOPING,4,2            ; @DSBPLAY_LOOPING
	.comm	_STATE_STOPPED,8,3              ; @STATE_STOPPED
	.comm	_DSBCAPS_CTRLPOSITIONNOTIFY,4,2 ; @DSBCAPS_CTRLPOSITIONNOTIFY
	.comm	_STATE_STARTING,8,3             ; @STATE_STARTING
	.no_dead_strip	_DSOUND_MixInBuffer
.subsections_via_symbols
