	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_S_PaintChannelFromADPCM        ## -- Begin function S_PaintChannelFromADPCM
	.p2align	4, 0x90
_S_PaintChannelFromADPCM:               ## @S_PaintChannelFromADPCM
	.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
	movl	%ecx, %ebx
	movq	%rsi, %r10
	cmpq	$0, 16(%rdi)
	je	LBB0_2
## %bb.1:
	imull	8(%rdi), %ebx
LBB0_2:
	movq	_snd_vol@GOTPCREL(%rip), %rcx
	movq	_paintbuffer@GOTPCREL(%rip), %r12
	movq	(%r10), %r14
	movq	_SND_CHUNK_SIZE@GOTPCREL(%rip), %rsi
	movl	(%rsi), %eax
	shll	$2, %eax
	xorl	%r15d, %r15d
	cmpl	%eax, %ebx
	jl	LBB0_5
## %bb.3:
	xorl	%r15d, %r15d
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r14), %r14
	subl	%eax, %ebx
	incl	%r15d
	cmpl	%eax, %ebx
	jge	LBB0_4
LBB0_5:
	movl	(%rdi), %r11d
	movl	4(%rdi), %r9d
	movl	(%rcx), %edi
	movq	(%r12), %r13
	movq	_sfxScratchIndex@GOTPCREL(%rip), %rax
	movq	_sfxScratchPointer@GOTPCREL(%rip), %r12
	cmpl	(%rax), %r15d
	movl	%r11d, -52(%rbp)                ## 4-byte Spill
	movl	%r9d, -48(%rbp)                 ## 4-byte Spill
	movl	%edi, -44(%rbp)                 ## 4-byte Spill
	jne	LBB0_7
## %bb.6:
	cmpq	%r10, (%r12)
	je	LBB0_8
LBB0_7:
	movq	_sfxScratchBuffer@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	%r14, %rdi
	movl	%edx, -56(%rbp)                 ## 4-byte Spill
	movq	%r10, -64(%rbp)                 ## 8-byte Spill
	movl	%r8d, %r12d
	callq	_S_AdpcmGetSamples
	movl	%r12d, %r8d
	movl	-56(%rbp), %edx                 ## 4-byte Reload
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movl	-48(%rbp), %r9d                 ## 4-byte Reload
	movl	-52(%rbp), %r11d                ## 4-byte Reload
	movq	_SND_CHUNK_SIZE@GOTPCREL(%rip), %rsi
	movq	_sfxScratchIndex@GOTPCREL(%rip), %rax
	movl	%r15d, (%rax)
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movq	_sfxScratchPointer@GOTPCREL(%rip), %rcx
	movq	%rax, (%rcx)
LBB0_8:
	testl	%edx, %edx
	jle	LBB0_13
## %bb.9:
	movslq	%r8d, %rax
	movq	_sfxScratchBuffer@GOTPCREL(%rip), %r8
	movq	(%r8), %r8
	movl	%edx, %r12d
	leaq	4(,%rax,8), %rdx
	addq	%r13, %rdx
	xorl	%r15d, %r15d
	jmp	LBB0_10
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_10 Depth=1
	incq	%r15
	cmpq	%r15, %r12
	je	LBB0_13
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movslq	%ebx, %rax
	movswl	(%r8,%rax,2), %eax
	imull	%edi, %eax
	movl	%eax, %ecx
	imull	%r11d, %ecx
	sarl	$8, %ecx
	addl	%ecx, -4(%rdx,%r15,8)
	imull	%r9d, %eax
	sarl	$8, %eax
	addl	%eax, (%rdx,%r15,8)
	incl	%ebx
	movl	(%rsi), %eax
	shll	$2, %eax
	cmpl	%eax, %ebx
	jne	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=1
	movq	(%r14), %r14
	movq	_sfxScratchBuffer@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	%r14, %rdi
	movq	%r8, %r13
	movq	%rdx, %rbx
	callq	_S_AdpcmGetSamples
	movq	%rbx, %rdx
	movq	%r13, %r8
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movl	-48(%rbp), %r9d                 ## 4-byte Reload
	movl	-52(%rbp), %r11d                ## 4-byte Reload
	movq	_SND_CHUNK_SIZE@GOTPCREL(%rip), %rsi
	movq	_sfxScratchIndex@GOTPCREL(%rip), %rax
	incl	(%rax)
	xorl	%ebx, %ebx
	jmp	LBB0_12
LBB0_13:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_snd_vol,4,2                    ## @snd_vol
	.comm	_paintbuffer,8,3                ## @paintbuffer
	.comm	_SND_CHUNK_SIZE,4,2             ## @SND_CHUNK_SIZE
	.comm	_sfxScratchIndex,4,2            ## @sfxScratchIndex
	.comm	_sfxScratchPointer,8,3          ## @sfxScratchPointer
	.comm	_sfxScratchBuffer,8,3           ## @sfxScratchBuffer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_S_PaintChannelFromADPCM        ; -- Begin function S_PaintChannelFromADPCM
	.p2align	2
_S_PaintChannelFromADPCM:               ; @S_PaintChannelFromADPCM
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	d9, d8, [sp, #16]               ; 16-byte Folded Spill
	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
	.cfi_offset b8, -104
	.cfi_offset b9, -112
	mov	x20, x3
	ldr	x19, [x1]
	ldr	x8, [x0, #16]
	cbz	x8, LBB0_2
; %bb.1:
	ldr	w8, [x0, #8]
	mul	w20, w8, w20
LBB0_2:
Lloh0:
	adrp	x9, _paintbuffer@GOTPAGE
Lloh1:
	ldr	x9, [x9, _paintbuffer@GOTPAGEOFF]
Lloh2:
	adrp	x8, _snd_vol@GOTPAGE
Lloh3:
	ldr	x8, [x8, _snd_vol@GOTPAGEOFF]
Lloh4:
	adrp	x24, _SND_CHUNK_SIZE@GOTPAGE
Lloh5:
	ldr	x24, [x24, _SND_CHUNK_SIZE@GOTPAGEOFF]
	ldr	w10, [x24]
	lsl	w10, w10, #2
	cmp	w20, w10
	b.ge	LBB0_4
; %bb.3:
	mov	w28, #0
	b	LBB0_6
LBB0_4:
	mov	w28, #0
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x19, [x19]
	add	w28, w28, #1
	sub	w20, w20, w10
	cmp	w20, w10
	b.ge	LBB0_5
LBB0_6:
	ldr	x23, [x9]
	ldr	w25, [x8]
	ldr	d8, [x0]
Lloh6:
	adrp	x26, _sfxScratchIndex@GOTPAGE
Lloh7:
	ldr	x26, [x26, _sfxScratchIndex@GOTPAGEOFF]
Lloh8:
	adrp	x9, _sfxScratchPointer@GOTPAGE
Lloh9:
	ldr	x9, [x9, _sfxScratchPointer@GOTPAGEOFF]
	ldr	w8, [x26]
Lloh10:
	ldr	x9, [x9]
	cmp	w28, w8
	ccmp	x9, x1, #0, eq
Lloh11:
	adrp	x27, _sfxScratchBuffer@GOTPAGE
Lloh12:
	ldr	x27, [x27, _sfxScratchBuffer@GOTPAGEOFF]
	b.eq	LBB0_8
; %bb.7:
	str	x1, [sp, #8]                    ; 8-byte Folded Spill
	ldr	x1, [x27]
	mov	x0, x19
	mov	x21, x2
	mov	x22, x4
	bl	_S_AdpcmGetSamples
	mov	x4, x22
	mov	x2, x21
	str	w28, [x26]
	ldr	x8, [sp, #8]                    ; 8-byte Folded Reload
Lloh13:
	adrp	x9, _sfxScratchPointer@GOTPAGE
Lloh14:
	ldr	x9, [x9, _sfxScratchPointer@GOTPAGEOFF]
Lloh15:
	str	x8, [x9]
LBB0_8:
	cmp	w2, #1
	b.lt	LBB0_13
; %bb.9:
	add	x22, x23, w4, sxtw #3
	ldr	x23, [x27]
	mov	w21, w2
	b	LBB0_11
LBB0_10:                                ;   in Loop: Header=BB0_11 Depth=1
	add	x22, x22, #8
	mov	x20, x8
	subs	x21, x21, #1
	b.eq	LBB0_13
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	add	w8, w20, #1
	ldrsh	w9, [x23, w20, sxtw #1]
	mul	w9, w25, w9
	dup.2s	v0, w9
	mul.2s	v0, v0, v8
	ldr	d1, [x22]
	ssra.2s	v1, v0, #8
	str	d1, [x22]
	ldr	w9, [x24]
	cmp	w8, w9, lsl #2
	b.ne	LBB0_10
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	ldr	x19, [x19]
	ldr	x1, [x27]
	mov	x0, x19
	bl	_S_AdpcmGetSamples
	mov	w8, #0
	ldr	w9, [x26]
	add	w9, w9, #1
	str	w9, [x26]
	b	LBB0_10
LBB0_13:
	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
	ldp	d9, d8, [sp, #16]               ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotStr	Lloh13, Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_snd_vol,4,2                    ; @snd_vol
	.comm	_paintbuffer,8,3                ; @paintbuffer
	.comm	_SND_CHUNK_SIZE,4,2             ; @SND_CHUNK_SIZE
	.comm	_sfxScratchIndex,4,2            ; @sfxScratchIndex
	.comm	_sfxScratchPointer,8,3          ; @sfxScratchPointer
	.comm	_sfxScratchBuffer,8,3           ; @sfxScratchBuffer
.subsections_via_symbols
