// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movq 0x58(%rdi), %rdi
cmpl $0x9, 0x5c(%rdi)
jne 0x4a2eb
movl $0xa, 0x5c(%rdi)
jmp 0x4a440
addq $0xebc, %rdi            # imm = 0xEBC
leaq 0x20(%rsp), %r12
leaq 0x14(%rsp), %r13
movq %r12, %rsi
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x183d0
movl $0xe88, %esi            # imm = 0xE88
addq 0x58(%rbx), %rsi
movss 0x60f6(%rip), %xmm0     # 0x50410
movq %r12, %rdi
callq 0x18a70
movq 0x58(%rbx), %rdi
movl $0xc0000000, 0xe7c(%rdi) # imm = 0xC0000000
movsd 0xcaa8(%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), %r15
leaq 0x2c(%rsp), %r14
movq %r15, %rsi
movq %r12, %rcx
movq %r13, %r8
movq %r14, %r9
callq 0x48f06
cmpl $0x0, 0x4ce20(%rip)     # 0x97194
pushq $0x8
popq %rax
pushq $0x20
popq %r8
cmovel %eax, %r8d
pushq $0x4
popq %rax
pushq $0x10
popq %rcx
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 0x18700
addq $0x20, %rsp
movq 0x1c24c(%rip), %r12     # 0x66600
pushq $0x1
popq %rbp
movl %ebp, %edi
callq *0xc8(%r12)
movq 0x1c190(%rip), %rcx     # 0x66558
movq %rbx, %rax
subq (%rcx), %rax
movl $0x4a8, %ecx            # imm = 0x4A8
cqto
idivq %rcx
movl %eax, %edi
callq *0xd0(%r12)
movzbl 0x4cdaf(%rip), %edi     # 0x97198
shll $0x7, %edi
orl $0x2, %edi
callq *0xc8(%r12)
pushq $0x2
popq %rsi
movq %r15, %rdi
callq *0xb0(%r12)
movq 0x58(%rbx), %rax
incl 0x5c(%rax)
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x19010
movq 0x1c1f8(%rip), %rax     # 0x66618
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
btl $0xd, %eax
jb 0x4a440
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