// File: /workspace/github_c_makefile_star2_O2/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 0x1bd4a(%rip), %rcx     # 0x667d8
movl $0x1388, %eax           # imm = 0x1388
cmpl $0x6, (%rcx)
movl $0x1388, %ecx           # imm = 0x1388
je 0x4aace
movq 0x1c41c(%rip), %rax     # 0x66ec0
movq (%rax), %rax
xorps %xmm0, %xmm0
ucomiss 0x20(%rax), %xmm0
setp %al
setne %cl
orb %al, %cl
pushq $0x64
popq %rcx
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, 0x4c6b0(%rip)     # 0x97194
cmovel %eax, %ebp
cmovel %ecx, %r14d
movl $0xebc, %edi            # imm = 0xEBC
addq 0x58(%rbx), %rdi
leaq 0x20(%rsp), %r13
leaq 0x14(%rsp), %r15
movq %r13, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x183d0
movl $0xe88, %esi            # imm = 0xE88
addq 0x58(%rbx), %rsi
movss 0xc30c(%rip), %xmm0     # 0x56e28
movq %r13, %rdi
callq 0x18a70
movq 0x58(%rbx), %rdi
movl $0xc0400000, 0xe7c(%rdi) # imm = 0xC0400000
movsd 0xc2b6(%rip), %xmm0     # 0x56df0
leaq 0x8(%rsp), %rdx
movsd %xmm0, (%rdx)
movl 0x278(%rbx), %eax
addl $-0x8, %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, 0x8(%rdx)
leaq 0x4(%rbx), %r12
leaq 0x2c(%rsp), %r9
movq %r12, %rsi
movq %r13, %rcx
movq %r15, %r8
movq %r9, %r15
callq 0x48f06
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
movl %ebp, %ecx
movl %r14d, %r8d
callq 0x18ab0
movq 0x1ba77(%rip), %r14     # 0x66600
pushq $0x1
popq %rbp
movl %ebp, %edi
callq *0xc8(%r14)
movq 0x1b9bc(%rip), %rcx     # 0x66558
movq %rbx, %rax
subq (%rcx), %rax
movl $0x4a8, %ecx            # imm = 0x4A8
cqto
idivq %rcx
movl %eax, %edi
callq *0xd0(%r14)
movzbl 0x4c5dc(%rip), %edi     # 0x97198
shll $0x7, %edi
orl $0x6, %edi
callq *0xc8(%r14)
pushq $0x2
popq %rsi
movq %r12, %rdi
callq *0xb0(%r14)
movq 0x58(%rbx), %rax
incl 0x5c(%rax)
movq %rbx, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x19010
movq 0x1ba27(%rip), %rax     # 0x66618
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
btl $0xd, %eax
jb 0x4ac11
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