// File: /workspace/github_c_makefile_star2_O2/QwazyWabbitWOS[P]lmctf60/g_runes.c
// Function: Rune_Think
void Rune_Think (edict_t *self)
{
	edict_t *spot;
	static qboolean forward = true;
	
	if (self->solid != SOLID_NOT)
	{
		switch (self->runetype)
		{
		case RUNE_DAMAGE:
			//screwy stuff to fix animation due to gimblelock
			if (forward == true)
			{
				self->s.frame++;
				if (self->s.frame >= 5)
					forward = false;
			}
			else
			{
				self->s.frame--;
				if (self->s.frame <= 0)
					forward = true;
			}
			break;
		case RUNE_HASTE:
			//screwy stuff to fix animation due to gimblelock
			switch (self->s.frame)
			{
			case 1:
			case 2:
			case 3:
			case 4:
			case 5:
			case 6:
			case 7:
			case 8:
			case 9:
			case 10:
			case 11:
			case 12:
			case 13:
			case 14:
			case 15:
				self->s.frame++;
				break;
			default:
				self->s.frame = 5;
				break;
			}
			break;
		case RUNE_RESIST:
			self->s.frame = ((self->s.frame + 1) % 15);
			break;
		case RUNE_REGEN:
			self->s.frame = ((self->s.frame + 1) % 14);
			break;
		case RUNE_VAMP:                                   //added by Vampire
			self->s.frame = ((self->s.frame + 1) % 15);   
			break;                                        
		default:
			break;
		}
	}
	self->think = Rune_Think;
	self->nextthink = level.time + FRAMETIME;
	
	// Let's reuse last_move_time
	if (self->last_move_time + RUNETHINKTIME < level.time)
	{
		//	spot = SelectRuneSpawnPoint();
		
		spot = SelectRuneSpawnPoint();
		
		if (!spot)
			spot = redflag;
		
		if (spot)
		{
			VectorCopy (spot->s.origin, self->s.origin);
			tossrune (self, 0);
		}
		self->last_move_time = level.time;
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, 0x108(%rdi)
je 0x1dfc6
movl 0x478(%rbx), %ecx
leal -0x1(%rcx), %eax
cmpl $0x7, %eax
ja 0x1df94
leaq 0x31349(%rip), %rcx     # 0x4f2b0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x38(%rbx), %eax
cmpb $0x0, 0x4e1a6(%rip)     # 0x6c120
je 0x1e06b
leal -0x1(%rax), %ecx
movl %ecx, 0x38(%rbx)
cmpl $0x1, %eax
jg 0x1dfc6
movb $0x0, 0x4e18e(%rip)     # 0x6c120
jmp 0x1dfc6
cmpl $0x10, %ecx
jne 0x1dfc6
movl 0x38(%rbx), %eax
incl %eax
pushq $0xf
jmp 0x1dfbf
movl 0x38(%rbx), %eax
leal -0x1(%rax), %ecx
cmpl $0xe, %ecx
ja 0x1e05f
incl %eax
movl %eax, 0x38(%rbx)
jmp 0x1dfc6
movl 0x38(%rbx), %eax
incl %eax
pushq $0xe
popq %rcx
cltd
idivl %ecx
movl %edx, 0x38(%rbx)
movq 0x48c53(%rip), %rax     # 0x66c20
movq %rax, 0x210(%rbx)
movq 0x48dc5(%rip), %r14     # 0x66da0
movss 0x4(%r14), %xmm0
movss 0x312a7(%rip), %xmm1    # 0x4f290
addss %xmm0, %xmm1
movss %xmm1, 0x200(%rbx)
movss 0x250(%rbx), %xmm1
addss 0x3128f(%rip), %xmm1    # 0x4f294
ucomiss %xmm1, %xmm0
jbe 0x1e057
callq 0x18400
testq %rax, %rax
jne 0x1e01e
movq 0x487dd(%rip), %rax     # 0x667f8
movq (%rax), %rax
testq %rax, %rax
je 0x1e049
movss 0x4(%rax), %xmm0
movss %xmm0, 0x4(%rbx)
movss 0x8(%rax), %xmm0
movss %xmm0, 0x8(%rbx)
movss 0xc(%rax), %xmm0
movss %xmm0, 0xc(%rbx)
movq %rbx, %rdi
callq 0x1e086
movss 0x4(%r14), %xmm0
movss %xmm0, 0x250(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl $0x5, 0x38(%rbx)
jmp 0x1dfc6
leal 0x1(%rax), %ecx
movl %ecx, 0x38(%rbx)
cmpl $0x4, %eax
jl 0x1dfc6
movb $0x1, 0x4e09f(%rip)     # 0x6c120
jmp 0x1dfc6