// File: /workspace/github_c_makefile_star2_O3/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 0x3b95b(%rip), %r14     # 0x68600
movq 0x120(%rdi), %rsi
callq *0x58(%r14)
movq 0x3ba11(%rip), %rax     # 0x686c8
movq %rax, 0x218(%rbx)
movsd 0x190(%rbx), %xmm0
xorps %xmm1, %xmm1
cmpneqps %xmm0, %xmm1
mulps 0x28fcc(%rip), %xmm0    # 0x55ca0
andps %xmm1, %xmm0
andnps 0x28fd2(%rip), %xmm1    # 0x55cb0
orps %xmm0, %xmm1
movlps %xmm1, 0x190(%rbx)
movss 0x198(%rbx), %xmm0
movss 0x26598(%rip), %xmm1    # 0x53290
mulss %xmm0, %xmm1
xorps %xmm2, %xmm2
cmpneqss %xmm0, %xmm2
andps %xmm2, %xmm1
movss 0x261f9(%rip), %xmm0    # 0x52f08
andnps %xmm0, %xmm2
orps %xmm1, %xmm2
movss %xmm2, 0x198(%rbx)
cmpl $0x0, 0x280(%rbx)
jne 0x2cd30
movl $0x2, 0x280(%rbx)
movq 0x3b931(%rip), %rcx     # 0x68668
movl 0x20(%rcx), %eax
testl %eax, %eax
jne 0x2cd4a
movl $0x8, 0x20(%rcx)
movl $0x8, %eax
movsd 0x8(%rbx), %xmm0
movss 0x4(%rbx), %xmm1
shufps $0x40, %xmm0, %xmm1     # xmm1 = xmm1[0,0],xmm0[0,1]
shufps $0x78, %xmm1, %xmm1     # xmm1 = xmm1[0,2,3,1]
movups %xmm1, 0x1a8(%rbx)
movss %xmm0, 0x1b8(%rbx)
movl 0x28(%rcx), %ecx
testl %ecx, %ecx
je 0x2cd7b
xorps %xmm1, %xmm1
cvtsi2ss %ecx, %xmm1
jmp 0x2cd96
movss 0xe0(%rbx), %xmm1
subss 0xd4(%rbx), %xmm1
xorps %xmm2, %xmm2
cvtsi2ss %eax, %xmm2
subss %xmm2, %xmm1
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
subss %xmm1, %xmm0
movss %xmm0, 0x1bc(%rbx)
movq 0x3be9b(%rip), %rax     # 0x68c48
movq %rax, 0x228(%rbx)
movq %rbx, %rdi
callq 0x187e0
movl $0x2, %eax
cmpq $0x0, 0x158(%rbx)
jne 0x2cdf4
movsd 0x1b4(%rbx), %xmm0
movsd %xmm0, 0x4(%rbx)
movss 0x1bc(%rbx), %xmm0
movss %xmm0, 0xc(%rbx)
movq %rbx, %rdi
callq *0x90(%r14)
movl $0x1, %eax
movl %eax, 0x388(%rbx)
movsd 0x190(%rbx), %xmm0
shufps $0xe1, %xmm0, %xmm0     # xmm0 = xmm0[1,0,2,3]
movlps %xmm0, 0x374(%rbx)
movss 0x198(%rbx), %xmm0
movss %xmm0, 0x37c(%rbx)
movss 0x2f8(%rbx), %xmm0
movss %xmm0, 0x384(%rbx)
movsd 0x1ac(%rbx), %xmm0
movss 0x1a8(%rbx), %xmm1
movlhps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movss 0x10(%rbx), %xmm2
movaps %xmm2, %xmm3
shufps $0xd4, %xmm0, %xmm3     # xmm3 = xmm3[0,1],xmm0[1,3]
shufps $0x28, %xmm3, %xmm1     # xmm1 = xmm1[0,2],xmm3[2,0]
movups %xmm1, 0x338(%rbx)
movsd 0x14(%rbx), %xmm0
movaps %xmm0, %xmm1
movhps 0x1b4(%rbx), %xmm1      # xmm1 = xmm1[0,1],mem[0,1]
movups %xmm1, 0x348(%rbx)
movss 0x1bc(%rbx), %xmm1
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movlhps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movups %xmm1, 0x358(%rbx)
leaq 0x28e8f(%rip), %rdi     # 0x55d18
callq *0x48(%r14)
movl %eax, 0x368(%rbx)
leaq 0x28e91(%rip), %rdi     # 0x55d2b
callq *0x48(%r14)
movl %eax, 0x36c(%rbx)
leaq 0x28e92(%rip), %rdi     # 0x55d3d
callq *0x48(%r14)
movl %eax, 0x370(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq