// File: /workspace/github_c_makefile_star2_O1/QwazyWabbitWOS[P]lmctf60/g_func.c
// Function: SP_func_button
void SP_func_button (edict_t *ent)
{
	vec3_t	abs_movedir;
	float	dist;

	G_SetMovedir (ent->s.angles, ent->movedir);
	ent->movetype = MOVETYPE_STOP;
	ent->solid = SOLID_BSP;
	gi.setmodel (ent, ent->model);

	if (ent->sounds != 1)
		ent->moveinfo.sound_start = gi.soundindex ("switches/butn2.wav");
	
	if (!ent->speed)
		ent->speed = 40;
	if (!ent->accel)
		ent->accel = ent->speed;
	if (!ent->decel)
		ent->decel = ent->speed;

	if (!ent->wait)
		ent->wait = 3;
	if (!st.lip)
		st.lip = 4;

	VectorCopy (ent->s.origin, ent->pos1);
	abs_movedir[0] = fabs(ent->movedir[0]);
	abs_movedir[1] = fabs(ent->movedir[1]);
	abs_movedir[2] = fabs(ent->movedir[2]);
	dist = abs_movedir[0] * ent->size[0] + abs_movedir[1] * ent->size[1] + abs_movedir[2] * ent->size[2] - st.lip;
	VectorMA (ent->pos1, dist, ent->movedir, ent->pos2);

	ent->use = button_use;
	ent->s.effects |= EF_ANIM01;

	if (ent->health)
	{
		ent->max_health = ent->health;
		ent->die = button_killed;
		ent->takedamage = DAMAGE_YES;
	}
	else if (! ent->targetname)
		ent->touch = button_touch;

	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);

	gi.linkentity (ent);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
addq $0x10, %rdi
leaq 0x19c(%rbx), %r14
movq %r14, %rsi
callq 0x19630
movl $0x3, %eax
movl %eax, 0x118(%rbx)
movl %eax, 0x108(%rbx)
movq 0x3bfa2(%rip), %rax     # 0x69600
movq 0x120(%rbx), %rsi
movq %rbx, %rdi
movq %rax, %r15
callq *0x58(%rax)
cmpl $0x1, 0x28c(%rbx)
je 0x2d688
leaq 0x295d9(%rip), %rdi     # 0x56c57
callq *0x48(%r15)
movl %eax, 0x368(%rbx)
movss 0x190(%rbx), %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm1
jne 0x2d6a4
jp 0x2d6a4
movl $0x42200000, 0x190(%rbx) # imm = 0x42200000
movss 0x194(%rbx), %xmm1
ucomiss %xmm0, %xmm1
jne 0x2d6c3
jp 0x2d6c3
movss 0x190(%rbx), %xmm0
movss %xmm0, 0x194(%rbx)
movss 0x198(%rbx), %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm1
jne 0x2d6e5
jp 0x2d6e5
movss 0x190(%rbx), %xmm1
movss %xmm1, 0x198(%rbx)
movss 0x2f8(%rbx), %xmm1
ucomiss %xmm0, %xmm1
jne 0x2d6fe
jp 0x2d6fe
movl $0x40400000, 0x2f8(%rbx) # imm = 0x40400000
movq 0x3bf63(%rip), %rax     # 0x69668
cmpl $0x0, 0x20(%rax)
jne 0x2d712
movl $0x4, 0x20(%rax)
movss 0x4(%rbx), %xmm0
movss %xmm0, 0x1a8(%rbx)
movq 0x8(%rbx), %rcx
movq %rcx, 0x1ac(%rbx)
movss 0x19c(%rbx), %xmm1
movaps 0x26807(%rip), %xmm2    # 0x53f40
andps %xmm2, %xmm1
movss 0x1a0(%rbx), %xmm3
andps %xmm2, %xmm3
movss 0x1a4(%rbx), %xmm0
andps %xmm2, %xmm0
mulss 0x100(%rbx), %xmm3
mulss 0xfc(%rbx), %xmm1
mulss 0x104(%rbx), %xmm0
leaq 0x1a8(%rbx), %rdi
xorps %xmm2, %xmm2
cvtsi2ssl 0x20(%rax), %xmm2
addss %xmm3, %xmm1
addss %xmm1, %xmm0
subss %xmm2, %xmm0
leaq 0x1b4(%rbx), %rdx
movq %r14, %rsi
callq 0x19770
movq 0x3bc65(%rip), %rax     # 0x69400
movq %rax, 0x228(%rbx)
orb $0x4, 0x41(%rbx)
movl 0x254(%rbx), %eax
testl %eax, %eax
je 0x2d7d0
movl %eax, 0x258(%rbx)
movq 0x3c293(%rip), %rax     # 0x69a50
movq %rax, 0x238(%rbx)
movl $0x1, 0x27c(%rbx)
jmp 0x2d7e8
cmpq $0x0, 0x158(%rbx)
jne 0x2d7e8
movq 0x3c5cf(%rip), %rax     # 0x69db0
movq %rax, 0x220(%rbx)
movl $0x1, 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)
movq %rbx, %rdi
movq %r15, %rax
popq %rbx
popq %r14
popq %r15
jmpq *0x90(%rax)