// File: /workspace/github_c_makefile_star2_O3/QwazyWabbitWOS[P]lmctf60/p_weapon.c
// Function: weapon_shotgun_fire
void weapon_shotgun_fire (edict_t *ent)
{
	vec3_t		start;
	vec3_t		forward, right;
	vec3_t		offset;
	int			damage = 4;
	int			kick = 8;
	int			count = 0; //surt weapon balance

	if (ent->client->ps.gunframe == 9)
	{
		ent->client->ps.gunframe++;
		return;
	}

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

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

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

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

#ifdef WEAP_BALANCE_OK	
	if ((int)ctfflags->value & CTF_WEAP_BALANCE) //surt
	{
		damage+=1; //slightly more damage, except with quad
		count = 2; //more pellets 
	}
#endif

	if (deathmatch->value)
		fire_shotgun (ent, start, forward, damage, kick, 500, 500, DEFAULT_DEATHMATCH_SHOTGUN_COUNT + count, MOD_SHOTGUN); //surt balance
	else
		fire_shotgun (ent, start, forward, damage, kick, 500, 500, DEFAULT_SHOTGUN_COUNT + count, MOD_SHOTGUN); //surt balance

	// send muzzle flash
	gi.WriteByte (svc_muzzleflash);
	gi.WriteShort (ent-g_edicts);
	gi.WriteByte (MZ_SHOTGUN | 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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
movq 0x58(%rdi), %rdi
cmpl $0x9, 0x5c(%rdi)
jne 0x4e58e
movl $0xa, 0x5c(%rdi)
jmp 0x4e6f5
addq $0xebc, %rdi            # imm = 0xEBC
leaq 0x18(%rsp), %r12
leaq 0xc(%rsp), %r13
movq %r12, %rsi
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x183a0
movl $0xe88, %esi            # imm = 0xE88
addq 0x58(%rbx), %rsi
movss 0x5e53(%rip), %xmm0     # 0x54410
movq %r12, %rdi
callq 0x189d0
movq 0x58(%rbx), %rax
movl $0xc0000000, 0xe7c(%rax) # imm = 0xC0000000
movsd 0xc845(%rip), %xmm0     # 0x5ae20
movq %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), %r15
movl 0x300(%rax), %edi
leaq 0x24(%rsp), %r14
movq %r15, %rsi
movq %r12, %rcx
movq %r13, %r8
movq %r14, %r9
callq 0x4d0c5
cmpl $0x0, 0x4aa76(%rip)     # 0x99094
movl $0x8, %eax
movl $0x20, %r8d
cmovel %eax, %r8d
movl $0x4, %eax
movl $0x10, %ecx
cmovel %eax, %ecx
subq $0x8, %rsp
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
movl $0x1f4, %r9d            # imm = 0x1F4
pushq $0x2
pushq $0xc
pushq $0x1f4                  # imm = 0x1F4
callq 0x186c0
addq $0x20, %rsp
movq 0x19f9a(%rip), %r12     # 0x68600
movl $0x1, %edi
callq *0xc8(%r12)
movq 0x19ede(%rip), %rax     # 0x68558
movq %rbx, %rcx
subq (%rax), %rcx
shrq $0x3, %rcx
imull $0x8ce2cabd, %ecx, %edi # imm = 0x8CE2CABD
callq *0xd0(%r12)
movzbl 0x4a9ff(%rip), %edi     # 0x99098
shll $0x7, %edi
orl $0x2, %edi
callq *0xc8(%r12)
movq %r15, %rdi
movl $0x2, %esi
callq *0xb0(%r12)
movq 0x58(%rbx), %rax
incl 0x5c(%rax)
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x18ef0
movq 0x19f43(%rip), %rax     # 0x68618
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
btl $0xd, %eax
jb 0x4e6f5
movq 0x58(%rbx), %rax
movslq 0xe38(%rax), %rcx
decl 0x318(%rax,%rcx,4)
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq