	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_S_StartSoundAtVolume           ## -- Begin function S_StartSoundAtVolume
	.p2align	4, 0x90
_S_StartSoundAtVolume:                  ## @S_StartSoundAtVolume
	.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	%edx, %ebx
	movl	%esi, %r13d
	movq	%rdi, %r15
	movl	%edx, -48(%rbp)
	testl	%esi, %esi
	jle	LBB0_2
## %bb.1:
	movq	_NUMSFX@GOTPCREL(%rip), %rax
	cmpl	%r13d, (%rax)
	jge	LBB0_3
LBB0_2:
	leaq	L_.str(%rip), %rdi
	movl	%r13d, %esi
	callq	_I_Error
LBB0_3:
	movq	_S_sfx@GOTPCREL(%rip), %rax
	movq	(%rax), %r14
	movslq	%r13d, %rax
	leaq	(%rax,%rax,4), %r12
	leaq	(%r14,%r12,8), %rax
	cmpq	$0, 32(%r14,%r12,8)
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	je	LBB0_8
## %bb.4:
	movl	(%rax), %eax
	movl	%eax, -44(%rbp)
	movl	4(%r14,%r12,8), %eax
	movl	%eax, -56(%rbp)                 ## 4-byte Spill
	addl	24(%r14,%r12,8), %ebx
	movl	%ebx, -48(%rbp)
	testl	%ebx, %ebx
	jle	LBB0_29
## %bb.5:
	movq	_snd_SfxVolume@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	%eax, %ebx
	jle	LBB0_7
## %bb.6:
	movl	%eax, -48(%rbp)
LBB0_7:
	testq	%r15, %r15
	jne	LBB0_9
	jmp	LBB0_14
LBB0_8:
	movq	_NORM_PITCH@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -44(%rbp)
	movq	_NORM_PRIORITY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -56(%rbp)                 ## 4-byte Spill
	testq	%r15, %r15
	je	LBB0_14
LBB0_9:
	movq	_players@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_consoleplayer@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rcx
	movq	(%rax,%rcx,8), %rdi
	cmpq	%r15, %rdi
	je	LBB0_14
## %bb.10:
	leaq	-48(%rbp), %rdx
	leaq	-52(%rbp), %rcx
	leaq	-44(%rbp), %r8
	movq	%r15, %rsi
	callq	_S_AdjustSoundParams
	movq	(%r15), %rdx
	movq	_players@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	(%rbx), %rsi
	movq	(%rcx,%rsi,8), %rcx
	cmpq	(%rcx), %rdx
	jne	LBB0_13
## %bb.11:
	movq	8(%r15), %rdx
	cmpq	8(%rcx), %rdx
	jne	LBB0_13
## %bb.12:
	movq	_NORM_SEP@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, -52(%rbp)
LBB0_13:
	testl	%eax, %eax
	jne	LBB0_15
	jmp	LBB0_29
LBB0_14:
	movq	_NORM_SEP@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -52(%rbp)
LBB0_15:
	movq	_sfx_sawup@GOTPCREL(%rip), %rax
	cmpl	%r13d, (%rax)
	jg	LBB0_19
## %bb.16:
	movq	_sfx_sawhit@GOTPCREL(%rip), %rax
	cmpl	%r13d, (%rax)
	jl	LBB0_19
## %bb.17:
	xorl	%eax, %eax
	callq	_M_Random
	andl	$15, %eax
	movl	-44(%rbp), %ecx
	subl	%eax, %ecx
	addl	$8, %ecx
	movl	%ecx, -44(%rbp)
	js	LBB0_24
LBB0_22:
	cmpl	$256, %ecx                      ## imm = 0x100
	jb	LBB0_25
## %bb.23:
	movl	$255, -44(%rbp)
	jmp	LBB0_25
LBB0_19:
	movq	_sfx_itemup@GOTPCREL(%rip), %rax
	cmpl	%r13d, (%rax)
	je	LBB0_25
## %bb.20:
	movq	_sfx_tink@GOTPCREL(%rip), %rax
	cmpl	%r13d, (%rax)
	je	LBB0_25
## %bb.21:
	xorl	%eax, %eax
	callq	_M_Random
	andl	$31, %eax
	movl	-44(%rbp), %ecx
	subl	%eax, %ecx
	addl	$16, %ecx
	movl	%ecx, -44(%rbp)
	jns	LBB0_22
LBB0_24:
	movl	$0, -44(%rbp)
LBB0_25:
	movq	%r15, %rdi
	callq	_S_StopSound
	movq	%r15, %rdi
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	callq	_S_getChannel
	testl	%eax, %eax
	js	LBB0_29
## %bb.26:
	movl	%eax, %r15d
	cmpq	$0, 8(%r14,%r12,8)
	js	LBB0_30
## %bb.27:
	cmpl	$0, 20(%r14,%r12,8)
	je	LBB0_31
LBB0_28:
	movl	16(%r14,%r12,8), %eax
	leal	1(%rax), %ecx
	testl	%eax, %eax
	movl	$1, %eax
	cmovnsl	%ecx, %eax
	movl	%eax, 16(%r14,%r12,8)
	movl	-48(%rbp), %esi
	movl	-52(%rbp), %edx
	movl	-44(%rbp), %ecx
	movl	%r13d, %edi
	movl	-56(%rbp), %r8d                 ## 4-byte Reload
	callq	_I_StartSound
	movq	_channels@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	%r15d, %edx
	movl	%eax, (%rcx,%rdx,4)
LBB0_29:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_30:
	leaq	(%r14,%r12,8), %rbx
	addq	$8, %rbx
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_I_GetSfxLumpNum
	movq	%rax, (%rbx)
	cmpl	$0, 20(%r14,%r12,8)
	jne	LBB0_28
LBB0_31:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_fprintf
	jmp	LBB0_28
	.cfi_endproc
                                        ## -- End function
	.comm	_NUMSFX,4,2                     ## @NUMSFX
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Bad sfx #: %d"

	.comm	_S_sfx,8,3                      ## @S_sfx
	.comm	_snd_SfxVolume,4,2              ## @snd_SfxVolume
	.comm	_NORM_PITCH,4,2                 ## @NORM_PITCH
	.comm	_NORM_PRIORITY,4,2              ## @NORM_PRIORITY
	.comm	_players,8,3                    ## @players
	.comm	_consoleplayer,8,3              ## @consoleplayer
	.comm	_NORM_SEP,4,2                   ## @NORM_SEP
	.comm	_sfx_sawup,4,2                  ## @sfx_sawup
	.comm	_sfx_sawhit,4,2                 ## @sfx_sawhit
	.comm	_sfx_itemup,4,2                 ## @sfx_itemup
	.comm	_sfx_tink,4,2                   ## @sfx_tink
	.comm	_stderr,4,2                     ## @stderr
L_.str.1:                               ## @.str.1
	.asciz	"S_StartSoundAtVolume: 16bit and not pre-cached - wtf?\n"

	.comm	_channels,8,3                   ## @channels
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_S_StartSoundAtVolume           ; -- Begin function S_StartSoundAtVolume
	.p2align	2
_S_StartSoundAtVolume:                  ; @S_StartSoundAtVolume
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x23, x2
	mov	x19, x1
	mov	x21, x0
	str	w2, [sp, #12]
	cmp	w1, #1
	b.lt	LBB0_2
; %bb.1:
Lloh0:
	adrp	x8, _NUMSFX@GOTPAGE
Lloh1:
	ldr	x8, [x8, _NUMSFX@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w19
	b.ge	LBB0_3
LBB0_2:
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x19
	bl	_I_Error
LBB0_3:
Lloh5:
	adrp	x8, _S_sfx@GOTPAGE
Lloh6:
	ldr	x8, [x8, _S_sfx@GOTPAGEOFF]
Lloh7:
	ldr	x24, [x8]
	sxtw	x25, w19
	mov	w8, #40
	smaddl	x22, w19, w8, x24
	ldr	x8, [x22, #32]
	cbz	x8, LBB0_8
; %bb.4:
	ldr	w8, [x22]
	str	w8, [sp, #4]
	mov	w8, #40
	madd	x8, x25, x8, x24
	ldr	w20, [x8, #4]
	ldr	w8, [x8, #24]
	add	w8, w8, w23
	str	w8, [sp, #12]
	cmp	w8, #1
	b.lt	LBB0_29
; %bb.5:
Lloh8:
	adrp	x9, _snd_SfxVolume@GOTPAGE
Lloh9:
	ldr	x9, [x9, _snd_SfxVolume@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	cmp	w8, w9
	b.le	LBB0_7
; %bb.6:
	str	w9, [sp, #12]
LBB0_7:
	cbnz	x21, LBB0_9
	b	LBB0_14
LBB0_8:
Lloh11:
	adrp	x8, _NORM_PITCH@GOTPAGE
Lloh12:
	ldr	x8, [x8, _NORM_PITCH@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	str	w8, [sp, #4]
Lloh14:
	adrp	x8, _NORM_PRIORITY@GOTPAGE
Lloh15:
	ldr	x8, [x8, _NORM_PRIORITY@GOTPAGEOFF]
Lloh16:
	ldr	w20, [x8]
	cbz	x21, LBB0_14
LBB0_9:
Lloh17:
	adrp	x23, _players@GOTPAGE
Lloh18:
	ldr	x23, [x23, _players@GOTPAGEOFF]
	ldr	x8, [x23]
Lloh19:
	adrp	x26, _consoleplayer@GOTPAGE
Lloh20:
	ldr	x26, [x26, _consoleplayer@GOTPAGEOFF]
	ldr	x9, [x26]
	ldr	x0, [x8, x9, lsl #3]
	cmp	x0, x21
	b.eq	LBB0_14
; %bb.10:
	add	x2, sp, #12
	add	x3, sp, #8
	add	x4, sp, #4
	mov	x1, x21
	bl	_S_AdjustSoundParams
	ldr	x9, [x21]
	ldr	x8, [x23]
	ldr	x10, [x26]
	ldr	x8, [x8, x10, lsl #3]
	ldr	x10, [x8]
	cmp	x9, x10
	b.ne	LBB0_13
; %bb.11:
	ldr	x9, [x21, #8]
	ldr	x8, [x8, #8]
	cmp	x9, x8
	b.ne	LBB0_13
; %bb.12:
Lloh21:
	adrp	x8, _NORM_SEP@GOTPAGE
Lloh22:
	ldr	x8, [x8, _NORM_SEP@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	str	w8, [sp, #8]
LBB0_13:
	cbnz	w0, LBB0_15
	b	LBB0_29
LBB0_14:
Lloh24:
	adrp	x8, _NORM_SEP@GOTPAGE
Lloh25:
	ldr	x8, [x8, _NORM_SEP@GOTPAGEOFF]
Lloh26:
	ldr	w8, [x8]
	str	w8, [sp, #8]
LBB0_15:
Lloh27:
	adrp	x8, _sfx_sawup@GOTPAGE
Lloh28:
	ldr	x8, [x8, _sfx_sawup@GOTPAGEOFF]
Lloh29:
	ldr	w8, [x8]
Lloh30:
	adrp	x9, _sfx_sawhit@GOTPAGE
Lloh31:
	ldr	x9, [x9, _sfx_sawhit@GOTPAGEOFF]
Lloh32:
	ldr	w9, [x9]
	cmp	w8, w19
	ccmp	w9, w19, #8, le
	b.ge	LBB0_20
; %bb.16:
Lloh33:
	adrp	x8, _sfx_itemup@GOTPAGE
Lloh34:
	ldr	x8, [x8, _sfx_itemup@GOTPAGEOFF]
Lloh35:
	ldr	w8, [x8]
	cmp	w8, w19
	b.eq	LBB0_23
; %bb.17:
Lloh36:
	adrp	x8, _sfx_tink@GOTPAGE
Lloh37:
	ldr	x8, [x8, _sfx_tink@GOTPAGEOFF]
Lloh38:
	ldr	w8, [x8]
	cmp	w8, w19
	b.eq	LBB0_23
; %bb.18:
	bl	_M_Random
	and	w8, w0, #0x1f
	ldr	w9, [sp, #4]
	sub	w8, w9, w8
	adds	w8, w8, #16
	str	w8, [sp, #4]
	b.pl	LBB0_21
LBB0_19:
	str	wzr, [sp, #4]
	b	LBB0_23
LBB0_20:
	bl	_M_Random
	and	w8, w0, #0xf
	ldr	w9, [sp, #4]
	sub	w8, w9, w8
	adds	w8, w8, #8
	str	w8, [sp, #4]
	b.mi	LBB0_19
LBB0_21:
	cmp	w8, #256
	b.lo	LBB0_23
; %bb.22:
	mov	w8, #255
	str	w8, [sp, #4]
LBB0_23:
	mov	x0, x21
	bl	_S_StopSound
	mov	x0, x21
	mov	x1, x22
	bl	_S_getChannel
	tbnz	w0, #31, LBB0_29
; %bb.24:
	mov	x21, x0
	mov	w8, #40
	madd	x23, x25, x8, x24
	ldr	x8, [x23, #8]!
	tbz	x8, #63, LBB0_26
; %bb.25:
	mov	x0, x22
	bl	_I_GetSfxLumpNum
	str	x0, [x23]
LBB0_26:
	mov	w8, #40
	madd	x8, x25, x8, x24
	ldr	w8, [x8, #20]
	cbnz	w8, LBB0_28
; %bb.27:
Lloh39:
	adrp	x8, _stderr@GOTPAGE
Lloh40:
	ldr	x8, [x8, _stderr@GOTPAGEOFF]
Lloh41:
	ldr	w0, [x8]
Lloh42:
	adrp	x1, l_.str.1@PAGE
Lloh43:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_fprintf
LBB0_28:
	mov	w8, #40
	madd	x8, x25, x8, x24
	ldr	w9, [x8, #16]
	cmp	w9, #0
	mov	w10, #1
	csinc	w9, w10, w9, lt
	str	w9, [x8, #16]
	ldp	w2, w1, [sp, #8]
	ldr	w3, [sp, #4]
	mov	x0, x19
	mov	x4, x20
	bl	_I_StartSound
Lloh44:
	adrp	x8, _channels@GOTPAGE
Lloh45:
	ldr	x8, [x8, _channels@GOTPAGEOFF]
Lloh46:
	ldr	x8, [x8]
	str	w0, [x8, w21, uxtw #2]
LBB0_29:
	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
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpAdd	Lloh42, Lloh43
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh44, Lloh45, Lloh46
	.cfi_endproc
                                        ; -- End function
	.comm	_NUMSFX,4,2                     ; @NUMSFX
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Bad sfx #: %d"

	.comm	_S_sfx,8,3                      ; @S_sfx
	.comm	_snd_SfxVolume,4,2              ; @snd_SfxVolume
	.comm	_NORM_PITCH,4,2                 ; @NORM_PITCH
	.comm	_NORM_PRIORITY,4,2              ; @NORM_PRIORITY
	.comm	_players,8,3                    ; @players
	.comm	_consoleplayer,8,3              ; @consoleplayer
	.comm	_NORM_SEP,4,2                   ; @NORM_SEP
	.comm	_sfx_sawup,4,2                  ; @sfx_sawup
	.comm	_sfx_sawhit,4,2                 ; @sfx_sawhit
	.comm	_sfx_itemup,4,2                 ; @sfx_itemup
	.comm	_sfx_tink,4,2                   ; @sfx_tink
	.comm	_stderr,4,2                     ; @stderr
l_.str.1:                               ; @.str.1
	.asciz	"S_StartSoundAtVolume: 16bit and not pre-cached - wtf?\n"

	.comm	_channels,8,3                   ; @channels
.subsections_via_symbols
