// File: /workspace/github_c_makefile_star2_O1/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 0x183a0
movl $0xe88, %esi            # imm = 0xE88
addq 0x58(%rbx), %rsi
movss 0x5b99(%rip), %xmm0     # 0x55410
movq %r12, %rdi
callq 0x189d0
movq 0x58(%rbx), %rdi
movl $0xc0000000, 0xe7c(%rdi) # imm = 0xC0000000
movabsq $0x4100000000000000, %rax # imm = 0x4100000000000000
leaq 0x18(%rsp), %rdx
movq %rax, (%rdx)
movl 0x278(%rbx), %eax
addl $-0x8, %eax
xorps %xmm0, %xmm0
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 0x4dde7
cmpl $0x0, 0x4a7be(%rip)     # 0x9a094
movl $0xc, %eax
movl $0x30, %ebp
cmovel %eax, %ebp
movl $0x6, %eax
movl $0x18, %r13d
cmovel %eax, %r13d
movq 0x58(%rbx), %rax
movss 0xebc(%rax), %xmm0
leaq 0xc(%rsp), %r14
movss %xmm0, (%r14)
movss 0xec0(%rax), %xmm0
addss 0xc1f0(%rip), %xmm0     # 0x5bb08
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 0x183a0
subq $0x8, %rsp
movl $0x3, %r11d
movl $0xa, %r10d
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 0x186c0
addq $0x20, %rsp
movq 0x58(%rbx), %rax
movss 0xec0(%rax), %xmm0
addss 0x457d(%rip), %xmm0     # 0x53f04
movss %xmm0, 0x4(%r14)
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x183a0
subq $0x8, %rsp
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movl %r13d, %ecx
movl %ebp, %r8d
movl $0x3e8, %r9d            # imm = 0x3E8
movl $0x3, %eax
pushq %rax
movl $0xa, %eax
pushq %rax
movl $0x1f4, %eax            # imm = 0x1F4
pushq %rax
callq 0x186c0
addq $0x20, %rsp
movq 0x19c29(%rip), %r14     # 0x69600
movl $0x1, %edi
callq *0xc8(%r14)
movq 0x19b6e(%rip), %rax     # 0x69558
movq %rbx, %rcx
subq (%rax), %rcx
shrq $0x3, %rcx
imull $0x8ce2cabd, %ecx, %edi # imm = 0x8CE2CABD
callq *0xd0(%r14)
movzbl 0x4a690(%rip), %edi     # 0x9a098
shll $0x7, %edi
orl $0xd, %edi
callq *0xc8(%r14)
movq (%rsp), %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 0x19bd5(%rip), %rax     # 0x69618
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
btl $0xd, %eax
jb 0x4fa64
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