// File: /workspace/github_c_makefile_star2_O0/QwazyWabbitWOS[P]lmctf60/p_weapon.c
// Function: fire_fieldgun
void fire_fieldgun (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int hspread, int vspread, int count)
{
	int		i;
	trace_t	tr;
	vec3_t	end, from;
	vec3_t	mins, maxs;
	float		*v;
	edict_t	*target;

	if (!self)
		return;
	
	v = tv(-32, -32, -32);
	VectorCopy (v, mins);
	v = tv(32,32,32);
	VectorCopy (v, maxs);

	if ((level.framenum % 3) && self->client->hooklength)
	{
		return;
	}

	//for (i = 0; i < count; i++)
	//	fire_lead (self, start, aimdir, damage, kick, TE_SHOTGUN, hspread, vspread);

	//fire_shotgun (self, start, aimdir, damage, kick, hspread, vspread, count);
	// send gun puff / flash
	if (self->client->hooklength < 640)
	{
		if (self->client->hooklength < 96)
			self->client->hooklength = 96;
		else
			self->client->hooklength += 32;
	}

	VectorMA (start, self->client->hooklength, aimdir, end);
	VectorCopy (start, from);

	target = self;
	while (target)
	{
		tr = gi.trace (from, mins, maxs, end, self, MASK_SHOT);

		if ((tr.ent->svflags & SVF_MONSTER) || (tr.ent->client))
			target = tr.ent;
		else
			target = NULL;

		if (target && (target != self) && (target->takedamage))
			T_Damage (target, self, self, aimdir, tr.endpos, tr.plane.normal, 2, 5, 0, MOD_SHOTGUN);

		VectorCopy (tr.endpos, from);
	}

	for (i=96; i < self->client->hooklength; i+=32)
	{
		VectorMA (start, i, aimdir, end);
		
		tr = gi.trace (start, NULL, NULL, end, self, MASK_SHOT);
		//T_RadiusDamage(self, self, 10, self, 32);

		gi.WriteByte (svc_temp_entity);
		gi.WriteByte (TE_ROCKET_EXPLOSION);
		gi.WritePosition (tr.endpos);
		gi.multicast (self->s.origin, MULTICAST_PHS);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x160, %rsp            # imm = 0x160
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl %r9d, -0x24(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x69634
jmp 0x699bc
movss 0x7dd0(%rip), %xmm2     # 0x7140c
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
callq 0x19740
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movss (%rax), %xmm0
movss %xmm0, -0x94(%rbp)
movq -0xa8(%rbp), %rax
movss 0x4(%rax), %xmm0
movss %xmm0, -0x90(%rbp)
movq -0xa8(%rbp), %rax
movss 0x8(%rax), %xmm0
movss %xmm0, -0x8c(%rbp)
movss 0x6de3(%rip), %xmm2     # 0x70474
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
callq 0x19740
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movss (%rax), %xmm0
movss %xmm0, -0xa0(%rbp)
movq -0xa8(%rbp), %rax
movss 0x4(%rax), %xmm0
movss %xmm0, -0x9c(%rbp)
movq -0xa8(%rbp), %rax
movss 0x8(%rax), %xmm0
movss %xmm0, -0x98(%rbp)
movq 0x196bb(%rip), %rax     # 0x82da0
movl (%rax), %eax
movl $0x3, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
je 0x6970a
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
cmpl $0x0, 0xf5c(%rax)
je 0x6970a
jmp 0x699bc
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
cmpl $0x280, 0xf5c(%rax)     # imm = 0x280
jge 0x6975c
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
cmpl $0x60, 0xf5c(%rax)
jge 0x69743
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movl $0x60, 0xf5c(%rax)
jmp 0x6975a
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movl 0xf5c(%rax), %ecx
addl $0x20, %ecx
movl %ecx, 0xf5c(%rax)
jmp 0x6975c
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
cvtsi2ssl 0xf5c(%rax), %xmm0
movq -0x18(%rbp), %rsi
leaq -0x7c(%rbp), %rdx
callq 0x199c0
movq -0x10(%rbp), %rax
movss (%rax), %xmm0
movss %xmm0, -0x88(%rbp)
movq -0x10(%rbp), %rax
movss 0x4(%rax), %xmm0
movss %xmm0, -0x84(%rbp)
movq -0x10(%rbp), %rax
movss 0x8(%rax), %xmm0
movss %xmm0, -0x80(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xb0(%rbp)
cmpq $0x0, -0xb0(%rbp)
je 0x698e0
movq 0x18e34(%rip), %rax     # 0x82600
movq 0x60(%rax), %rax
leaq -0x88(%rbp), %rsi
leaq -0x94(%rbp), %rdx
leaq -0xa0(%rbp), %rcx
leaq -0x7c(%rbp), %r8
movq -0x8(%rbp), %r9
leaq -0xf8(%rbp), %rdi
movl $0x6000003, (%rsp)      # imm = 0x6000003
callq *%rax
leaq -0x70(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
movl $0x48, %edx
callq 0x18dc0
movq -0x30(%rbp), %rax
movl 0xc8(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
jne 0x6982f
movq -0x30(%rbp), %rax
cmpq $0x0, 0x58(%rax)
je 0x6983c
movq -0x30(%rbp), %rax
movq %rax, -0xb0(%rbp)
jmp 0x69847
movq $0x0, -0xb0(%rbp)
cmpq $0x0, -0xb0(%rbp)
je 0x698b7
movq -0xb0(%rbp), %rax
cmpq -0x8(%rbp), %rax
je 0x698b7
movq -0xb0(%rbp), %rax
cmpl $0x0, 0x27c(%rax)
je 0x698b7
movq -0xb0(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x8(%rbp), %rdx
movq -0x18(%rbp), %rcx
leaq -0x70(%rbp), %r8
addq $0xc, %r8
leaq -0x70(%rbp), %r9
addq $0x18, %r9
xorl %eax, %eax
movl $0x2, (%rsp)
movl $0x5, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
movl $0x2, 0x18(%rsp)
callq 0x192c0
movss -0x64(%rbp), %xmm0
movss %xmm0, -0x88(%rbp)
movss -0x60(%rbp), %xmm0
movss %xmm0, -0x84(%rbp)
movss -0x5c(%rbp), %xmm0
movss %xmm0, -0x80(%rbp)
jmp 0x697b7
movl $0x60, -0x28(%rbp)
movl -0x28(%rbp), %eax
movq -0x8(%rbp), %rcx
movq 0x58(%rcx), %rcx
cmpl 0xf5c(%rcx), %eax
jge 0x699bc
movq -0x10(%rbp), %rdi
cvtsi2ssl -0x28(%rbp), %xmm0
movq -0x18(%rbp), %rsi
leaq -0x7c(%rbp), %rdx
callq 0x199c0
movq 0x18ce5(%rip), %rax     # 0x82600
movq 0x60(%rax), %rax
movq -0x10(%rbp), %rsi
leaq -0x7c(%rbp), %r8
movq -0x8(%rbp), %r9
leaq -0x140(%rbp), %rdi
xorl %ecx, %ecx
movq %rcx, %rdx
movl $0x6000003, (%rsp)      # imm = 0x6000003
callq *%rax
leaq -0x70(%rbp), %rdi
leaq -0x140(%rbp), %rsi
movl $0x48, %edx
callq 0x18dc0
movl $0x3, %edi
movq 0x18c9f(%rip), %rax     # 0x82600
callq *0xc8(%rax)
movl $0x7, %edi
movq 0x18c8d(%rip), %rax     # 0x82600
callq *0xc8(%rax)
movq 0x18c80(%rip), %rax     # 0x82600
movq 0xf0(%rax), %rax
leaq -0x70(%rbp), %rdi
addq $0xc, %rdi
callq *%rax
movq 0x18c68(%rip), %rax     # 0x82600
movq 0xb0(%rax), %rax
movq -0x8(%rbp), %rdi
addq $0x4, %rdi
movl $0x1, %esi
callq *%rax
movl -0x28(%rbp), %eax
addl $0x20, %eax
movl %eax, -0x28(%rbp)
jmp 0x698e7
addq $0x160, %rsp            # imm = 0x160
popq %rbp
retq
nopw %cs:(%rax,%rax)