// File: /workspace/github_c_makefile_star2_O0/QwazyWabbitWOS[P]lmctf60/g_weapon.c
// Function: fire_hit
qboolean fire_hit (edict_t *self, vec3_t aim, int damage, int kick)
{
	trace_t		tr;
	vec3_t		forward, right, up;
	vec3_t		v;
	vec3_t		point;
	float		range;
	vec3_t		dir;

	//see if enemy is in range
	VectorSubtract (self->enemy->s.origin, self->s.origin, dir);
	range = VectorLength(dir);
	if (range > aim[0])
		return false;

	if (aim[1] > self->mins[0] && aim[1] < self->maxs[0])
	{
		// the hit is straight on so back the range up to the edge of their bbox
		range -= self->enemy->maxs[0];
	}
	else
	{
		// this is a side hit so adjust the "right" value out to the edge of their bbox
		if (aim[1] < 0)
			aim[1] = self->enemy->mins[0];
		else
			aim[1] = self->enemy->maxs[0];
	}

	VectorMA (self->s.origin, range, dir, point);

	tr = gi.trace (self->s.origin, NULL, NULL, point, self, MASK_SHOT);
	if (tr.fraction < 1)
	{
		if (!tr.ent->takedamage)
			return false;
		// if it will hit any client/monster then hit the one we wanted to hit
		if ((tr.ent->svflags & SVF_MONSTER) || (tr.ent->client))
			tr.ent = self->enemy;
	}

	AngleVectors(self->s.angles, forward, right, up);
	VectorMA (self->s.origin, range, forward, point);
	VectorMA (point, aim[1], right, point);
	VectorMA (point, aim[2], up, point);
	VectorSubtract (point, self->enemy->s.origin, dir);

	// do the damage
	T_Damage (tr.ent, self, self, dir, point, vec3_origin, damage, kick/2, DAMAGE_NO_KNOCKBACK, MOD_HIT);

	if (!(tr.ent->svflags & SVF_MONSTER) && (!tr.ent->client))
		return false;

	// do our special form of knockback here
	VectorMA (self->enemy->absmin, 0.5, self->enemy->size, v);
	VectorSubtract (v, point, v);
	VectorNormalize (v);
	VectorMA (self->enemy->velocity, kick, v, self->enemy->velocity);
	if (self->enemy->velocity[2] > 0)
		self->enemy->groundentity = NULL;
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x2a0(%rax), %rax
movss 0x4(%rax), %xmm0
movq -0x10(%rbp), %rax
subss 0x4(%rax), %xmm0
movss %xmm0, -0xb4(%rbp)
movq -0x10(%rbp), %rax
movq 0x2a0(%rax), %rax
movss 0x8(%rax), %xmm0
movq -0x10(%rbp), %rax
subss 0x8(%rax), %xmm0
movss %xmm0, -0xb0(%rbp)
movq -0x10(%rbp), %rax
movq 0x2a0(%rax), %rax
movss 0xc(%rax), %xmm0
movq -0x10(%rbp), %rax
subss 0xc(%rax), %xmm0
movss %xmm0, -0xac(%rbp)
leaq -0xb4(%rbp), %rdi
callq 0x194e0
movss %xmm0, -0xa8(%rbp)
movss -0xa8(%rbp), %xmm0
movq -0x18(%rbp), %rax
ucomiss (%rax), %xmm0
jbe 0x515dd
movl $0x0, -0x4(%rbp)
jmp 0x5199d
movq -0x18(%rbp), %rax
movss 0x4(%rax), %xmm0
movq -0x10(%rbp), %rax
ucomiss 0xcc(%rax), %xmm0
jbe 0x51636
movq -0x18(%rbp), %rax
movss 0x4(%rax), %xmm1
movq -0x10(%rbp), %rax
movss 0xd8(%rax), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x51636
movq -0x10(%rbp), %rax
movq 0x2a0(%rax), %rax
movss 0xd8(%rax), %xmm1
movss -0xa8(%rbp), %xmm0
subss %xmm1, %xmm0
movss %xmm0, -0xa8(%rbp)
jmp 0x5167f
movq -0x18(%rbp), %rax
xorps %xmm0, %xmm0
ucomiss 0x4(%rax), %xmm0
jbe 0x51661
movq -0x10(%rbp), %rax
movq 0x2a0(%rax), %rax
movss 0xcc(%rax), %xmm0
movq -0x18(%rbp), %rax
movss %xmm0, 0x4(%rax)
jmp 0x5167d
movq -0x10(%rbp), %rax
movq 0x2a0(%rax), %rax
movss 0xd8(%rax), %xmm0
movq -0x18(%rbp), %rax
movss %xmm0, 0x4(%rax)
jmp 0x5167f
movq -0x10(%rbp), %rdi
addq $0x4, %rdi
movss -0xa8(%rbp), %xmm0
leaq -0xb4(%rbp), %rsi
leaq -0xa4(%rbp), %rdx
callq 0x199c0
movq 0x30f57(%rip), %rax     # 0x82600
movq 0x60(%rax), %rax
movq -0x10(%rbp), %rsi
addq $0x4, %rsi
leaq -0xa4(%rbp), %r8
movq -0x10(%rbp), %r9
leaq -0x100(%rbp), %rdi
xorl %ecx, %ecx
movq %rcx, %rdx
movl $0x6000003, (%rsp)      # imm = 0x6000003
callq *%rax
leaq -0x68(%rbp), %rdi
leaq -0x100(%rbp), %rsi
movl $0x48, %edx
callq 0x18dc0
movss 0x1e7fa(%rip), %xmm0    # 0x6feec
ucomiss -0x60(%rbp), %xmm0
jbe 0x5173f
movq -0x28(%rbp), %rax
cmpl $0x0, 0x27c(%rax)
jne 0x51711
movl $0x0, -0x4(%rbp)
jmp 0x5199d
movq -0x28(%rbp), %rax
movl 0xc8(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
jne 0x5172e
movq -0x28(%rbp), %rax
cmpq $0x0, 0x58(%rax)
je 0x5173d
movq -0x10(%rbp), %rax
movq 0x2a0(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x5173f
movq -0x10(%rbp), %rdi
addq $0x10, %rdi
leaq -0x74(%rbp), %rsi
leaq -0x80(%rbp), %rdx
leaq -0x8c(%rbp), %rcx
callq 0x183e0
movq -0x10(%rbp), %rdi
addq $0x4, %rdi
movss -0xa8(%rbp), %xmm0
leaq -0x74(%rbp), %rsi
leaq -0xa4(%rbp), %rdx
callq 0x199c0
leaq -0xa4(%rbp), %rdi
movq -0x18(%rbp), %rax
movss 0x4(%rax), %xmm0
leaq -0x80(%rbp), %rsi
leaq -0xa4(%rbp), %rdx
callq 0x199c0
leaq -0xa4(%rbp), %rdi
movq -0x18(%rbp), %rax
movss 0x8(%rax), %xmm0
leaq -0x8c(%rbp), %rsi
leaq -0xa4(%rbp), %rdx
callq 0x199c0
movss -0xa4(%rbp), %xmm0
movq -0x10(%rbp), %rax
movq 0x2a0(%rax), %rax
subss 0x4(%rax), %xmm0
movss %xmm0, -0xb4(%rbp)
movss -0xa0(%rbp), %xmm0
movq -0x10(%rbp), %rax
movq 0x2a0(%rax), %rax
subss 0x8(%rax), %xmm0
movss %xmm0, -0xb0(%rbp)
movss -0x9c(%rbp), %xmm0
movq -0x10(%rbp), %rax
movq 0x2a0(%rax), %rax
subss 0xc(%rax), %xmm0
movss %xmm0, -0xac(%rbp)
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movq %rax, -0x108(%rbp)
leaq -0xb4(%rbp), %rcx
leaq -0xa4(%rbp), %r8
movl -0x1c(%rbp), %r10d
movl -0x20(%rbp), %eax
movl $0x2, %r9d
cltd
idivl %r9d
movq -0x108(%rbp), %rdx
movq 0x30f0a(%rip), %r9      # 0x82768
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movl $0x8, 0x10(%rsp)
movl $0x20, 0x18(%rsp)
callq 0x192c0
movq -0x28(%rbp), %rax
movl 0xc8(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
jne 0x518a4
movq -0x28(%rbp), %rax
cmpq $0x0, 0x58(%rax)
jne 0x518a4
movl $0x0, -0x4(%rbp)
jmp 0x5199d
movq -0x10(%rbp), %rax
movq 0x2a0(%rax), %rdi
addq $0xe4, %rdi
movq -0x10(%rbp), %rax
movq 0x2a0(%rax), %rsi
addq $0xfc, %rsi
leaq -0x98(%rbp), %rdx
movss 0x21279(%rip), %xmm0    # 0x72b50
callq 0x199c0
movss -0x98(%rbp), %xmm0
subss -0xa4(%rbp), %xmm0
movss %xmm0, -0x98(%rbp)
movss -0x94(%rbp), %xmm0
subss -0xa0(%rbp), %xmm0
movss %xmm0, -0x94(%rbp)
movss -0x90(%rbp), %xmm0
subss -0x9c(%rbp), %xmm0
movss %xmm0, -0x90(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x183d0
movq -0x10(%rbp), %rax
movq 0x2a0(%rax), %rdi
addq $0x1c0, %rdi            # imm = 0x1C0
cvtsi2ssl -0x20(%rbp), %xmm0
leaq -0x98(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x2a0(%rax), %rdx
addq $0x1c0, %rdx            # imm = 0x1C0
callq 0x199c0
movq -0x10(%rbp), %rax
movq 0x2a0(%rax), %rax
movss 0x1c8(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x51996
movq -0x10(%rbp), %rax
movq 0x2a0(%rax), %rax
movq $0x0, 0x2b8(%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
nopl (%rax)