// File: /workspace/github_c_makefile_star2_O0/QwazyWabbitWOS[P]lmctf60/g_misc.c
// Function: teleporter_touch
void teleporter_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf)
{
	edict_t		*dest;
	int			i;

	if (!other->client)
		return;
	dest = G_Find (NULL, FOFS(targetname), self->target);
	if (!dest)
	{
		gi.dprintf ("Couldn't find destination\n");
		return;
	}

	// unlink to make sure it can't possibly interfere with KillBox
	gi.unlinkentity (other);

	VectorCopy (dest->s.origin, other->s.origin);
	VectorCopy (dest->s.origin, other->s.old_origin);
	other->s.origin[2] += 10;

	// clear the velocity and hold them in place briefly
	VectorClear (other->velocity);
	other->client->ps.pmove.pm_time = 160>>3;		// hold time
	other->client->ps.pmove.pm_flags |= PMF_TIME_TELEPORT;

	// draw the teleport splash at source and on the player
	self->owner->s.event = EV_PLAYER_TELEPORT;
	other->s.event = EV_PLAYER_TELEPORT;

	// set angles
	for (i=0 ; i<3 ; i++)
	{
		other->client->ps.pmove.delta_angles[i] = ANGLE2SHORT(dest->s.angles[i] - other->client->resp.cmd_angles[i]);
	}

	VectorClear (other->s.angles);
	VectorClear (other->client->ps.viewangles);
	VectorClear (other->client->v_angle);

	// kill anything at the destination
	KillBox (other);

	gi.linkentity (other);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x58(%rax)
jne 0x455d8
jmp 0x45832
movq -0x8(%rbp), %rax
movq 0x150(%rax), %rdx
xorl %eax, %eax
movl %eax, %edi
movq %rdi, %rax
addq $0x158, %rax            # imm = 0x158
movl %eax, %esi
callq 0x19660
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x4561a
leaq 0x2f062(%rip), %rdi     # 0x7466b
movq 0x3cff0(%rip), %rcx     # 0x82600
movb $0x0, %al
callq *0x8(%rcx)
jmp 0x45832
movq 0x3cfdf(%rip), %rax     # 0x82600
movq 0x98(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
movq -0x28(%rbp), %rax
movss 0x4(%rax), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x4(%rax)
movq -0x28(%rbp), %rax
movss 0x8(%rax), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x8(%rax)
movq -0x28(%rbp), %rax
movss 0xc(%rax), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0xc(%rax)
movq -0x28(%rbp), %rax
movss 0x4(%rax), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x1c(%rax)
movq -0x28(%rbp), %rax
movss 0x8(%rax), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x20(%rax)
movq -0x28(%rbp), %rax
movss 0xc(%rax), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x24(%rax)
movq -0x10(%rbp), %rax
movss 0x2a84a(%rip), %xmm0    # 0x6fef0
addss 0xc(%rax), %xmm0
movss %xmm0, 0xc(%rax)
movq -0x10(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x1c8(%rax)
movq -0x10(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x1c4(%rax)
movq -0x10(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x1c0(%rax)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movb $0x14, 0x11(%rax)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movzbl 0x10(%rax), %ecx
orl $0x20, %ecx
movb %cl, 0x10(%rax)
movq -0x8(%rbp), %rax
movq 0x110(%rax), %rax
movl $0x6, 0x50(%rax)
movq -0x10(%rbp), %rax
movl $0x6, 0x50(%rax)
movl $0x0, -0x2c(%rbp)
cmpl $0x3, -0x2c(%rbp)
jge 0x45788
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movss 0x10(%rax,%rcx,4), %xmm0
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movslq -0x2c(%rbp), %rcx
subss 0xdf8(%rax,%rcx,4), %xmm0
movss 0x2b5d8(%rip), %xmm1    # 0x70d28
mulss %xmm1, %xmm0
movss 0x2b5c8(%rip), %xmm1    # 0x70d24
divss %xmm1, %xmm0
cvttss2si %xmm0, %eax
andl $0xffff, %eax           # imm = 0xFFFF
movw %ax, %dx
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movslq -0x2c(%rbp), %rcx
movw %dx, 0x14(%rax,%rcx,2)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x4571f
movq -0x10(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x18(%rax)
movq -0x10(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x14(%rax)
movq -0x10(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x24(%rax)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x20(%rax)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x1c(%rax)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0xec4(%rax)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0xec0(%rax)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0xebc(%rax)
movq -0x10(%rbp), %rdi
callq 0x18b60
movq 0x3cddb(%rip), %rax     # 0x82600
movq 0x90(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)