// File: /workspace/github_c_makefile_star2_O3/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 0x19a05(%rip), %rcx     # 0x687d8
movl $0x1388, %eax           # imm = 0x1388
cmpl $0x6, (%rcx)
movl $0x1388, %ecx           # imm = 0x1388
je 0x4ee15
movq 0x1a0d7(%rip), %rax     # 0x68ec0
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, 0x4a269(%rip)     # 0x99094
cmovel %eax, %ebp
cmovel %ecx, %r14d
movl $0xebc, %edi            # imm = 0xEBC
addq 0x58(%rbx), %rdi
leaq 0x20(%rsp), %r13
leaq 0x4(%rsp), %rdx
movq %r13, %rsi
xorl %ecx, %ecx
callq 0x183a0
movl $0xe88, %esi            # imm = 0xE88
addq 0x58(%rbx), %rsi
movss 0xc008(%rip), %xmm0     # 0x5ae68
movq %r13, %rdi
callq 0x189d0
movq 0x58(%rbx), %rax
movl $0xc0400000, 0xe7c(%rax) # imm = 0xC0400000
movsd 0xbfb2(%rip), %xmm0     # 0x5ae30
leaq 0x10(%rsp), %rdx
movsd %xmm0, (%rdx)
movl 0x278(%rbx), %ecx
addl $-0x8, %ecx
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
movss %xmm0, 0x8(%rdx)
leaq 0x4(%rbx), %r12
movl 0x300(%rax), %edi
leaq 0x2c(%rsp), %r15
movq %r12, %rsi
movq %r13, %rcx
leaq 0x4(%rsp), %r8
movq %r15, %r9
callq 0x4d0c5
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
movl %ebp, %ecx
movl %r14d, %r8d
callq 0x18a10
movq 0x19728(%rip), %r14     # 0x68600
movl $0x1, %edi
callq *0xc8(%r14)
movq 0x1966d(%rip), %rax     # 0x68558
movq %rbx, %rcx
subq (%rax), %rcx
shrq $0x3, %rcx
imull $0x8ce2cabd, %ecx, %edi # imm = 0x8CE2CABD
callq *0xd0(%r14)
movzbl 0x4a18f(%rip), %edi     # 0x99098
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 0x196d5(%rip), %rax     # 0x68618
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
btl $0xd, %eax
jb 0x4ef63
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