// File: /workspace/github_c_makefile_star2_O0/QwazyWabbitWOS[P]lmctf60/p_weapon.c
// Function: weapon_plasma_fire
void weapon_plasma_fire (edict_t *ent)
{
	vec3_t	offset, start;
	vec3_t	forward, right;

	// if outa ammo, don't fire
	if (ent->client->pers.inventory[ent->client->ammo_index] < 1) {
		ent->client->ps.gunframe++;

		if (level.time >= ent->pain_debounce_time)
		{
			gi.sound(ent, CHAN_VOICE, gi.soundindex(PLASMA_SOUND_EMPTY), 1, ATTN_NORM, 0);
			ent->pain_debounce_time = level.time + 1;
		}
		
		NoAmmoWeaponChange (ent);
		return;
	}

	if (ent->client->ps.gunframe == 4) {
		AngleVectors (ent->client->v_angle, forward, right, NULL);
		VectorScale (forward, -2, ent->client->kick_origin);
		
		// fire weapon
		VectorSet(offset, 8, 8, ent->viewheight-8);
		P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start);

		if( ent->client->plasma_mode ) {
		gi.sound( ent,CHAN_WEAPON, gi.soundindex(PLASMA_SOUND_FIRE1), 1,
		          ATTN_NORM,0 );
		fire_plasma (ent, start, forward, 1);
		} else {
		gi.sound( ent,CHAN_WEAPON, gi.soundindex(PLASMA_SOUND_FIRE2), 1,
		          ATTN_NORM,0 );
		fire_plasma (ent, start, forward, 0);
		}

		if (! ( (int)dmflags->value & DF_INFINITE_AMMO ) )
			ent->client->pers.inventory[ent->client->ammo_index] -= 1;

		// make a big pitch kick with an inverse fall
		ent->client->v_dmg_pitch = -2;
		ent->client->v_dmg_roll = crandom()*2;
		ent->client->v_dmg_time = level.time + DAMAGE_TIME;

	}


	//-bat Silence??
	// send muzzle flash
	//gi.WriteByte (svc_muzzleflash);
	//gi.WriteShort (ent-g_edicts);
	//gi.WriteByte (MZ_ROCKET | is_silenced);
	//gi.multicast (ent->s.origin, MULTICAST_PVS);


	ent->client->ps.gunframe++;

	PlayerNoise(ent, start, PNOISE_WEAPON);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x58(%rcx), %rcx
movslq 0xe38(%rcx), %rcx
cmpl $0x1, 0x318(%rax,%rcx,4)
jge 0x6b920
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movl 0x5c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x5c(%rax)
movq 0x17507(%rip), %rax     # 0x82da0
movss 0x4(%rax), %xmm0
movq -0x8(%rbp), %rax
ucomiss 0x244(%rax), %xmm0
jb 0x6b912
movq 0x16d4e(%rip), %rax     # 0x82600
movq 0x20(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq 0xc31c(%rip), %rdi      # 0x77be5
movq 0x16d30(%rip), %rax     # 0x82600
callq *0x48(%rax)
movq -0x48(%rbp), %rdi
movl %eax, %edx
movq -0x40(%rbp), %rax
movl $0x2, %esi
movss 0x4602(%rip), %xmm1     # 0x6feec
xorps %xmm2, %xmm2
movaps %xmm1, %xmm0
callq *%rax
movss 0x45f2(%rip), %xmm0     # 0x6feec
movq 0x1749f(%rip), %rax     # 0x82da0
addss 0x4(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x244(%rax)
movq -0x8(%rbp), %rdi
callq 0x194b0
jmp 0x6bb87
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
cmpl $0x4, 0x5c(%rax)
jne 0x6bb64
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
addq $0xebc, %rdi            # imm = 0xEBC
leaq -0x2c(%rbp), %rsi
leaq -0x38(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x183e0
leaq -0x2c(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rsi
addq $0xe88, %rsi            # imm = 0xE88
movss 0x5aa7(%rip), %xmm0     # 0x71414
callq 0x18a80
movss 0x4582(%rip), %xmm0     # 0x6fefc
movss %xmm0, -0x14(%rbp)
movss 0x4575(%rip), %xmm0     # 0x6fefc
movss %xmm0, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl 0x278(%rax), %eax
subl $0x8, %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
movq -0x8(%rbp), %rsi
addq $0x4, %rsi
leaq -0x14(%rbp), %rdx
leaq -0x2c(%rbp), %rcx
leaq -0x38(%rbp), %r8
leaq -0x20(%rbp), %r9
callq 0x67590
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
cmpl $0x0, 0xf3c(%rax)
je 0x6ba37
movq 0x16c21(%rip), %rax     # 0x82600
movq 0x20(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
leaq 0xc208(%rip), %rdi      # 0x77bfe
movq 0x16c03(%rip), %rax     # 0x82600
callq *0x48(%rax)
movq -0x58(%rbp), %rdi
movl %eax, %edx
movq -0x50(%rbp), %rax
movl $0x1, %esi
movss 0x44d5(%rip), %xmm1     # 0x6feec
xorps %xmm2, %xmm2
movaps %xmm1, %xmm0
callq *%rax
movq -0x8(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
movl $0x1, %ecx
callq 0x18480
jmp 0x6ba91
movq 0x16bc2(%rip), %rax     # 0x82600
movq 0x20(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq 0xc1c2(%rip), %rdi      # 0x77c17
movq 0x16ba4(%rip), %rax     # 0x82600
callq *0x48(%rax)
movq -0x68(%rbp), %rdi
movl %eax, %edx
movq -0x60(%rbp), %rax
movl $0x1, %esi
movss 0x4476(%rip), %xmm1     # 0x6feec
xorps %xmm2, %xmm2
movaps %xmm1, %xmm0
callq *%rax
movq -0x8(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
xorl %ecx, %ecx
callq 0x18480
movq 0x16b80(%rip), %rax     # 0x82618
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
jne 0x6bad2
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x58(%rcx), %rcx
movslq 0xe38(%rcx), %rcx
movl 0x318(%rax,%rcx,4), %edx
subl $0x1, %edx
movl %edx, 0x318(%rax,%rcx,4)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movss 0x5932(%rip), %xmm0     # 0x71414
movss %xmm0, 0xe98(%rax)
callq 0x19c80
andl $0x7fff, %eax           # imm = 0x7FFF
cvtsi2ss %eax, %xmm0
movss 0x4788(%rip), %xmm1     # 0x70288
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x5918(%rip), %xmm0     # 0x71428
subsd %xmm0, %xmm1
movsd 0x707c(%rip), %xmm0     # 0x72b98
mulsd %xmm1, %xmm0
movsd 0x7070(%rip), %xmm1     # 0x72b98
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movss %xmm0, 0xe94(%rax)
movss 0x7008(%rip), %xmm0     # 0x72b50
movq 0x17251(%rip), %rax     # 0x82da0
addss 0x4(%rax), %xmm0
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movss %xmm0, 0xe9c(%rax)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movl 0x5c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x5c(%rax)
movq -0x8(%rbp), %rdi
leaq -0x20(%rbp), %rsi
movl $0x1, %edx
callq 0x19080
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)