// File: /workspace/github_c_makefile_star2_O3/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 0x1f7ad
movl 0x478(%rbx), %ecx
leal -0x1(%rcx), %eax
cmpl $0x7, %eax
ja 0x1f732
leaq 0x33baf(%rip), %rcx     # 0x532b0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x38(%rbx), %eax
cmpb $0x0, 0x4e90c(%rip)     # 0x6e020
je 0x1f852
leal -0x1(%rax), %ecx
movl %ecx, 0x38(%rbx)
cmpl $0x1, %eax
jg 0x1f7ad
movb $0x0, 0x4e8f0(%rip)     # 0x6e020
jmp 0x1f7ad
cmpl $0x10, %ecx
jne 0x1f7ad
movl 0x38(%rbx), %eax
movl %eax, %ecx
incl %ecx
movslq %ecx, %rcx
imulq $-0x77777777, %rcx, %rcx # imm = 0x88888889
shrq $0x20, %rcx
addl %eax, %ecx
incl %ecx
movl %ecx, %edx
shrl $0x1f, %edx
sarl $0x3, %ecx
addl %edx, %ecx
leal (%rcx,%rcx,4), %ecx
leal (%rcx,%rcx,2), %ecx
negl %ecx
jmp 0x1f7a6
movl 0x38(%rbx), %eax
leal -0x1(%rax), %ecx
cmpl $0xe, %ecx
ja 0x1f846
incl %eax
movl %eax, 0x38(%rbx)
jmp 0x1f7ad
movl 0x38(%rbx), %eax
movl %eax, %ecx
incl %ecx
movslq %ecx, %rcx
imulq $-0x6db6db6d, %rcx, %rcx # imm = 0x92492493
shrq $0x20, %rcx
addl %eax, %ecx
incl %ecx
movl %ecx, %edx
shrl $0x1f, %edx
sarl $0x3, %ecx
addl %edx, %ecx
movl %ecx, %edx
shll $0x4, %edx
addl %ecx, %ecx
subl %edx, %ecx
addl %ecx, %eax
incl %eax
movl %eax, 0x38(%rbx)
movq 0x4946c(%rip), %rax     # 0x68c20
movq %rax, 0x210(%rbx)
movq 0x495de(%rip), %r14     # 0x68da0
movss 0x4(%r14), %xmm0
movss 0x33ac0(%rip), %xmm1    # 0x53290
addss %xmm0, %xmm1
movss %xmm1, 0x200(%rbx)
movss 0x250(%rbx), %xmm1
addss 0x33aa8(%rip), %xmm1    # 0x53294
ucomiss %xmm1, %xmm0
jbe 0x1f83e
callq 0x183d0
testq %rax, %rax
jne 0x1f805
movq 0x48ff6(%rip), %rax     # 0x687f8
movq (%rax), %rax
testq %rax, %rax
je 0x1f830
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 0x1f86d
movss 0x4(%r14), %xmm0
movss %xmm0, 0x250(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl $0x5, 0x38(%rbx)
jmp 0x1f7ad
leal 0x1(%rax), %ecx
movl %ecx, 0x38(%rbx)
cmpl $0x4, %eax
jl 0x1f7ad
movb $0x1, 0x4e7b8(%rip)     # 0x6e020
jmp 0x1f7ad