// File: /workspace/github_c_makefile_star2_O3/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 0x404d0
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, %r14
testq %rcx, %rcx
je 0x403af
testb $0x4, 0x10(%r12)
jne 0x40422
cmpq $0x0, 0x58(%rdi)
je 0x403c4
leaq 0x4(%rbx), %rsi
movl $0x2, %edx
callq 0x18ef0
leaq 0x4(%rbx), %r15
leaq 0x1c0(%rbx), %rbp
movss 0x19199(%rip), %xmm0    # 0x59570
leaq 0xc(%rsp), %rdx
movq %r15, %rdi
movq %rbp, %rsi
callq 0x19760
cmpl $0x0, 0x27c(%r14)
je 0x40438
movq 0x110(%rbx), %rdx
movl 0x280(%rbx), %eax
xorl %r10d, %r10d
movq %r14, %rdi
movq %rbx, %rsi
movq %rbp, %rcx
movq %r15, %r8
movq %r13, %r9
pushq $0x8
pushq %r10
pushq %r10
pushq %rax
callq 0x190f0
addq $0x20, %rsp
jmp 0x40455
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x19a50
movq 0x28a81(%rip), %rax     # 0x68ec0
movq (%rax), %rax
movss 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x40455
jnp 0x404df
movq 0x110(%rbx), %rsi
xorps %xmm0, %xmm0
cvtsi2ssl 0x284(%rbx), %xmm0
movss 0x288(%rbx), %xmm1
movq %rbx, %rdi
movq %r14, %rdx
movl $0x9, %ecx
callq 0x180c0
movq 0x2817a(%rip), %r14     # 0x68600
movl $0x3, %edi
callq *0xc8(%r14)
cmpl $0x0, 0x30c(%rbx)
movl $0x7, %eax
movl $0x11, %edi
cmovel %eax, %edi
callq *0xc8(%r14)
leaq 0xc(%rsp), %rdi
callq *0xf0(%r14)
movq %r15, %rdi
movl $0x1, %esi
callq *0xb0(%r14)
movq %rbx, %rdi
callq 0x19a50
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %r12, %r12
je 0x40455
movq 0x28a71(%rip), %rax     # 0x68f60
movq (%rax), %rax
movss 0x20(%rax), %xmm0
ucomiss %xmm1, %xmm0
jne 0x40455
jp 0x40455
testb $0x78, 0x10(%r12)
jne 0x40455
callq 0x19a10
movslq %eax, %r13
imulq $0x66666667, %r13, %rax # imm = 0x66666667
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x21, %rax
addl %ecx, %eax
leal (%rax,%rax,4), %eax
subl %eax, %r13d
je 0x40455
leaq 0x16280(%rip), %r12     # 0x567c1
movq %rbx, %rdi
movq %r12, %rsi
movss 0x12f1d(%rip), %xmm0    # 0x5346c
movq %r15, %rdx
callq 0x186a0
decl %r13d
jne 0x40541
jmp 0x40455