// File: /workspace/github_c_makefile_star2_O1/QwazyWabbitWOS[P]lmctf60/g_func.c
// Function: SP_func_plat
void SP_func_plat (edict_t *ent)
{
	VectorClear (ent->s.angles);
	ent->solid = SOLID_BSP;
	ent->movetype = MOVETYPE_PUSH;

	gi.setmodel (ent, ent->model);

	ent->blocked = plat_blocked;

	if (!ent->speed)
		ent->speed = 20;
	else
		ent->speed *= 0.1f;

	if (!ent->accel)
		ent->accel = 5;
	else
		ent->accel *= 0.1f;

	if (!ent->decel)
		ent->decel = 5;
	else
		ent->decel *= 0.1f;

	if (!ent->dmg)
		ent->dmg = 2;

	if (!st.lip)
		st.lip = 8;

	// pos1 is the top position, pos2 is the bottom
	VectorCopy (ent->s.origin, ent->pos1);
	VectorCopy (ent->s.origin, ent->pos2);
	if (st.height)
		ent->pos2[2] -= st.height;
	else
		ent->pos2[2] -= (ent->maxs[2] - ent->mins[2]) - st.lip;

	ent->use = Use_Plat;

	plat_spawn_inside_trigger (ent);	// the "start moving" trigger	

	if (ent->targetname)
	{
		ent->moveinfo.state = STATE_UP;
	}
	else
	{
		VectorCopy (ent->pos2, ent->s.origin);
		gi.linkentity (ent);
		ent->moveinfo.state = STATE_BOTTOM;
	}

	ent->moveinfo.speed = ent->speed;
	ent->moveinfo.accel = ent->accel;
	ent->moveinfo.decel = ent->decel;
	ent->moveinfo.wait = ent->wait;
	VectorCopy (ent->pos1, ent->moveinfo.start_origin);
	VectorCopy (ent->s.angles, ent->moveinfo.start_angles);
	VectorCopy (ent->pos2, ent->moveinfo.end_origin);
	VectorCopy (ent->s.angles, ent->moveinfo.end_angles);

	ent->moveinfo.sound_start = gi.soundindex ("plats/pt1_strt.wav");
	ent->moveinfo.sound_middle = gi.soundindex ("plats/pt1_mid.wav");
	ent->moveinfo.sound_end = gi.soundindex ("plats/pt1_end.wav");
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x0, 0x18(%rdi)
movq $0x0, 0x10(%rdi)
movl $0x3, 0x108(%rdi)
movl $0x2, 0x118(%rdi)
movq 0x3c61b(%rip), %r14     # 0x69600
movq 0x120(%rdi), %rsi
callq *0x58(%r14)
movq 0x3c6d1(%rip), %rax     # 0x696c8
movq %rax, 0x218(%rbx)
movss 0x190(%rbx), %xmm1
movss 0x194(%rbx), %xmm2
movss 0x2727a(%rip), %xmm0    # 0x54290
movaps %xmm1, %xmm3
mulss %xmm0, %xmm3
xorps %xmm4, %xmm4
cmpneqss %xmm4, %xmm1
andps %xmm1, %xmm3
movss 0x27be0(%rip), %xmm5    # 0x54c10
andnps %xmm5, %xmm1
orps %xmm3, %xmm1
movss %xmm1, 0x190(%rbx)
movaps %xmm2, %xmm1
mulss %xmm0, %xmm1
cmpneqss %xmm4, %xmm2
andps %xmm2, %xmm1
movss 0x26eaf(%rip), %xmm3    # 0x53f04
andnps %xmm3, %xmm2
orps %xmm1, %xmm2
movss %xmm2, 0x194(%rbx)
movss 0x198(%rbx), %xmm1
mulss %xmm1, %xmm0
cmpneqss %xmm4, %xmm1
andps %xmm1, %xmm0
andnps %xmm3, %xmm1
orps %xmm0, %xmm1
movss %xmm1, 0x198(%rbx)
cmpl $0x0, 0x280(%rbx)
jne 0x2d098
movl $0x2, 0x280(%rbx)
movq 0x3c5c9(%rip), %rax     # 0x69668
cmpl $0x0, 0x20(%rax)
jne 0x2d0ac
movl $0x8, 0x20(%rax)
movss 0x4(%rbx), %xmm1
movss 0x8(%rbx), %xmm2
movss %xmm1, 0x1a8(%rbx)
movss %xmm2, 0x1ac(%rbx)
movss 0xc(%rbx), %xmm0
movss %xmm0, 0x1b0(%rbx)
movss %xmm1, 0x1b4(%rbx)
movss %xmm2, 0x1b8(%rbx)
movss %xmm0, 0x1bc(%rbx)
movl 0x28(%rax), %ecx
testl %ecx, %ecx
je 0x2d0fb
xorps %xmm1, %xmm1
cvtsi2ss %ecx, %xmm1
jmp 0x2d117
movss 0xe0(%rbx), %xmm1
subss 0xd4(%rbx), %xmm1
xorps %xmm2, %xmm2
cvtsi2ssl 0x20(%rax), %xmm2
subss %xmm2, %xmm1
subss %xmm1, %xmm0
movss %xmm0, 0x1bc(%rbx)
movq 0x3cb1e(%rip), %rax     # 0x69c48
movq %rax, 0x228(%rbx)
movq %rbx, %rdi
callq 0x187e0
movl $0x2, %eax
cmpq $0x0, 0x158(%rbx)
jne 0x2d16f
movss 0x1b4(%rbx), %xmm0
movss %xmm0, 0x4(%rbx)
movq 0x1b8(%rbx), %rax
movq %rax, 0x8(%rbx)
movq %rbx, %rdi
callq *0x90(%r14)
movl $0x1, %eax
movl %eax, 0x388(%rbx)
movss 0x190(%rbx), %xmm0
movss %xmm0, 0x378(%rbx)
movss 0x194(%rbx), %xmm0
movss %xmm0, 0x374(%rbx)
movss 0x198(%rbx), %xmm0
movss %xmm0, 0x37c(%rbx)
movss 0x2f8(%rbx), %xmm0
movss %xmm0, 0x384(%rbx)
movss 0x1a8(%rbx), %xmm0
movss %xmm0, 0x338(%rbx)
movq 0x1ac(%rbx), %rax
movq %rax, 0x33c(%rbx)
movss 0x10(%rbx), %xmm0
movss 0x14(%rbx), %xmm1
movss %xmm0, 0x344(%rbx)
movss %xmm1, 0x348(%rbx)
movss 0x18(%rbx), %xmm2
movss %xmm2, 0x34c(%rbx)
movss 0x1b4(%rbx), %xmm3
movss %xmm3, 0x350(%rbx)
movq 0x1b8(%rbx), %rax
movq %rax, 0x354(%rbx)
movss %xmm0, 0x35c(%rbx)
movss %xmm1, 0x360(%rbx)
movss %xmm2, 0x364(%rbx)
leaq 0x299e9(%rip), %rdi     # 0x56c20
callq *0x48(%r14)
movl %eax, 0x368(%rbx)
leaq 0x299eb(%rip), %rdi     # 0x56c33
callq *0x48(%r14)
movl %eax, 0x36c(%rbx)
leaq 0x299ec(%rip), %rdi     # 0x56c45
callq *0x48(%r14)
movl %eax, 0x370(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq