// File: /workspace/github_c_makefile_star2_O3/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 %ecx, %ecx
movl %ecx, 0x18(%rdi)
movq %rcx, 0x10(%rdi)
leaq 0x19c(%rdi), %r14
leaq 0x1a4(%rdi), %rax
movl %ecx, 0x1a4(%rdi)
movq %rcx, 0x19c(%rdi)
movl 0x140(%rdi), %ecx
testb $0x40, %cl
jne 0x2e11f
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 0x24e23(%rip), %xmm1    # 0x52f28
movdqa %xmm0, %xmm2
pandn %xmm1, %xmm2
pand 0x27bab(%rip), %xmm0    # 0x55cc0
por %xmm2, %xmm0
pxor %xmm1, %xmm1
jmp 0x2e12e
pxor %xmm0, %xmm0
movd 0x24dfd(%rip), %xmm1    # 0x52f28
movq %rax, %rdx
movl $0x3f800000, (%rdx)     # imm = 0x3F800000
testb $0x2, %cl
je 0x2e152
movdqa 0x27b8f(%rip), %xmm2    # 0x55cd0
pxor %xmm2, %xmm0
movq %xmm0, (%r14)
pxor %xmm2, %xmm1
movd %xmm1, (%rax)
leaq 0x10(%rbx), %r15
movq 0x3a50b(%rip), %r13     # 0x68668
movl 0x24(%r13), %eax
pxor %xmm0, %xmm0
pxor %xmm1, %xmm1
testl %eax, %eax
jne 0x2e1b0
movq 0x3a48c(%rip), %rax     # 0x68600
movq 0x8(%rax), %rbp
movq 0x138(%rbx), %r12
leaq 0x4(%rbx), %rdi
callq 0x190a0
leaq 0x27c54(%rip), %rdi     # 0x55de3
movq %r12, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq *%rbp
movl $0x5a, 0x24(%r13)
movq 0x10(%rbx), %xmm0
movd 0x18(%rbx), %xmm1
movl $0x5a, %eax
movq %xmm0, 0x1a8(%rbx)
movd %xmm1, 0x1b0(%rbx)
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
leaq 0x1b4(%rbx), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x19760
xorps %xmm0, %xmm0
cvtsi2ssl 0x24(%r13), %xmm0
movss %xmm0, 0x380(%rbx)
movl $0x2, 0x118(%rbx)
movl $0x3, 0x108(%rbx)
movq 0x3a3fb(%rip), %r14     # 0x68600
movq 0x120(%rbx), %rsi
movq %rbx, %rdi
callq *0x58(%r14)
movq 0x3a256(%rip), %rax     # 0x68470
movq %rax, 0x218(%rbx)
movq 0x3a798(%rip), %rax     # 0x689c0
movq %rax, 0x228(%rbx)
movss 0x190(%rbx), %xmm0
ucomiss 0x25752(%rip), %xmm0    # 0x53990
jne 0x2e254
jp 0x2e254
movl $0x42c80000, 0x190(%rbx) # imm = 0x42C80000
movss 0x279f8(%rip), %xmm0    # 0x55c4c
movss 0x194(%rbx), %xmm2
pxor %xmm1, %xmm1
ucomiss %xmm1, %xmm2
jne 0x2e26f
jp 0x2e26f
movss %xmm0, 0x194(%rbx)
movss 0x198(%rbx), %xmm2
ucomiss %xmm1, %xmm2
jne 0x2e286
jp 0x2e286
movss %xmm0, 0x198(%rbx)
movss 0x2f8(%rbx), %xmm0
ucomiss %xmm1, %xmm0
jne 0x2e29f
jp 0x2e29f
movl $0x40400000, 0x2f8(%rbx) # imm = 0x40400000
cmpl $0x0, 0x280(%rbx)
jne 0x2e2b2
movl $0x2, 0x280(%rbx)
cmpl $0x1, 0x28c(%rbx)
je 0x2e2ee
leaq 0x27adc(%rip), %rdi     # 0x55d9e
callq *0x48(%r14)
movl %eax, 0x368(%rbx)
leaq 0x27ade(%rip), %rdi     # 0x55db1
callq *0x48(%r14)
movl %eax, 0x36c(%rbx)
leaq 0x27adf(%rip), %rdi     # 0x55dc3
callq *0x48(%r14)
movl %eax, 0x370(%rbx)
movl 0x140(%rbx), %eax
testb $0x1, %al
je 0x2e35f
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 0x2798e(%rip), %xmm1    # 0x55cd0
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 0x2e387
movl $0x1, 0x27c(%rbx)
movq 0x3a05e(%rip), %rdx     # 0x683d8
movq %rdx, 0x238(%rbx)
movl %ecx, 0x258(%rbx)
cmpq $0x0, 0x158(%rbx)
je 0x2e3ba
cmpq $0x0, 0x130(%rbx)
je 0x2e3ba
leaq 0x27a33(%rip), %rdi     # 0x55dd5
callq *0x48(%r14)
movq 0x3abbb(%rip), %rax     # 0x68f68
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 0x2e45b
orb $0x10, 0x41(%rbx)
cmpq $0x0, 0x168(%rbx)
jne 0x2e46c
movq %rbx, 0x2d0(%rbx)
movq %rbx, %rdi
callq *0x90(%r14)
movq 0x3a923(%rip), %rax     # 0x68da0
movss 0x4(%rax), %xmm0
addss 0x24e06(%rip), %xmm0    # 0x53290
movss %xmm0, 0x200(%rbx)
cmpl $0x0, 0x254(%rbx)
jne 0x2e4ae
cmpq $0x0, 0x158(%rbx)
jne 0x2e4ae
movq 0x3a68c(%rip), %rax     # 0x68b38
jmp 0x2e4b5
movq 0x3a95b(%rip), %rax     # 0x68e10
movq %rax, 0x210(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq