// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x108(%rax)
je 0x2062e
movq -0x8(%rbp), %rax
movl 0x478(%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x18(%rbp)
subl $0xf, %eax
ja 0x2062a
movq -0x18(%rbp), %rax
leaq 0x4fd65(%rip), %rcx     # 0x702b8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x1, 0x6462d(%rip)     # 0x84b90
jne 0x20588
movq -0x8(%rbp), %rax
movl 0x38(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x38(%rax)
movq -0x8(%rbp), %rax
cmpl $0x5, 0x38(%rax)
jl 0x20586
movl $0x0, 0x6460a(%rip)     # 0x84b90
jmp 0x205ab
movq -0x8(%rbp), %rax
movl 0x38(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x38(%rax)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x38(%rax)
jg 0x205a9
movl $0x1, 0x645e7(%rip)     # 0x84b90
jmp 0x205ab
jmp 0x2062c
movq -0x8(%rbp), %rax
movl 0x38(%rax), %eax
decl %eax
subl $0xe, %eax
ja 0x205cc
jmp 0x205bd
movq -0x8(%rbp), %rax
movl 0x38(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x38(%rax)
jmp 0x205d7
movq -0x8(%rbp), %rax
movl $0x5, 0x38(%rax)
jmp 0x2062c
movq -0x8(%rbp), %rax
movl 0x38(%rax), %eax
addl $0x1, %eax
movl $0xf, %ecx
cltd
idivl %ecx
movq -0x8(%rbp), %rax
movl %edx, 0x38(%rax)
jmp 0x2062c
movq -0x8(%rbp), %rax
movl 0x38(%rax), %eax
addl $0x1, %eax
movl $0xe, %ecx
cltd
idivl %ecx
movq -0x8(%rbp), %rax
movl %edx, 0x38(%rax)
jmp 0x2062c
movq -0x8(%rbp), %rax
movl 0x38(%rax), %eax
addl $0x1, %eax
movl $0xf, %ecx
cltd
idivl %ecx
movq -0x8(%rbp), %rax
movl %edx, 0x38(%rax)
jmp 0x2062c
jmp 0x2062c
jmp 0x2062e
movq -0x8(%rbp), %rax
movq 0x625e7(%rip), %rcx     # 0x82c20
movq %rcx, 0x210(%rax)
movss 0x4fc4c(%rip), %xmm0    # 0x70294
movq 0x62751(%rip), %rax     # 0x82da0
addss 0x4(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x200(%rax)
movq -0x8(%rbp), %rax
movss 0x4fc24(%rip), %xmm1    # 0x70290
addss 0x250(%rax), %xmm1
movq 0x62725(%rip), %rax     # 0x82da0
movss 0x4(%rax), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x20709
callq 0x18410
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x206a7
movq 0x62158(%rip), %rax     # 0x827f8
movq (%rax), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x206f1
movq -0x10(%rbp), %rax
movss 0x4(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x4(%rax)
movq -0x10(%rbp), %rax
movss 0x8(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x8(%rax)
movq -0x10(%rbp), %rax
movss 0xc(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0xc(%rax)
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x20710
movq 0x626a8(%rip), %rax     # 0x82da0
movss 0x4(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x250(%rax)
addq $0x20, %rsp
popq %rbp
retq
nop