// File: /workspace/github_c_makefile_star2_O2/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
andl $0x0, 0x18(%rdi)
andq $0x0, 0x10(%rdi)
andl $0x0, 0x1a4(%rdi)
andq $0x0, 0x19c(%rdi)
leaq 0x19c(%rdi), %r14
leaq 0x1a4(%rdi), %rax
movl 0x140(%rdi), %ecx
testb $0x40, %cl
jne 0x2baff
leaq 0x1a0(%rbx), %rdx
xorl %esi, %esi
testb %cl, %cl
cmovsq %r14, %rdx
setns %sil
movd %esi, %xmm0
pshufd $0x50, %xmm0, %xmm0     # xmm0 = xmm0[0,0,1,1]
pslld $0x1f, %xmm0
psrad $0x1f, %xmm0
movd 0x23443(%rip), %xmm1    # 0x4ef28
movdqa %xmm0, %xmm2
pandn %xmm1, %xmm2
pand 0x261ab(%rip), %xmm0    # 0x51ca0
por %xmm2, %xmm0
pxor %xmm1, %xmm1
jmp 0x2bb0e
pxor %xmm0, %xmm0
movd 0x2341d(%rip), %xmm1    # 0x4ef28
movq %rax, %rdx
movl $0x3f800000, (%rdx)     # imm = 0x3F800000
testb $0x2, %cl
je 0x2bb32
movdqa 0x2618f(%rip), %xmm2    # 0x51cb0
pxor %xmm2, %xmm0
movq %xmm0, (%r14)
pxor %xmm2, %xmm1
movd %xmm1, (%rax)
leaq 0x10(%rbx), %r15
movq 0x3ab2b(%rip), %r13     # 0x66668
movl 0x24(%r13), %eax
pxor %xmm0, %xmm0
pxor %xmm1, %xmm1
testl %eax, %eax
jne 0x2bb8e
movq 0x3aaac(%rip), %rax     # 0x66600
movq 0x8(%rax), %rbp
movq 0x138(%rbx), %r12
leaq 0x4(%rbx), %rdi
callq 0x19200
leaq 0x26254(%rip), %rdi     # 0x51dc3
movq %r12, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq *%rbp
movl $0x5a, 0x24(%r13)
movq 0x10(%rbx), %xmm0
movd 0x18(%rbx), %xmm1
pushq $0x5a
popq %rax
movq %xmm0, 0x1a8(%rbx)
movd %xmm1, 0x1b0(%rbx)
cvtsi2ss %eax, %xmm0
leaq 0x1b4(%rbx), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x19940
cvtsi2ssl 0x24(%r13), %xmm0
movss %xmm0, 0x380(%rbx)
movl $0x2, 0x118(%rbx)
movl $0x3, 0x108(%rbx)
movq 0x3aa23(%rip), %r14     # 0x66600
movq 0x120(%rbx), %rsi
movq %rbx, %rdi
callq *0x58(%r14)
movq 0x3a87e(%rip), %rax     # 0x66470
movq %rax, 0x218(%rbx)
movq 0x3adc0(%rip), %rax     # 0x669c0
movq %rax, 0x228(%rbx)
movss 0x190(%rbx), %xmm0
ucomiss 0x23d7a(%rip), %xmm0    # 0x4f990
jne 0x2bc2c
jp 0x2bc2c
movl $0x42c80000, 0x190(%rbx) # imm = 0x42C80000
movss 0x26000(%rip), %xmm0    # 0x51c2c
movss 0x194(%rbx), %xmm2
pxor %xmm1, %xmm1
ucomiss %xmm1, %xmm2
jne 0x2bc47
jp 0x2bc47
movss %xmm0, 0x194(%rbx)
movss 0x198(%rbx), %xmm2
ucomiss %xmm1, %xmm2
jne 0x2bc5e
jp 0x2bc5e
movss %xmm0, 0x198(%rbx)
movss 0x2f8(%rbx), %xmm0
ucomiss %xmm1, %xmm0
jne 0x2bc77
jp 0x2bc77
movl $0x40400000, 0x2f8(%rbx) # imm = 0x40400000
cmpl $0x0, 0x280(%rbx)
jne 0x2bc8a
movl $0x2, 0x280(%rbx)
cmpl $0x1, 0x28c(%rbx)
je 0x2bcc6
leaq 0x260e4(%rip), %rdi     # 0x51d7e
callq *0x48(%r14)
movl %eax, 0x368(%rbx)
leaq 0x260e6(%rip), %rdi     # 0x51d91
callq *0x48(%r14)
movl %eax, 0x36c(%rbx)
leaq 0x260e7(%rip), %rdi     # 0x51da3
callq *0x48(%r14)
movl %eax, 0x370(%rbx)
movl 0x140(%rbx), %eax
testb $0x1, %al
je 0x2bd37
movsd 0x1b4(%rbx), %xmm0
movsd %xmm0, 0x10(%rbx)
movss 0x1bc(%rbx), %xmm1
movss %xmm1, 0x18(%rbx)
movss 0x1a8(%rbx), %xmm2
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movhps 0x1ac(%rbx), %xmm1      # xmm1 = xmm1[0,1],mem[0,1]
movsd %xmm0, 0x1a8(%rbx)
movups %xmm1, 0x1b0(%rbx)
movsd 0x19c(%rbx), %xmm0
movaps 0x25f96(%rip), %xmm1    # 0x51cb0
xorps %xmm1, %xmm0
movlps %xmm0, 0x19c(%rbx)
movss 0x1a4(%rbx), %xmm0
xorps %xmm1, %xmm0
movss %xmm0, 0x1a4(%rbx)
movl 0x254(%rbx), %ecx
testl %ecx, %ecx
je 0x2bd5f
movl $0x1, 0x27c(%rbx)
movq 0x3a686(%rip), %rdx     # 0x663d8
movq %rdx, 0x238(%rbx)
movl %ecx, 0x258(%rbx)
cmpq $0x0, 0x158(%rbx)
je 0x2bd92
cmpq $0x0, 0x130(%rbx)
je 0x2bd92
leaq 0x2603b(%rip), %rdi     # 0x51db5
callq *0x48(%r14)
movq 0x3b1e3(%rip), %rax     # 0x66f68
movq %rax, 0x220(%rbx)
movl 0x140(%rbx), %eax
movl $0x1, 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 0x8(%rbx), %xmm0
movss 0x4(%rbx), %xmm1
movaps %xmm0, %xmm2
movlhps %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0]
movlhps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movss 0x1a8(%rbx), %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 0x1ac(%rbx), %xmm1
shufps $0x24, %xmm2, %xmm1     # xmm1 = xmm1[0,1],xmm2[2,0]
movups %xmm1, 0x348(%rbx)
movsd 0x1b8(%rbx), %xmm1
movss 0x1b4(%rbx), %xmm2
shufps $0xd4, %xmm0, %xmm2     # xmm2 = xmm2[0,1],xmm0[1,3]
shufps $0x42, %xmm1, %xmm2     # xmm2 = xmm2[2,0],xmm1[0,1]
movups %xmm2, 0x358(%rbx)
testb $0x10, %al
je 0x2be33
orb $0x10, 0x41(%rbx)
cmpq $0x0, 0x168(%rbx)
jne 0x2be44
movq %rbx, 0x2d0(%rbx)
movq %rbx, %rdi
callq *0x90(%r14)
movq 0x3af4b(%rip), %rax     # 0x66da0
movss 0x4(%rax), %xmm0
addss 0x2342e(%rip), %xmm0    # 0x4f290
movss %xmm0, 0x200(%rbx)
cmpl $0x0, 0x254(%rbx)
jne 0x2be86
cmpq $0x0, 0x158(%rbx)
jne 0x2be86
movq 0x3acb4(%rip), %rax     # 0x66b38
jmp 0x2be8d
movq 0x3af83(%rip), %rax     # 0x66e10
movq %rax, 0x210(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq