// File: /workspace/github_c_makefile_star2_O1/QwazyWabbitWOS[P]lmctf60/p_weapon.c
// Function: weapon_railgun_fire
void weapon_railgun_fire (edict_t *ent)
{
	vec3_t		start;
	vec3_t		forward, right;
	vec3_t		offset;
	int			damage;
	int			kick;

	if(matchstate == MATCH_RAILGUN_INPLAY)
	{
	 	damage = 5000;
	 	kick = 5000;
	}
	else if (deathmatch->value)
	{	
#ifdef WEAP_BALANCE_OK	
		// normal damage is too extreme in dm
		if ((int)ctfflags->value & CTF_WEAP_BALANCE)
		{
			damage = 82; //SURT was 100, we have a little formula to compensate later
			kick = 125; //make it a little less irritating to use
		}
		else
		{
			damage = 100;
			kick = 200;
		}
#else
		damage = 100;
		kick = 200;
#endif

	}
	else
	{
		damage = 150;
		kick = 250;
	}

	if (is_quad)
	{
		damage *= 4;
		kick *= 4;
	}

	AngleVectors (ent->client->v_angle, forward, right, NULL);

	VectorScale (forward, -3, ent->client->kick_origin);
	ent->client->kick_angles[0] = -3;

	VectorSet(offset, 0, 7,  ent->viewheight-8);
	P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start);
	fire_rail (ent, start, forward, damage, kick);

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

	ent->client->ps.gunframe++;
	PlayerNoise(ent, start, PNOISE_WEAPON);

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movq 0x19d14(%rip), %rcx     # 0x697d8
movl $0x1388, %eax           # imm = 0x1388
cmpl $0x6, (%rcx)
movl $0x1388, %ecx           # imm = 0x1388
je 0x4fb06
movq 0x1a3e6(%rip), %rax     # 0x69ec0
movq (%rax), %rax
xorps %xmm0, %xmm0
ucomiss 0x20(%rax), %xmm0
setp %al
setne %cl
orb %al, %cl
movl $0x64, %ecx
movl $0x96, %eax
cmovnel %ecx, %eax
movl $0xc8, %edx
movl $0xfa, %ecx
cmovnel %edx, %ecx
leal (,%rax,4), %ebp
leal (,%rcx,4), %r14d
cmpl $0x0, 0x4a578(%rip)     # 0x9a094
cmovel %eax, %ebp
cmovel %ecx, %r14d
movl $0xebc, %edi            # imm = 0xEBC
addq 0x58(%rbx), %rdi
leaq 0x20(%rsp), %r13
leaq 0x8(%rsp), %rdx
movq %r13, %rsi
xorl %ecx, %ecx
callq 0x183a0
movl $0xe88, %esi            # imm = 0xE88
addq 0x58(%rbx), %rsi
movss 0xbfbb(%rip), %xmm0     # 0x5bb0c
movq %r13, %rdi
callq 0x189d0
movq 0x58(%rbx), %rdi
movl $0xc0400000, 0xe7c(%rdi) # imm = 0xC0400000
movabsq $0x40e0000000000000, %rax # imm = 0x40E0000000000000
leaq 0x14(%rsp), %rdx
movq %rax, (%rdx)
movl 0x278(%rbx), %eax
addl $-0x8, %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movss %xmm0, 0x8(%rdx)
leaq 0x4(%rbx), %r12
leaq 0x2c(%rsp), %r15
movq %r12, %rsi
movq %r13, %rcx
leaq 0x8(%rsp), %r8
movq %r15, %r9
callq 0x4dde7
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
movl %ebp, %ecx
movl %r14d, %r8d
callq 0x18a10
movq 0x19a3c(%rip), %r14     # 0x69600
movl $0x1, %edi
callq *0xc8(%r14)
movq 0x19981(%rip), %rax     # 0x69558
movq %rbx, %rcx
subq (%rax), %rcx
shrq $0x3, %rcx
imull $0x8ce2cabd, %ecx, %edi # imm = 0x8CE2CABD
callq *0xd0(%r14)
movzbl 0x4a4a3(%rip), %edi     # 0x9a098
shll $0x7, %edi
orl $0x6, %edi
callq *0xc8(%r14)
movq %r12, %rdi
movl $0x2, %esi
callq *0xb0(%r14)
movq 0x58(%rbx), %rax
incl 0x5c(%rax)
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x18ef0
movq 0x199e9(%rip), %rax     # 0x69618
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
btl $0xd, %eax
jb 0x4fc4f
movq 0x58(%rbx), %rax
movslq 0xe38(%rax), %rcx
decl 0x318(%rax,%rcx,4)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq