// File: /workspace/github_c_makefile_star2_O2/QwazyWabbitWOS[P]lmctf60/p_weapon.c
// Function: weapon_supershotgun_fire
void weapon_supershotgun_fire (edict_t *ent)
{
	vec3_t		start;
	vec3_t		forward, right;
	vec3_t		offset;
	vec3_t		v;
	int			damage = 6;
	int			kick = 12;
	int			count = 0; //for damage balance

	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
	{
		count = 12;
		damage-=3; //slightly less damage, except with quad
	}
#endif

	v[PITCH] = ent->client->v_angle[PITCH];
	v[YAW]   = ent->client->v_angle[YAW] - 5;
	v[ROLL]  = ent->client->v_angle[ROLL];
	AngleVectors (v, forward, NULL, NULL);
	fire_shotgun (ent, start, forward, damage, kick, DEFAULT_SHOTGUN_HSPREAD, DEFAULT_SHOTGUN_VSPREAD, DEFAULT_SSHOTGUN_COUNT/2 + count/2, MOD_SSHOTGUN); //surt, balance
	v[YAW]   = ent->client->v_angle[YAW] + 5;
	AngleVectors (v, forward, NULL, NULL);
	fire_shotgun (ent, start, forward, damage, kick, DEFAULT_SHOTGUN_HSPREAD, DEFAULT_SHOTGUN_VSPREAD, DEFAULT_SSHOTGUN_COUNT/2 + count/2, MOD_SSHOTGUN); //surt balance

	// send muzzle flash
	gi.WriteByte (svc_muzzleflash);
	gi.WriteShort (ent-g_edicts);
	gi.WriteByte (MZ_SSHOTGUN | 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] -= 2;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movl $0xebc, %edi            # imm = 0xEBC
addq 0x58(%rbx), %rdi
leaq 0x30(%rsp), %r12
leaq 0x24(%rsp), %r14
movq %r12, %rsi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x183d0
movl $0xe88, %esi            # imm = 0xE88
addq 0x58(%rbx), %rsi
movss 0x5bae(%rip), %xmm0     # 0x50410
movq %r12, %rdi
callq 0x18a70
movq 0x58(%rbx), %rdi
movl $0xc0000000, 0xe7c(%rdi) # imm = 0xC0000000
movsd 0xc560(%rip), %xmm0     # 0x56de0
leaq 0x8(%rsp), %rdx
movsd %xmm0, (%rdx)
movl 0x278(%rbx), %eax
addl $-0x8, %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, 0x8(%rdx)
leaq 0x4(%rbx), %rsi
movq %rsi, (%rsp)
leaq 0x3c(%rsp), %r15
movq %r12, %rcx
movq %r14, %r8
movq %r15, %r9
callq 0x48f06
cmpl $0x0, 0x4c8d7(%rip)     # 0x97194
pushq $0xc
popq %rax
pushq $0x30
popq %rbp
cmovel %eax, %ebp
pushq $0x6
popq %rax
pushq $0x18
popq %r13
cmovel %eax, %r13d
movq 0x58(%rbx), %rax
movss 0xebc(%rax), %xmm0
leaq 0x18(%rsp), %r14
movss %xmm0, (%r14)
movss 0xec0(%rax), %xmm0
addss 0xc52d(%rip), %xmm0     # 0x56e24
movss %xmm0, 0x4(%r14)
movss 0xec4(%rax), %xmm0
movss %xmm0, 0x8(%r14)
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x183d0
subq $0x8, %rsp
pushq $0x3
popq %r11
pushq $0xa
popq %r10
movl $0x1f4, %eax            # imm = 0x1F4
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movl %r13d, %ecx
movl %ebp, %r8d
movl $0x3e8, %r9d            # imm = 0x3E8
pushq %r11
pushq %r10
pushq %rax
callq 0x18700
addq $0x20, %rsp
movq 0x58(%rbx), %rax
movss 0xec0(%rax), %xmm0
addss 0x45a2(%rip), %xmm0     # 0x4ef04
movss %xmm0, 0x4(%r14)
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x183d0
subq $0x8, %rsp
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movl %r13d, %ecx
movl %ebp, %r8d
movl $0x3e8, %r9d            # imm = 0x3E8
pushq $0x3
popq %rax
pushq %rax
pushq $0xa
popq %rax
pushq %rax
movl $0x1f4, %eax            # imm = 0x1F4
pushq %rax
callq 0x18700
addq $0x20, %rsp
movq 0x1bc52(%rip), %r14     # 0x66600
pushq $0x1
popq %rbp
movl %ebp, %edi
callq *0xc8(%r14)
movq 0x1bb97(%rip), %rcx     # 0x66558
movq %rbx, %rax
subq (%rcx), %rax
movl $0x4a8, %ecx            # imm = 0x4A8
cqto
idivq %rcx
movl %eax, %edi
callq *0xd0(%r14)
movzbl 0x4c7b7(%rip), %edi     # 0x97198
shll $0x7, %edi
orl $0xd, %edi
callq *0xc8(%r14)
pushq $0x2
popq %rsi
movq (%rsp), %rdi
callq *0xb0(%r14)
movq 0x58(%rbx), %rax
incl 0x5c(%rax)
movq %rbx, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x19010
movq 0x1bc01(%rip), %rax     # 0x66618
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
btl $0xd, %eax
jb 0x4aa38
movq 0x58(%rbx), %rax
movslq 0xe38(%rax), %rcx
addl $-0x2, 0x318(%rax,%rcx,4)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq