	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_CG_FireWeapon                  ## -- Begin function CG_FireWeapon
	.p2align	4, 0x90
_CG_FireWeapon:                         ## @CG_FireWeapon
	.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
	movq	(%rdi), %rbx
	movq	_WP_NONE@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rbx
	jne	LBB0_1
LBB0_19:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	movq	_WP_NUM_WEAPONS@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rbx
	jae	LBB0_20
## %bb.2:
	movq	%rdi, %r14
	movq	_cg_weapons@GOTPCREL(%rip), %rax
	movq	(%rax), %r15
	movq	_cg@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 32(%rdi)
	movq	_WP_LIGHTNING@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rbx
	jne	LBB0_4
## %bb.3:
	cmpq	$0, 24(%r14)
	jne	LBB0_19
LBB0_4:
	movq	_WP_RAILGUN@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rbx
	jne	LBB0_6
## %bb.5:
	movl	%eax, 16(%r14)
LBB0_6:
	movl	8(%r14), %eax
	movq	_PW_QUAD@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	btl	%ecx, %eax
	jae	LBB0_8
## %bb.7:
	movl	12(%r14), %esi
	movq	_CHAN_ITEM@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_cgs@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	xorl	%edi, %edi
	callq	_trap_S_StartSound
LBB0_8:
	shlq	$4, %rbx
	movq	8(%r15,%rbx), %rax
	cmpq	$0, (%rax)
	je	LBB0_17
## %bb.9:
	leaq	(%r15,%rbx), %r12
	addq	$8, %r12
	cmpq	$0, 8(%rax)
	je	LBB0_10
## %bb.11:
	cmpq	$0, 16(%rax)
	je	LBB0_12
## %bb.13:
	movl	$4, %r13d
	cmpq	$0, 24(%rax)
	jne	LBB0_15
## %bb.14:
	movl	$3, %r13d
	jmp	LBB0_15
LBB0_20:
	leaq	L_.str(%rip), %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_CG_Error                       ## TAILCALL
LBB0_10:
	movl	$1, %r13d
	jmp	LBB0_15
LBB0_12:
	movl	$2, %r13d
LBB0_15:
	xorl	%eax, %eax
	callq	_rand
	cltd
	idivl	%r13d
	movq	(%r12), %rax
	movslq	%edx, %rcx
	movq	(%rax,%rcx,8), %rcx
	testq	%rcx, %rcx
	je	LBB0_17
## %bb.16:
	movl	12(%r14), %esi
	movq	_CHAN_WEAPON@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	xorl	%edi, %edi
	callq	_trap_S_StartSound
LBB0_17:
	movq	(%r15,%rbx), %rax
	testq	%rax, %rax
	je	LBB0_19
## %bb.18:
	movq	_cg_brassTime@GOTPCREL(%rip), %rcx
	cmpq	$0, (%rcx)
	jle	LBB0_19
## %bb.21:
	movq	%r14, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmpq	*%rax                           ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_WP_NONE,8,3                    ## @WP_NONE
	.comm	_WP_NUM_WEAPONS,8,3             ## @WP_NUM_WEAPONS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"CG_FireWeapon: ent->weapon >= WP_NUM_WEAPONS"

	.comm	_cg_weapons,8,3                 ## @cg_weapons
	.comm	_cg,4,2                         ## @cg
	.comm	_WP_LIGHTNING,8,3               ## @WP_LIGHTNING
	.comm	_WP_RAILGUN,8,3                 ## @WP_RAILGUN
	.comm	_PW_QUAD,4,2                    ## @PW_QUAD
	.comm	_CHAN_ITEM,4,2                  ## @CHAN_ITEM
	.comm	_cgs,8,3                        ## @cgs
	.comm	_CHAN_WEAPON,4,2                ## @CHAN_WEAPON
	.comm	_cg_brassTime,8,3               ## @cg_brassTime
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_CG_FireWeapon                  ; -- Begin function CG_FireWeapon
	.p2align	2
_CG_FireWeapon:                         ; @CG_FireWeapon
	.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
	ldr	x20, [x0]
Lloh0:
	adrp	x8, _WP_NONE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _WP_NONE@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x20, x8
	b.ne	LBB0_2
LBB0_1:
	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
LBB0_2:
Lloh3:
	adrp	x8, _WP_NUM_WEAPONS@GOTPAGE
Lloh4:
	ldr	x8, [x8, _WP_NUM_WEAPONS@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	cmp	x20, x8
	b.hs	LBB0_14
; %bb.3:
	mov	x19, x0
Lloh6:
	adrp	x8, _cg_weapons@GOTPAGE
Lloh7:
	ldr	x8, [x8, _cg_weapons@GOTPAGEOFF]
Lloh8:
	ldr	x21, [x8]
Lloh9:
	adrp	x8, _cg@GOTPAGE
Lloh10:
	ldr	x8, [x8, _cg@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	str	w8, [x0, #32]
Lloh12:
	adrp	x9, _WP_LIGHTNING@GOTPAGE
Lloh13:
	ldr	x9, [x9, _WP_LIGHTNING@GOTPAGEOFF]
Lloh14:
	ldr	x9, [x9]
	cmp	x20, x9
	b.ne	LBB0_5
; %bb.4:
	ldr	x9, [x19, #24]
	cbnz	x9, LBB0_1
LBB0_5:
Lloh15:
	adrp	x9, _WP_RAILGUN@GOTPAGE
Lloh16:
	ldr	x9, [x9, _WP_RAILGUN@GOTPAGEOFF]
Lloh17:
	ldr	x9, [x9]
	cmp	x20, x9
	b.ne	LBB0_7
; %bb.6:
	str	w8, [x19, #16]
LBB0_7:
	ldr	w8, [x19, #8]
Lloh18:
	adrp	x9, _PW_QUAD@GOTPAGE
Lloh19:
	ldr	x9, [x9, _PW_QUAD@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
	lsr	w8, w8, w9
	tbz	w8, #0, LBB0_9
; %bb.8:
	ldr	w1, [x19, #12]
Lloh21:
	adrp	x8, _CHAN_ITEM@GOTPAGE
Lloh22:
	ldr	x8, [x8, _CHAN_ITEM@GOTPAGEOFF]
Lloh23:
	ldr	w2, [x8]
Lloh24:
	adrp	x8, _cgs@GOTPAGE
Lloh25:
	ldr	x8, [x8, _cgs@GOTPAGEOFF]
Lloh26:
	ldr	x3, [x8]
	mov	x0, #0
	bl	_trap_S_StartSound
LBB0_9:
	add	x22, x21, x20, lsl #4
	ldr	x8, [x22, #8]!
	ldr	x9, [x8]
	cbz	x9, LBB0_20
; %bb.10:
	ldr	x9, [x8, #8]
	cbz	x9, LBB0_15
; %bb.11:
	ldr	x9, [x8, #16]
	cbz	x9, LBB0_16
; %bb.12:
	ldr	x8, [x8, #24]
	cbz	x8, LBB0_17
; %bb.13:
	mov	w23, #4
	b	LBB0_18
LBB0_14:
Lloh27:
	adrp	x0, l_.str@PAGE
Lloh28:
	add	x0, x0, l_.str@PAGEOFF
	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
	b	_CG_Error
LBB0_15:
	mov	w23, #1
	b	LBB0_18
LBB0_16:
	mov	w23, #2
	b	LBB0_18
LBB0_17:
	mov	w23, #3
LBB0_18:
	bl	_rand
	sdiv	w8, w0, w23
	msub	w8, w8, w23, w0
	ldr	x9, [x22]
	ldr	x3, [x9, w8, sxtw #3]
	cbz	x3, LBB0_20
; %bb.19:
	ldr	w1, [x19, #12]
Lloh29:
	adrp	x8, _CHAN_WEAPON@GOTPAGE
Lloh30:
	ldr	x8, [x8, _CHAN_WEAPON@GOTPAGEOFF]
Lloh31:
	ldr	w2, [x8]
	mov	x0, #0
	bl	_trap_S_StartSound
LBB0_20:
	lsl	x8, x20, #4
	ldr	x1, [x21, x8]
Lloh32:
	adrp	x8, _cg_brassTime@GOTPAGE
Lloh33:
	ldr	x8, [x8, _cg_brassTime@GOTPAGEOFF]
Lloh34:
	ldr	x8, [x8]
	cmp	x1, #0
	ccmp	x8, #1, #8, ne
	b.lt	LBB0_1
; %bb.21:
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	br	x1
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.cfi_endproc
                                        ; -- End function
	.comm	_WP_NONE,8,3                    ; @WP_NONE
	.comm	_WP_NUM_WEAPONS,8,3             ; @WP_NUM_WEAPONS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"CG_FireWeapon: ent->weapon >= WP_NUM_WEAPONS"

	.comm	_cg_weapons,8,3                 ; @cg_weapons
	.comm	_cg,4,2                         ; @cg
	.comm	_WP_LIGHTNING,8,3               ; @WP_LIGHTNING
	.comm	_WP_RAILGUN,8,3                 ; @WP_RAILGUN
	.comm	_PW_QUAD,4,2                    ; @PW_QUAD
	.comm	_CHAN_ITEM,4,2                  ; @CHAN_ITEM
	.comm	_cgs,8,3                        ; @cgs
	.comm	_CHAN_WEAPON,4,2                ; @CHAN_WEAPON
	.comm	_cg_brassTime,8,3               ; @cg_brassTime
.subsections_via_symbols
