	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_addsfx                         ## -- Begin function addsfx
	.p2align	4, 0x90
_addsfx:                                ## @addsfx
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
                                        ## kill: def $ecx killed $ecx def $rcx
	movl	%esi, %r14d
	movl	%edi, %r12d
	movq	_gametic@GOTPCREL(%rip), %r8
	movl	(%r8), %edi
	movq	_sfx_sawup@GOTPCREL(%rip), %rax
	movq	_NUM_CHANNELS@GOTPCREL(%rip), %rsi
	movl	(%rsi), %r9d
	cmpl	%r12d, (%rax)
	je	LBB0_6
## %bb.1:
	movq	_sfx_sawidl@GOTPCREL(%rip), %rax
	cmpl	%r12d, (%rax)
	je	LBB0_6
## %bb.2:
	movq	_sfx_sawful@GOTPCREL(%rip), %rax
	cmpl	%r12d, (%rax)
	je	LBB0_6
## %bb.3:
	movq	_sfx_sawhit@GOTPCREL(%rip), %rax
	cmpl	%r12d, (%rax)
	je	LBB0_6
## %bb.4:
	movq	_sfx_stnmov@GOTPCREL(%rip), %rax
	cmpl	%r12d, (%rax)
	je	LBB0_6
## %bb.5:
	movq	_sfx_pistol@GOTPCREL(%rip), %rax
	cmpl	%r12d, (%rax)
	jne	LBB0_12
LBB0_6:
	testl	%r9d, %r9d
	jle	LBB0_13
## %bb.7:
	movq	_channels@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_channelids@GOTPCREL(%rip), %rsi
	movq	(%rsi), %rbx
	xorl	%esi, %esi
	jmp	LBB0_8
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_8 Depth=1
	incq	%rsi
	cmpq	%rsi, %r9
	je	LBB0_12
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	cmpq	$0, (%rax,%rsi,8)
	je	LBB0_11
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=1
	cmpl	%r12d, (%rbx,%rsi,4)
	jne	LBB0_11
## %bb.10:
	movq	$0, (%rax,%rsi,8)
LBB0_12:
	testl	%r9d, %r9d
	jle	LBB0_13
## %bb.14:
	movq	_channels@GOTPCREL(%rip), %rax
	movq	(%rax), %r10
	movq	_channelstart@GOTPCREL(%rip), %rax
	movq	(%rax), %r11
	xorl	%esi, %esi
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_15:                                ## =>This Inner Loop Header: Depth=1
	cmpq	$0, (%r10,%rsi,8)
	je	LBB0_18
## %bb.16:                              ##   in Loop: Header=BB0_15 Depth=1
	movl	(%r11,%rsi,4), %eax
	cmpl	%edi, %eax
	cmovll	%eax, %edi
	cmovll	%esi, %ebx
	incq	%rsi
	cmpq	%rsi, %r9
	jne	LBB0_15
## %bb.17:
	movl	%r9d, %esi
	jmp	LBB0_18
LBB0_13:
	movq	_channels@GOTPCREL(%rip), %rax
	movq	(%rax), %r10
	xorl	%ebx, %ebx
	xorl	%esi, %esi
LBB0_18:
	cmpl	%r9d, %esi
	cmovnel	%esi, %ebx
	movq	_S_sfx@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movslq	%r12d, %rsi
	movq	(%rax,%rsi,8), %rax
	movslq	%ebx, %r13
	movq	%rax, (%r10,%r13,8)
	movq	_channels@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_lengths@GOTPCREL(%rip), %rdi
	movq	(%rdi), %rdi
	movslq	(%rdi,%rsi,4), %rsi
	addq	(%rax,%r13,8), %rsi
	movq	_channelsend@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rsi, (%rax,%r13,8)
	movzwl	_addsfx.handlenums(%rip), %eax
	testw	%ax, %ax
	movl	$100, %esi
	cmovnel	%eax, %esi
	leal	1(%rsi), %eax
	movw	%ax, _addsfx.handlenums(%rip)
	movzwl	%si, %r15d
	movq	_channelhandles@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	%r15d, (%rax,%r13,4)
	movq	_channelstep@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	%edx, (%rax,%r13,4)
	movq	_channelstepremainder@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	$0, (%rax,%r13,8)
	movl	(%r8), %eax
	movq	_channelstart@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	movl	%eax, (%rdx,%r13,4)
	leal	1(%rcx), %eax
	movl	%eax, %edx
	imull	%r14d, %edx
	imull	%eax, %edx
	sarl	$16, %edx
	movl	%r14d, %ebx
	subl	%edx, %ebx
	addl	$-256, %ecx
	movl	%ecx, %eax
	imull	%r14d, %eax
	imull	%ecx, %eax
	sarl	$16, %eax
	subl	%eax, %r14d
	cmpl	$128, %r14d
	jb	LBB0_20
## %bb.19:
	leaq	L_.str(%rip), %rdi
	callq	_I_Error
LBB0_20:
	cmpl	$128, %ebx
	jb	LBB0_22
## %bb.21:
	leaq	L_.str.1(%rip), %rdi
	callq	_I_Error
LBB0_22:
	movq	_vol_lookup@GOTPCREL(%rip), %rax
	shll	$8, %ebx
	movslq	%ebx, %rcx
	shlq	$2, %rcx
	addq	(%rax), %rcx
	movq	_channelleftvol_lookup@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	movq	%rcx, (%rdx,%r13,8)
	shll	$8, %r14d
	movslq	%r14d, %rcx
	shlq	$2, %rcx
	addq	(%rax), %rcx
	movq	_channelrightvol_lookup@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rcx, (%rax,%r13,8)
	movq	_channelids@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	%r12d, (%rax,%r13,4)
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
.zerofill __DATA,__bss,_addsfx.handlenums,2,1 ## @addsfx.handlenums
	.comm	_gametic,4,2                    ## @gametic
	.comm	_sfx_sawup,4,2                  ## @sfx_sawup
	.comm	_sfx_sawidl,4,2                 ## @sfx_sawidl
	.comm	_sfx_sawful,4,2                 ## @sfx_sawful
	.comm	_sfx_sawhit,4,2                 ## @sfx_sawhit
	.comm	_sfx_stnmov,4,2                 ## @sfx_stnmov
	.comm	_sfx_pistol,4,2                 ## @sfx_pistol
	.comm	_NUM_CHANNELS,4,2               ## @NUM_CHANNELS
	.comm	_channels,8,3                   ## @channels
	.comm	_channelids,8,3                 ## @channelids
	.comm	_channelstart,8,3               ## @channelstart
	.comm	_S_sfx,8,3                      ## @S_sfx
	.comm	_lengths,8,3                    ## @lengths
	.comm	_channelsend,8,3                ## @channelsend
	.comm	_channelhandles,8,3             ## @channelhandles
	.comm	_channelstep,8,3                ## @channelstep
	.comm	_channelstepremainder,8,3       ## @channelstepremainder
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"rightvol out of bounds"

L_.str.1:                               ## @.str.1
	.asciz	"leftvol out of bounds"

	.comm	_vol_lookup,8,3                 ## @vol_lookup
	.comm	_channelleftvol_lookup,8,3      ## @channelleftvol_lookup
	.comm	_channelrightvol_lookup,8,3     ## @channelrightvol_lookup
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_addsfx                         ; -- Begin function addsfx
	.p2align	2
_addsfx:                                ; @addsfx
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x19, x0
Lloh0:
	adrp	x8, _gametic@GOTPAGE
Lloh1:
	ldr	x8, [x8, _gametic@GOTPAGEOFF]
	ldr	w12, [x8]
Lloh2:
	adrp	x9, _sfx_sawup@GOTPAGE
Lloh3:
	ldr	x9, [x9, _sfx_sawup@GOTPAGEOFF]
Lloh4:
	ldr	w9, [x9]
Lloh5:
	adrp	x10, _sfx_sawidl@GOTPAGE
Lloh6:
	ldr	x10, [x10, _sfx_sawidl@GOTPAGEOFF]
Lloh7:
	ldr	w11, [x10]
Lloh8:
	adrp	x10, _sfx_sawful@GOTPAGE
Lloh9:
	ldr	x10, [x10, _sfx_sawful@GOTPAGEOFF]
Lloh10:
	ldr	w13, [x10]
Lloh11:
	adrp	x10, _sfx_sawhit@GOTPAGE
Lloh12:
	ldr	x10, [x10, _sfx_sawhit@GOTPAGEOFF]
Lloh13:
	ldr	w14, [x10]
Lloh14:
	adrp	x10, _sfx_stnmov@GOTPAGE
Lloh15:
	ldr	x10, [x10, _sfx_stnmov@GOTPAGEOFF]
Lloh16:
	ldr	w15, [x10]
Lloh17:
	adrp	x10, _sfx_pistol@GOTPAGE
Lloh18:
	ldr	x10, [x10, _sfx_pistol@GOTPAGEOFF]
Lloh19:
	ldr	w16, [x10]
Lloh20:
	adrp	x10, _NUM_CHANNELS@GOTPAGE
Lloh21:
	ldr	x10, [x10, _NUM_CHANNELS@GOTPAGEOFF]
Lloh22:
	ldr	w10, [x10]
	cmp	w9, w0
	ccmp	w11, w0, #4, ne
	ccmp	w13, w0, #4, ne
	ccmp	w14, w0, #4, ne
	ccmp	w15, w0, #4, ne
	ccmp	w16, w0, #4, ne
Lloh23:
	adrp	x11, _channels@GOTPAGE
Lloh24:
	ldr	x11, [x11, _channels@GOTPAGEOFF]
Lloh25:
	adrp	x9, _channelstart@GOTPAGE
Lloh26:
	ldr	x9, [x9, _channelstart@GOTPAGEOFF]
Lloh27:
	adrp	x21, _channelids@GOTPAGE
Lloh28:
	ldr	x21, [x21, _channelids@GOTPAGEOFF]
	b.ne	LBB0_7
; %bb.1:
	cmp	w10, #1
	b.lt	LBB0_12
; %bb.2:
	ldr	x13, [x11]
	ldr	x14, [x21]
	mov	x15, x10
	b	LBB0_4
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	x13, x13, #8
	add	x14, x14, #4
	subs	x15, x15, #1
	b.eq	LBB0_7
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x16, [x13]
	cbz	x16, LBB0_3
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w16, [x14]
	cmp	w16, w19
	b.ne	LBB0_3
; %bb.6:
	str	xzr, [x13]
LBB0_7:
	cmp	w10, #0
	b.le	LBB0_12
; %bb.8:
	mov	x15, #0
	mov	w14, #0
	ldr	x13, [x11]
	ldr	x16, [x9]
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x17, [x13, x15, lsl #3]
	cbz	x17, LBB0_13
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=1
	ldr	w17, [x16, x15, lsl #2]
	cmp	w17, w12
	csel	w12, w17, w12, lt
	csel	w14, w15, w14, lt
	add	x15, x15, #1
	cmp	x10, x15
	b.ne	LBB0_9
; %bb.11:
	mov	x15, x10
	b	LBB0_13
LBB0_12:
	mov	w14, #0
	mov	w15, #0
	ldr	x13, [x11]
LBB0_13:
	cmp	w15, w10
	csel	w10, w14, w15, eq
Lloh29:
	adrp	x12, _S_sfx@GOTPAGE
Lloh30:
	ldr	x12, [x12, _S_sfx@GOTPAGEOFF]
Lloh31:
	ldr	x12, [x12]
	ldr	x12, [x12, w19, sxtw #3]
	sbfiz	x14, x10, #3, #32
	str	x12, [x13, x14]
	ldr	x11, [x11]
	ldr	x11, [x11, x14]
Lloh32:
	adrp	x12, _lengths@GOTPAGE
Lloh33:
	ldr	x12, [x12, _lengths@GOTPAGEOFF]
Lloh34:
	ldr	x12, [x12]
	ldrsw	x12, [x12, w19, sxtw #2]
	add	x11, x11, x12
Lloh35:
	adrp	x12, _channelsend@GOTPAGE
Lloh36:
	ldr	x12, [x12, _channelsend@GOTPAGEOFF]
Lloh37:
	ldr	x12, [x12]
	str	x11, [x12, x14]
Lloh38:
	adrp	x11, _addsfx.handlenums@PAGE
	ldrh	w12, [x11, _addsfx.handlenums@PAGEOFF]
	mov	w13, #100
	cmp	w12, #0
	csel	w20, w13, w12, eq
Lloh39:
	adrp	x12, _channelhandles@GOTPAGE
Lloh40:
	ldr	x12, [x12, _channelhandles@GOTPAGEOFF]
	sxtw	x22, w10
Lloh41:
	ldr	x12, [x12]
	sbfiz	x10, x10, #2, #32
	str	w20, [x12, x10]
	add	w12, w20, #1
	strh	w12, [x11, _addsfx.handlenums@PAGEOFF]
Lloh42:
	adrp	x11, _channelstep@GOTPAGE
Lloh43:
	ldr	x11, [x11, _channelstep@GOTPAGEOFF]
Lloh44:
	ldr	x11, [x11]
	str	w2, [x11, x10]
Lloh45:
	adrp	x11, _channelstepremainder@GOTPAGE
Lloh46:
	ldr	x11, [x11, _channelstepremainder@GOTPAGEOFF]
Lloh47:
	ldr	x11, [x11]
	str	xzr, [x11, x14]
	ldr	w8, [x8]
	ldr	x9, [x9]
	str	w8, [x9, x10]
	add	w8, w3, #1
	mul	w9, w8, w1
	mul	w8, w9, w8
	sub	w24, w1, w8, asr #16
	sub	w8, w3, #256
	mul	w9, w8, w1
	mul	w8, w9, w8
	sub	w23, w1, w8, asr #16
	cmp	w23, #128
	b.lo	LBB0_15
; %bb.14:
Lloh48:
	adrp	x0, l_.str@PAGE
Lloh49:
	add	x0, x0, l_.str@PAGEOFF
	bl	_I_Error
LBB0_15:
	cmp	w24, #128
	b.lo	LBB0_17
; %bb.16:
Lloh50:
	adrp	x0, l_.str.1@PAGE
Lloh51:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_I_Error
LBB0_17:
Lloh52:
	adrp	x8, _vol_lookup@GOTPAGE
Lloh53:
	ldr	x8, [x8, _vol_lookup@GOTPAGEOFF]
	ldr	x9, [x8]
	lsl	w10, w24, #8
	add	x9, x9, w10, sxtw #2
Lloh54:
	adrp	x10, _channelleftvol_lookup@GOTPAGE
Lloh55:
	ldr	x10, [x10, _channelleftvol_lookup@GOTPAGEOFF]
Lloh56:
	ldr	x10, [x10]
	lsl	x11, x22, #3
	str	x9, [x10, x11]
	ldr	x8, [x8]
	lsl	w9, w23, #8
	add	x8, x8, w9, sxtw #2
Lloh57:
	adrp	x9, _channelrightvol_lookup@GOTPAGE
Lloh58:
	ldr	x9, [x9, _channelrightvol_lookup@GOTPAGEOFF]
Lloh59:
	ldr	x9, [x9]
	str	x8, [x9, x11]
	ldr	x8, [x21]
	str	w19, [x8, x22, lsl #2]
	mov	x0, x20
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh45, Lloh46, Lloh47
	.loh AdrpLdrGotLdr	Lloh42, Lloh43, Lloh44
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.loh AdrpAdrp	Lloh38, Lloh42
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpAdd	Lloh48, Lloh49
	.loh AdrpAdd	Lloh50, Lloh51
	.loh AdrpLdrGotLdr	Lloh57, Lloh58, Lloh59
	.loh AdrpLdrGotLdr	Lloh54, Lloh55, Lloh56
	.loh AdrpLdrGot	Lloh52, Lloh53
	.cfi_endproc
                                        ; -- End function
.zerofill __DATA,__bss,_addsfx.handlenums,2,1 ; @addsfx.handlenums
	.comm	_gametic,4,2                    ; @gametic
	.comm	_sfx_sawup,4,2                  ; @sfx_sawup
	.comm	_sfx_sawidl,4,2                 ; @sfx_sawidl
	.comm	_sfx_sawful,4,2                 ; @sfx_sawful
	.comm	_sfx_sawhit,4,2                 ; @sfx_sawhit
	.comm	_sfx_stnmov,4,2                 ; @sfx_stnmov
	.comm	_sfx_pistol,4,2                 ; @sfx_pistol
	.comm	_NUM_CHANNELS,4,2               ; @NUM_CHANNELS
	.comm	_channels,8,3                   ; @channels
	.comm	_channelids,8,3                 ; @channelids
	.comm	_channelstart,8,3               ; @channelstart
	.comm	_S_sfx,8,3                      ; @S_sfx
	.comm	_lengths,8,3                    ; @lengths
	.comm	_channelsend,8,3                ; @channelsend
	.comm	_channelhandles,8,3             ; @channelhandles
	.comm	_channelstep,8,3                ; @channelstep
	.comm	_channelstepremainder,8,3       ; @channelstepremainder
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"rightvol out of bounds"

l_.str.1:                               ; @.str.1
	.asciz	"leftvol out of bounds"

	.comm	_vol_lookup,8,3                 ; @vol_lookup
	.comm	_channelleftvol_lookup,8,3      ; @channelleftvol_lookup
	.comm	_channelrightvol_lookup,8,3     ; @channelrightvol_lookup
.subsections_via_symbols
