// File: /workspace/github_c_makefile_star2_O3/QwazyWabbitWOS[P]lmctf60/g_runes.c
// Function: RunesRangeFromSpot
float RunesRangeFromSpot (edict_t *spot)
{
  edict_t *rune;
  float	bestrunedistance;
  vec3_t v;
  float	runedistance;
  
  
  bestrunedistance = 9999999;
  

  //-bat - This should use a function!

  rune = G_Find (spot, FOFS(classname), "damage_rune");
  if (rune)
  {
	  VectorSubtract (spot->s.origin, rune->s.origin, v);
	  runedistance = VectorLength (v);
	  
	  if (runedistance < bestrunedistance)
		  bestrunedistance = runedistance;
  }

  rune = G_Find (spot, FOFS(classname), "haste_rune");
  if (rune)
  {
	  VectorSubtract (spot->s.origin, rune->s.origin, v);
	  runedistance = VectorLength (v);
	  
	  if (runedistance < bestrunedistance)
		  bestrunedistance = runedistance;
  }

  rune = G_Find (spot, FOFS(classname), "resist_rune");
  if (rune)
  {
	  VectorSubtract (spot->s.origin, rune->s.origin, v);
	  runedistance = VectorLength (v);
	  
	  if (runedistance < bestrunedistance)
		  bestrunedistance = runedistance;
  }

  rune = G_Find (spot, FOFS(classname), "regen_rune");
  if (rune)
  {
	  VectorSubtract (spot->s.origin, rune->s.origin, v);
	  runedistance = VectorLength (v);
	  
	  if (runedistance < bestrunedistance)
		  bestrunedistance = runedistance;
  }

  
  rune = G_Find (spot, FOFS(classname), "vampire_rune");   //added by Vampire
  if (rune)                                                  
  {
	  VectorSubtract (spot->s.origin, rune->s.origin, v);
	  runedistance = VectorLength (v);
	  
	  if (runedistance < bestrunedistance)
		  bestrunedistance = runedistance;
  }



  return bestrunedistance;
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
leaq 0x33e7d(%rip), %rdx     # 0x53310
movl $0x138, %esi            # imm = 0x138
callq 0x19430
testq %rax, %rax
je 0x1f4dd
movsd 0x4(%rbx), %xmm0
movsd 0x4(%rax), %xmm1
subps %xmm1, %xmm0
leaq 0x10(%rsp), %rdi
movlps %xmm0, (%rdi)
movss 0xc(%rbx), %xmm0
subss 0xc(%rax), %xmm0
movss %xmm0, 0x8(%rdi)
callq 0x192e0
movss 0x33db9(%rip), %xmm1    # 0x5328c
ucomiss %xmm0, %xmm1
jbe 0x1f4e5
movaps %xmm0, %xmm1
jmp 0x1f4e5
movss 0x33da7(%rip), %xmm1    # 0x5328c
movss %xmm1, 0xc(%rsp)
leaq 0x33e2a(%rip), %rdx     # 0x5331c
movq %rbx, %rdi
movl $0x138, %esi            # imm = 0x138
callq 0x19430
testq %rax, %rax
je 0x1f53e
movsd 0x4(%rbx), %xmm0
movsd 0x4(%rax), %xmm1
subps %xmm1, %xmm0
leaq 0x10(%rsp), %rdi
movlps %xmm0, (%rdi)
movss 0xc(%rbx), %xmm0
subss 0xc(%rax), %xmm0
movss %xmm0, 0x8(%rdi)
callq 0x192e0
movss 0xc(%rsp), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x1f53e
movss %xmm0, 0xc(%rsp)
leaq 0x33de2(%rip), %rdx     # 0x53327
movq %rbx, %rdi
movl $0x138, %esi            # imm = 0x138
callq 0x19430
testq %rax, %rax
je 0x1f591
movsd 0x4(%rbx), %xmm0
movsd 0x4(%rax), %xmm1
subps %xmm1, %xmm0
leaq 0x10(%rsp), %rdi
movlps %xmm0, (%rdi)
movss 0xc(%rbx), %xmm0
subss 0xc(%rax), %xmm0
movss %xmm0, 0x8(%rdi)
callq 0x192e0
movss 0xc(%rsp), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x1f591
movss %xmm0, 0xc(%rsp)
leaq 0x33d9b(%rip), %rdx     # 0x53333
movq %rbx, %rdi
movl $0x138, %esi            # imm = 0x138
callq 0x19430
testq %rax, %rax
je 0x1f5e4
movsd 0x4(%rbx), %xmm0
movsd 0x4(%rax), %xmm1
subps %xmm1, %xmm0
leaq 0x10(%rsp), %rdi
movlps %xmm0, (%rdi)
movss 0xc(%rbx), %xmm0
subss 0xc(%rax), %xmm0
movss %xmm0, 0x8(%rdi)
callq 0x192e0
movss 0xc(%rsp), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x1f5e4
movss %xmm0, 0xc(%rsp)
leaq 0x33d53(%rip), %rdx     # 0x5333e
movq %rbx, %rdi
movl $0x138, %esi            # imm = 0x138
callq 0x19430
testq %rax, %rax
je 0x1f636
movsd 0x4(%rbx), %xmm0
movsd 0x4(%rax), %xmm1
subps %xmm1, %xmm0
leaq 0x10(%rsp), %rdi
movlps %xmm0, (%rdi)
movss 0xc(%rbx), %xmm0
subss 0xc(%rax), %xmm0
movss %xmm0, 0x8(%rdi)
callq 0x192e0
movss 0xc(%rsp), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x1f63c
movaps %xmm0, %xmm1
jmp 0x1f63c
movss 0xc(%rsp), %xmm1
movaps %xmm1, %xmm0
addq $0x20, %rsp
popq %rbx
retq