// File: /workspace/github_c_makefile_star2_O1/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 $0x10, %rsp
movq %rdi, %rbx
leaq 0x34dda(%rip), %rdx     # 0x54300
movl $0x138, %esi            # imm = 0x138
callq 0x19430
testq %rax, %rax
je 0x1f57d
movss 0x4(%rbx), %xmm0
subss 0x4(%rax), %xmm0
leaq 0x4(%rsp), %rdi
movss %xmm0, (%rdi)
movss 0x8(%rbx), %xmm0
subss 0x8(%rax), %xmm0
movss %xmm0, 0x4(%rdi)
movss 0xc(%rbx), %xmm0
subss 0xc(%rax), %xmm0
movss %xmm0, 0x8(%rdi)
callq 0x192e0
movss 0x34d19(%rip), %xmm1    # 0x5428c
ucomiss %xmm0, %xmm1
jbe 0x1f585
movaps %xmm0, %xmm1
jmp 0x1f585
movss 0x34d07(%rip), %xmm1    # 0x5428c
movss %xmm1, (%rsp)
leaq 0x34d7b(%rip), %rdx     # 0x5430c
movq %rbx, %rdi
movl $0x138, %esi            # imm = 0x138
callq 0x19430
testq %rax, %rax
je 0x1f5e8
movss 0x4(%rbx), %xmm0
subss 0x4(%rax), %xmm0
leaq 0x4(%rsp), %rdi
movss %xmm0, (%rdi)
movss 0x8(%rbx), %xmm0
subss 0x8(%rax), %xmm0
movss %xmm0, 0x4(%rdi)
movss 0xc(%rbx), %xmm0
subss 0xc(%rax), %xmm0
movss %xmm0, 0x8(%rdi)
callq 0x192e0
movss (%rsp), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x1f5e8
movss %xmm0, (%rsp)
leaq 0x34d28(%rip), %rdx     # 0x54317
movq %rbx, %rdi
movl $0x138, %esi            # imm = 0x138
callq 0x19430
testq %rax, %rax
je 0x1f646
movss 0x4(%rbx), %xmm0
subss 0x4(%rax), %xmm0
leaq 0x4(%rsp), %rdi
movss %xmm0, (%rdi)
movss 0x8(%rbx), %xmm0
subss 0x8(%rax), %xmm0
movss %xmm0, 0x4(%rdi)
movss 0xc(%rbx), %xmm0
subss 0xc(%rax), %xmm0
movss %xmm0, 0x8(%rdi)
callq 0x192e0
movss (%rsp), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x1f646
movss %xmm0, (%rsp)
leaq 0x34cd6(%rip), %rdx     # 0x54323
movq %rbx, %rdi
movl $0x138, %esi            # imm = 0x138
callq 0x19430
testq %rax, %rax
je 0x1f6a4
movss 0x4(%rbx), %xmm0
subss 0x4(%rax), %xmm0
leaq 0x4(%rsp), %rdi
movss %xmm0, (%rdi)
movss 0x8(%rbx), %xmm0
subss 0x8(%rax), %xmm0
movss %xmm0, 0x4(%rdi)
movss 0xc(%rbx), %xmm0
subss 0xc(%rax), %xmm0
movss %xmm0, 0x8(%rdi)
callq 0x192e0
movss (%rsp), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x1f6a4
movss %xmm0, (%rsp)
leaq 0x34c83(%rip), %rdx     # 0x5432e
movq %rbx, %rdi
movl $0x138, %esi            # imm = 0x138
callq 0x19430
testq %rax, %rax
je 0x1f702
movss 0x4(%rbx), %xmm0
subss 0x4(%rax), %xmm0
leaq 0x4(%rsp), %rdi
movss %xmm0, (%rdi)
movss 0x8(%rbx), %xmm0
subss 0x8(%rax), %xmm0
movss %xmm0, 0x4(%rdi)
movss 0xc(%rbx), %xmm0
subss 0xc(%rax), %xmm0
movss %xmm0, 0x8(%rdi)
callq 0x192e0
movss (%rsp), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x1f707
movaps %xmm0, %xmm1
jmp 0x1f707
movss (%rsp), %xmm1
movaps %xmm1, %xmm0
addq $0x10, %rsp
popq %rbx
retq