	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_P_GiveWeapon                   ## -- Begin function P_GiveWeapon
	.p2align	4, 0x90
_P_GiveWeapon:                          ## @P_GiveWeapon
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	movq	%rdi, %r14
	testl	%edx, %edx
	jne	LBB0_6
## %bb.1:
	movq	_netgame@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_6
## %bb.2:
	movq	_deathmatch@GOTPCREL(%rip), %rax
	cmpl	$2, (%rax)
	je	LBB0_6
## %bb.3:
	movq	(%r14), %rcx
	xorl	%r15d, %r15d
	cmpl	$0, (%rcx,%rbx,4)
	jne	LBB0_11
## %bb.4:
	movq	_BONUSADD@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	addl	%edx, 16(%r14)
	movl	$1, (%rcx,%rbx,4)
	xorl	%ecx, %ecx
	cmpl	$0, (%rax)
	setne	%cl
	movq	_weaponinfo@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	(%rax,%rbx,8), %rsi
	leal	(%rcx,%rcx,2), %edx
	addl	$2, %edx
	movq	%r14, %rdi
	callq	_P_GiveAmmo
	movq	%rbx, 8(%r14)
	movq	_players@GOTPCREL(%rip), %rax
	movq	_consoleplayer@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	leaq	(%rcx,%rcx,2), %rcx
	shlq	$3, %rcx
	addq	(%rax), %rcx
	cmpq	%r14, %rcx
	jne	LBB0_11
## %bb.5:
	movq	_sfx_wpnup@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%r15d, %r15d
	xorl	%edi, %edi
	callq	_S_StartSound
	jmp	LBB0_11
LBB0_6:
	movq	_weaponinfo@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	(%rax,%rbx,8), %rsi
	movq	_am_noammo@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	cmpq	(%rcx), %rsi
	je	LBB0_8
## %bb.7:
	xorl	%eax, %eax
	cmpl	$1, %edx
	adcl	$1, %eax
	movq	%r14, %rdi
	movl	%eax, %edx
	callq	_P_GiveAmmo
LBB0_8:
	movq	(%r14), %rdx
	movl	(%rdx,%rbx,4), %ecx
	testl	%ecx, %ecx
	jne	LBB0_10
## %bb.9:
	movl	$1, (%rdx,%rbx,4)
	movq	%rbx, 8(%r14)
LBB0_10:
	testl	%ecx, %ecx
	sete	%cl
	testl	%eax, %eax
	setne	%al
	orb	%cl, %al
	movzbl	%al, %r15d
LBB0_11:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_netgame,8,3                    ## @netgame
	.comm	_deathmatch,4,2                 ## @deathmatch
	.comm	_BONUSADD,8,3                   ## @BONUSADD
	.comm	_weaponinfo,8,3                 ## @weaponinfo
	.comm	_players,8,3                    ## @players
	.comm	_consoleplayer,8,3              ## @consoleplayer
	.comm	_sfx_wpnup,4,2                  ## @sfx_wpnup
	.comm	_am_noammo,8,3                  ## @am_noammo
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_P_GiveWeapon                   ; -- Begin function P_GiveWeapon
	.p2align	2
_P_GiveWeapon:                          ; @P_GiveWeapon
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x20, x1
	mov	x19, x0
	cbnz	w2, LBB0_5
; %bb.1:
Lloh0:
	adrp	x8, _netgame@GOTPAGE
Lloh1:
	ldr	x8, [x8, _netgame@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x8]
Lloh3:
	adrp	x8, _deathmatch@GOTPAGE
Lloh4:
	ldr	x8, [x8, _deathmatch@GOTPAGEOFF]
	ldr	w10, [x8]
	cmp	x9, #0
	ccmp	w10, #2, #4, ne
	b.eq	LBB0_5
; %bb.2:
	ldr	x9, [x19]
	ldr	w10, [x9, x20, lsl #2]
	cbnz	w10, LBB0_4
; %bb.3:
Lloh5:
	adrp	x10, _BONUSADD@GOTPAGE
Lloh6:
	ldr	x10, [x10, _BONUSADD@GOTPAGEOFF]
Lloh7:
	ldr	w10, [x10]
	ldr	w11, [x19, #16]
	add	w10, w11, w10
	str	w10, [x19, #16]
	mov	w10, #1
	str	w10, [x9, x20, lsl #2]
	ldr	w8, [x8]
Lloh8:
	adrp	x9, _weaponinfo@GOTPAGE
Lloh9:
	ldr	x9, [x9, _weaponinfo@GOTPAGEOFF]
Lloh10:
	ldr	x9, [x9]
	ldr	x1, [x9, x20, lsl #3]
	mov	w9, #5
	mov	w10, #2
	cmp	w8, #0
	csel	w2, w10, w9, eq
	mov	x0, x19
	bl	_P_GiveAmmo
	str	x20, [x19, #8]
Lloh11:
	adrp	x8, _players@GOTPAGE
Lloh12:
	ldr	x8, [x8, _players@GOTPAGEOFF]
Lloh13:
	ldr	x8, [x8]
Lloh14:
	adrp	x9, _consoleplayer@GOTPAGE
Lloh15:
	ldr	x9, [x9, _consoleplayer@GOTPAGEOFF]
Lloh16:
	ldr	x9, [x9]
	mov	w10, #24
	madd	x8, x9, x10, x8
	cmp	x8, x19
	b.eq	LBB0_12
LBB0_4:
	mov	w0, #0
	b	LBB0_11
LBB0_5:
Lloh17:
	adrp	x8, _weaponinfo@GOTPAGE
Lloh18:
	ldr	x8, [x8, _weaponinfo@GOTPAGEOFF]
Lloh19:
	ldr	x8, [x8]
	ldr	x1, [x8, x20, lsl #3]
Lloh20:
	adrp	x8, _am_noammo@GOTPAGE
Lloh21:
	ldr	x8, [x8, _am_noammo@GOTPAGEOFF]
Lloh22:
	ldr	x8, [x8]
	cmp	x1, x8
	b.ne	LBB0_7
; %bb.6:
	mov	w0, #0
	b	LBB0_8
LBB0_7:
	cmp	w2, #0
	mov	w8, #1
	cinc	w2, w8, eq
	mov	x0, x19
	bl	_P_GiveAmmo
LBB0_8:
	ldr	x9, [x19]
	ldr	w8, [x9, x20, lsl #2]
	cbnz	w8, LBB0_10
; %bb.9:
	mov	w10, #1
	str	w10, [x9, x20, lsl #2]
	str	x20, [x19, #8]
LBB0_10:
	cmp	w8, #0
	ccmp	w0, #0, #0, ne
	cset	w0, ne
LBB0_11:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_12:
Lloh23:
	adrp	x8, _sfx_wpnup@GOTPAGE
Lloh24:
	ldr	x8, [x8, _sfx_wpnup@GOTPAGEOFF]
Lloh25:
	ldr	w1, [x8]
	mov	x0, #0
	bl	_S_StartSound
	mov	w0, #0
	b	LBB0_11
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_netgame,8,3                    ; @netgame
	.comm	_deathmatch,4,2                 ; @deathmatch
	.comm	_BONUSADD,8,3                   ; @BONUSADD
	.comm	_weaponinfo,8,3                 ; @weaponinfo
	.comm	_players,8,3                    ; @players
	.comm	_consoleplayer,8,3              ; @consoleplayer
	.comm	_sfx_wpnup,4,2                  ; @sfx_wpnup
	.comm	_am_noammo,8,3                  ; @am_noammo
.subsections_via_symbols
