// File: /workspace/github_c_makefile_star2_O2/QwazyWabbitWOS[P]lmctf60/g_weapon.c
// Function: rocket_touch
void rocket_touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf)
{
	vec3_t		origin;
	int			n;

	if (other == ent->owner)
		return;

	if (surf && (surf->flags & SURF_SKY))
	{
		G_FreeEdict (ent);
		return;
	}

	if (ent->owner->client)
		PlayerNoise(ent->owner, ent->s.origin, PNOISE_IMPACT);

	// calculate position for the explosion entity
	VectorMA (ent->s.origin, -0.02f, ent->velocity, origin);

	if (other->takedamage)
	{
		T_Damage (other, ent, ent->owner, ent->velocity, ent->s.origin, plane->normal, ent->dmg, 0, 0, MOD_ROCKET);
	}
	else
	{
		// don't throw any debris in net games
		if (!deathmatch->value && !coop->value)
		{
			if ((surf) && !(surf->flags & (SURF_WARP|SURF_TRANS33|SURF_TRANS66|SURF_FLOWING)))
			{
				n = rand() % 5;
				while(n--)
					ThrowDebris (ent, "models/objects/debris2/tris.md2", 2, ent->s.origin);
			}
		}
	}

	T_RadiusDamage(ent, ent->owner, ent->radius_dmg, other, ent->dmg_radius, MOD_R_SPLASH);

	gi.WriteByte (svc_temp_entity);
	if (ent->waterlevel)
		gi.WriteByte (TE_ROCKET_EXPLOSION_WATER);
	else
		gi.WriteByte (TE_ROCKET_EXPLOSION);
	gi.WritePosition (origin);
	gi.multicast (ent->s.origin, MULTICAST_PHS);

	G_FreeEdict (ent);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x110(%rdi), %rdi
cmpq %rsi, %rdi
je 0x3cf15
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, %r14
testq %rcx, %rcx
je 0x3ce0a
testb $0x4, 0x10(%r12)
jne 0x3ce78
cmpq $0x0, 0x58(%rdi)
je 0x3ce1d
leaq 0x4(%rbx), %rsi
pushq $0x2
popq %rdx
callq 0x19010
leaq 0x4(%rbx), %r15
leaq 0x1c0(%rbx), %rbp
movss 0x18720(%rip), %xmm0    # 0x55550
leaq 0xc(%rsp), %rdx
movq %r15, %rdi
movq %rbp, %rsi
callq 0x19940
cmpl $0x0, 0x27c(%r14)
je 0x3ce8e
movq 0x110(%rbx), %rdx
movl 0x280(%rbx), %eax
movq %r14, %rdi
movq %rbx, %rsi
movq %rbp, %rcx
movq %r15, %r8
movq %r13, %r9
pushq $0x8
pushq $0x0
pushq $0x0
pushq %rax
callq 0x19260
addq $0x20, %rsp
jmp 0x3cea7
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x19c50
movq 0x2a02b(%rip), %rax     # 0x66ec0
movq (%rax), %rax
movss 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x3cea7
jnp 0x3cf24
movq 0x110(%rbx), %rsi
cvtsi2ssl 0x284(%rbx), %xmm0
movss 0x288(%rbx), %xmm1
pushq $0x9
popq %rcx
movq %rbx, %rdi
movq %r14, %rdx
callq 0x180c0
movq 0x2972d(%rip), %r14     # 0x66600
pushq $0x3
popq %rdi
callq *0xc8(%r14)
cmpl $0x0, 0x30c(%rbx)
pushq $0x7
popq %rax
pushq $0x11
popq %rdi
cmovel %eax, %edi
callq *0xc8(%r14)
leaq 0xc(%rsp), %rdi
callq *0xf0(%r14)
pushq $0x1
popq %rsi
movq %r15, %rdi
callq *0xb0(%r14)
movq %rbx, %rdi
callq 0x19c50
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %r12, %r12
je 0x3cea7
movq 0x2a02c(%rip), %rax     # 0x66f60
movq (%rax), %rax
movss 0x20(%rax), %xmm0
ucomiss %xmm1, %xmm0
jne 0x3cea7
jp 0x3cea7
testb $0x78, 0x10(%r12)
jne 0x3cea7
callq 0x19bf0
pushq $0x5
popq %rcx
cltd
idivl %ecx
movl %edx, %ebp
leaq 0x15836(%rip), %r12     # 0x527a1
subl $0x1, %ebp
jb 0x3cea7
movq %rbx, %rdi
movq %r12, %rsi
movss 0x124ea(%rip), %xmm0    # 0x4f46c
movq %r15, %rdx
callq 0x186e0
jmp 0x3cf6b