// File: /workspace/github_c_makefile_star2_O1/QwazyWabbitWOS[P]lmctf60/g_func.c
// Function: SP_func_door_rotating
void SP_func_door_rotating (edict_t *ent)
{
	VectorClear (ent->s.angles);

	// set the axis of rotation
	VectorClear(ent->movedir);
	if (ent->spawnflags & DOOR_X_AXIS)
		ent->movedir[2] = 1.0;
	else if (ent->spawnflags & DOOR_Y_AXIS)
		ent->movedir[0] = 1.0;
	else // Z_AXIS
		ent->movedir[1] = 1.0;

	// check for reverse rotation
	if (ent->spawnflags & DOOR_REVERSE)
		VectorNegate (ent->movedir, ent->movedir);

	if (!st.distance)
	{
		gi.dprintf("%s at %s with no distance set\n", ent->classname, vtos(ent->s.origin));
		st.distance = 90;
	}

	VectorCopy (ent->s.angles, ent->pos1);
	VectorMA (ent->s.angles, st.distance, ent->movedir, ent->pos2);
	ent->moveinfo.distance = st.distance;

	ent->movetype = MOVETYPE_PUSH;
	ent->solid = SOLID_BSP;
	gi.setmodel (ent, ent->model);

	ent->blocked = door_blocked;
	ent->use = door_use;

	if (!ent->speed)
		ent->speed = 100;
	if (!ent->accel)
		ent->accel = ent->speed;
	if (!ent->decel)
		ent->decel = ent->speed;

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

	if (ent->sounds != 1)
	{
		ent->moveinfo.sound_start = gi.soundindex  ("doors/dr1_strt.wav");
		ent->moveinfo.sound_middle = gi.soundindex  ("doors/dr1_mid.wav");
		ent->moveinfo.sound_end = gi.soundindex  ("doors/dr1_end.wav");
	}

	// if it starts open, switch the positions
	if (ent->spawnflags & DOOR_START_OPEN)
	{
		VectorCopy (ent->pos2, ent->s.angles);
		VectorCopy (ent->pos1, ent->pos2);
		VectorCopy (ent->s.angles, ent->pos1);
		VectorNegate (ent->movedir, ent->movedir);
	}

	if (ent->health)
	{
		ent->takedamage = DAMAGE_YES;
		ent->die = door_killed;
		ent->max_health = ent->health;
	}
	
	if (ent->targetname && ent->message)
	{
		gi.soundindex ("misc/talk.wav");
		ent->touch = door_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->s.origin, ent->moveinfo.start_origin);
	VectorCopy (ent->pos1, ent->moveinfo.start_angles);
	VectorCopy (ent->s.origin, ent->moveinfo.end_origin);
	VectorCopy (ent->pos2, ent->moveinfo.end_angles);

	if (ent->spawnflags & 16)
		ent->s.effects |= EF_ANIM_ALL;

	// to simplify logic elsewhere, make non-teamed doors into a team of one
	if (!ent->team)
		ent->teammaster = ent;

	gi.linkentity (ent);

	ent->nextthink = level.time + FRAMETIME;
	if (ent->health || ent->targetname)
		ent->think = Think_CalcMoveSpeed;
	else
		ent->think = Think_SpawnDoorTrigger;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %eax, %eax
movl %eax, 0x18(%rdi)
movq %rax, 0x10(%rdi)
movl $0x19c, %r14d           # imm = 0x19C
movl %eax, 0x1a4(%rdi)
movq %rax, 0x19c(%rdi)
movl 0x140(%rdi), %eax
xorl %ecx, %ecx
testb %al, %al
setns %cl
shll $0x2, %ecx
addq %r14, %rcx
testb $0x40, %al
movl $0x1a4, %edx            # imm = 0x1A4
cmoveq %rcx, %rdx
movl $0x3f800000, (%rdi,%rdx) # imm = 0x3F800000
testb $0x2, %al
je 0x2e5d2
movaps 0x28677(%rip), %xmm0    # 0x56c10
movss 0x19c(%rbx), %xmm1
movss 0x1a0(%rbx), %xmm2
movss 0x1a4(%rbx), %xmm3
xorps %xmm0, %xmm1
movss %xmm1, 0x19c(%rbx)
xorps %xmm0, %xmm2
movss %xmm2, 0x1a0(%rbx)
xorps %xmm0, %xmm3
movss %xmm3, 0x1a4(%rbx)
leaq 0x10(%rbx), %r15
addq %rbx, %r14
movq 0x3b088(%rip), %r13     # 0x69668
cmpl $0x0, 0x24(%r13)
jne 0x2e61b
movq 0x3b012(%rip), %rax     # 0x69600
movq 0x8(%rax), %rbp
movq 0x138(%rbx), %r12
leaq 0x4(%rbx), %rdi
callq 0x190a0
leaq 0x286e2(%rip), %rdi     # 0x56ceb
movq %r12, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq *%rbp
movl $0x5a, 0x24(%r13)
movss 0x10(%rbx), %xmm0
movss %xmm0, 0x1a8(%rbx)
movq 0x14(%rbx), %rax
movq %rax, 0x1ac(%rbx)
xorps %xmm0, %xmm0
cvtsi2ssl 0x24(%r13), %xmm0
leaq 0x1b4(%rbx), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x19770
xorps %xmm0, %xmm0
cvtsi2ssl 0x24(%r13), %xmm0
movss %xmm0, 0x380(%rbx)
movl $0x2, 0x118(%rbx)
movl $0x3, 0x108(%rbx)
movq 0x3af86(%rip), %r14     # 0x69600
movq 0x120(%rbx), %rsi
movq %rbx, %rdi
callq *0x58(%r14)
movq 0x3ade1(%rip), %rax     # 0x69470
movq %rax, 0x218(%rbx)
movq 0x3b323(%rip), %rax     # 0x699c0
movq %rax, 0x228(%rbx)
movss 0x190(%rbx), %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm1
jne 0x2e6c0
jp 0x2e6c0
movl $0x42c80000, 0x190(%rbx) # imm = 0x42C80000
movss 0x194(%rbx), %xmm1
ucomiss %xmm0, %xmm1
jne 0x2e6df
jp 0x2e6df
movss 0x190(%rbx), %xmm0
movss %xmm0, 0x194(%rbx)
movss 0x198(%rbx), %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm1
jne 0x2e701
jp 0x2e701
movss 0x190(%rbx), %xmm1
movss %xmm1, 0x198(%rbx)
movss 0x2f8(%rbx), %xmm1
ucomiss %xmm0, %xmm1
jne 0x2e71a
jp 0x2e71a
movl $0x40400000, 0x2f8(%rbx) # imm = 0x40400000
cmpl $0x0, 0x280(%rbx)
jne 0x2e72d
movl $0x2, 0x280(%rbx)
cmpl $0x1, 0x28c(%rbx)
je 0x2e769
leaq 0x28569(%rip), %rdi     # 0x56ca6
callq *0x48(%r14)
movl %eax, 0x368(%rbx)
leaq 0x2856b(%rip), %rdi     # 0x56cb9
callq *0x48(%r14)
movl %eax, 0x36c(%rbx)
leaq 0x2856c(%rip), %rdi     # 0x56ccb
callq *0x48(%r14)
movl %eax, 0x370(%rbx)
testb $0x1, 0x140(%rbx)
je 0x2e813
movss 0x1b4(%rbx), %xmm0
movss %xmm0, 0x10(%rbx)
movss 0x1b8(%rbx), %xmm1
movss %xmm1, 0x14(%rbx)
movss 0x1bc(%rbx), %xmm2
movss %xmm2, 0x18(%rbx)
movq 0x1a8(%rbx), %rax
movq %rax, 0x1b4(%rbx)
movss 0x1b0(%rbx), %xmm3
movss %xmm3, 0x1bc(%rbx)
movss %xmm0, 0x1a8(%rbx)
movss %xmm1, 0x1ac(%rbx)
movss %xmm2, 0x1b0(%rbx)
movss 0x19c(%rbx), %xmm0
movss 0x1a0(%rbx), %xmm1
movaps 0x28426(%rip), %xmm2    # 0x56c10
xorps %xmm2, %xmm0
movss %xmm0, 0x19c(%rbx)
xorps %xmm2, %xmm1
movss %xmm1, 0x1a0(%rbx)
movss 0x1a4(%rbx), %xmm0
xorps %xmm2, %xmm0
movss %xmm0, 0x1a4(%rbx)
movl 0x254(%rbx), %eax
testl %eax, %eax
je 0x2e83b
movl $0x1, 0x27c(%rbx)
movq 0x3abaa(%rip), %rcx     # 0x693d8
movq %rcx, 0x238(%rbx)
movl %eax, 0x258(%rbx)
cmpq $0x0, 0x158(%rbx)
je 0x2e868
cmpq $0x0, 0x130(%rbx)
je 0x2e868
leaq 0x28487(%rip), %rdi     # 0x56cdd
callq *0x48(%r14)
movq 0x3b707(%rip), %rax     # 0x69f68
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 0x4(%rbx), %xmm0
movss 0x8(%rbx), %xmm1
movss %xmm0, 0x338(%rbx)
movss %xmm1, 0x33c(%rbx)
movss 0xc(%rbx), %xmm2
movss %xmm2, 0x340(%rbx)
movq 0x1a8(%rbx), %rax
movq %rax, 0x344(%rbx)
movss 0x1b0(%rbx), %xmm3
movss %xmm3, 0x34c(%rbx)
movss %xmm0, 0x350(%rbx)
movss %xmm1, 0x354(%rbx)
movss %xmm2, 0x358(%rbx)
movss 0x1b4(%rbx), %xmm0
movss %xmm0, 0x35c(%rbx)
movq 0x1b8(%rbx), %rax
movq %rax, 0x360(%rbx)
testb $0x10, 0x140(%rbx)
je 0x2e93a
orb $0x10, 0x41(%rbx)
cmpq $0x0, 0x168(%rbx)
jne 0x2e94b
movq %rbx, 0x2d0(%rbx)
movq %rbx, %rdi
callq *0x90(%r14)
movq 0x3b444(%rip), %rax     # 0x69da0
movss 0x4(%rax), %xmm0
addss 0x25927(%rip), %xmm0    # 0x54290
movss %xmm0, 0x200(%rbx)
cmpl $0x0, 0x254(%rbx)
jne 0x2e98d
cmpq $0x0, 0x158(%rbx)
jne 0x2e98d
movq 0x3b1ad(%rip), %rax     # 0x69b38
jmp 0x2e994
movq 0x3b47c(%rip), %rax     # 0x69e10
movq %rax, 0x210(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq