// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq 0x18835(%rip), %rax     # 0x827d8
cmpl $0x6, (%rax)
jne 0x69fb8
movl $0x1388, -0x3c(%rbp)    # imm = 0x1388
movl $0x1388, -0x40(%rbp)    # imm = 0x1388
jmp 0x69ff3
movq 0x18f01(%rip), %rax     # 0x82ec0
movq (%rax), %rax
movss 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x69fd3
jp 0x69fd3
jmp 0x69fe3
movl $0x64, -0x3c(%rbp)
movl $0xc8, -0x40(%rbp)
jmp 0x69ff1
movl $0x96, -0x3c(%rbp)
movl $0xfa, -0x40(%rbp)
jmp 0x69ff3
cmpl $0x0, 0x4926a(%rip)     # 0xb3264
je 0x6a00e
movl -0x3c(%rbp), %eax
shll $0x2, %eax
movl %eax, -0x3c(%rbp)
movl -0x40(%rbp), %eax
shll $0x2, %eax
movl %eax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
addq $0xebc, %rdi            # imm = 0xEBC
leaq -0x20(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x183e0
leaq -0x20(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rsi
addq $0xe88, %rsi            # imm = 0xE88
movss 0xda07(%rip), %xmm0     # 0x77a50
callq 0x18a80
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movss 0xd9f2(%rip), %xmm0     # 0x77a50
movss %xmm0, 0xe7c(%rax)
xorps %xmm0, %xmm0
movss %xmm0, -0x38(%rbp)
movss 0x5e8a(%rip), %xmm0     # 0x6ff00
movss %xmm0, -0x34(%rbp)
movq -0x8(%rbp), %rax
movl 0x278(%rax), %eax
subl $0x8, %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
movq -0x8(%rbp), %rsi
addq $0x4, %rsi
leaq -0x38(%rbp), %rdx
leaq -0x20(%rbp), %rcx
leaq -0x2c(%rbp), %r8
leaq -0x14(%rbp), %r9
callq 0x67590
movq -0x8(%rbp), %rdi
leaq -0x14(%rbp), %rsi
leaq -0x20(%rbp), %rdx
movl -0x3c(%rbp), %ecx
movl -0x40(%rbp), %r8d
callq 0x18ae0
movl $0x1, %edi
movq 0x18526(%rip), %rax     # 0x82600
callq *0xc8(%rax)
movq 0x18519(%rip), %rax     # 0x82600
movq 0xd0(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq 0x1845b(%rip), %rcx     # 0x82558
movq (%rcx), %rcx
subq %rcx, %rax
movl $0x4a8, %ecx            # imm = 0x4A8
cqto
idivq %rcx
movq %rax, %rcx
movq -0x48(%rbp), %rax
movl %ecx, %edi
callq *%rax
movq 0x184e1(%rip), %rax     # 0x82600
movq 0xc8(%rax), %rax
movzbl 0x4913b(%rip), %edi     # 0xb3268
orl $0x6, %edi
callq *%rax
movq 0x184c7(%rip), %rax     # 0x82600
movq 0xb0(%rax), %rax
movq -0x8(%rbp), %rdi
addq $0x4, %rdi
movl $0x2, %esi
callq *%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 -0x14(%rbp), %rsi
movl $0x1, %edx
callq 0x19080
movq 0x1849f(%rip), %rax     # 0x82618
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
jne 0x6a1b3
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
addl $-0x1, %edx
movl %edx, 0x318(%rax,%rcx,4)
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)