// File: /workspace/github_c_makefile_star2_O2/QwazyWabbitWOS[P]lmctf60/g_runes.c
// Function: SelectRuneSpawnPoint
edict_t *SelectRuneSpawnPoint (void)
{
	edict_t	*spot = NULL;
	int		count = 0;
	int		selection;
	
	spot = NULL;
	
	while ((spot = G_Find (spot, FOFS(classname), "item_health_small")) != NULL)
	{
		count++;
	}
	
	if (count>0)
	{
		
		selection = random() * count;
		
		if (selection < 0)
			selection = 0;
		if (selection > 20) //arbitrary, lets not wait too long
			selection = 20;
		
		spot = NULL;
		do
		{
			spot = G_Find (spot, FOFS(classname), "item_health_small");
			selection--;
		} 
		while(selection > 0);
	}
	else
	{
		while ((spot = G_Find (spot, FOFS(classname), "item_health_large")) != NULL)
		{
			count++;
		}
		if (count>0)
		{
			
			selection = random() * count;
			
			if (selection < 0)
				selection = 0;
			if (selection > 20) //arbitrary, lets not wait too long
				selection = 20;
			
			spot = NULL;
			do
			{
				spot = G_Find (spot, FOFS(classname), "item_health_large");
				selection--;
			} 
			while(selection > 0);
		}
		else
		{
			while ((spot = G_Find (spot, FOFS(classname), "item_health")) != NULL)
			{
				count++;
			}
			if (count>0)
			{
				
				selection = random() * count;
				
				if (selection < 0)
					selection = 0;
				if (selection > 20) //arbitrary, lets not wait too long
					selection = 20;
				
				spot = NULL;
				do
				{
					spot = G_Find (spot, FOFS(classname), "item_health");
					selection--;
				} 
				while(selection > 0);
			}
		}
		
	}
	
	return spot;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
pushq $0x1
popq %rbp
xorl %eax, %eax
leaq 0x3161b(%rip), %rbx     # 0x4f193
movq %rax, %rdi
movl $0x138, %esi            # imm = 0x138
movq %rbx, %rdx
callq 0x195e0
decl %ebp
testq %rax, %rax
jne 0x1db78
testl %ebp, %ebp
je 0x1dbef
negl %ebp
callq 0x19bf0
andl $0x7fff, %eax           # imm = 0x7FFF
cvtsi2ss %eax, %xmm0
divss 0x316dd(%rip), %xmm0    # 0x4f288
cvtsi2ss %ebp, %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %eax
xorl %ebx, %ebx
testl %eax, %eax
cmovlel %ebx, %eax
cmpl $0x14, %eax
pushq $0x14
popq %rbp
cmovll %eax, %ebp
incl %ebp
leaq 0x315c3(%rip), %r14     # 0x4f193
movq %rbx, %rdi
movl $0x138, %esi            # imm = 0x138
movq %r14, %rdx
callq 0x195e0
movq %rax, %rbx
decl %ebp
cmpl $0x1, %ebp
ja 0x1dbd0
jmp 0x1dced
pushq $0x1
popq %rbp
xorl %eax, %eax
leaq 0x315aa(%rip), %rbx     # 0x4f1a5
movq %rax, %rdi
movl $0x138, %esi            # imm = 0x138
movq %rbx, %rdx
callq 0x195e0
decl %ebp
testq %rax, %rax
jne 0x1dbfb
testl %ebp, %ebp
je 0x1dc6f
negl %ebp
callq 0x19bf0
andl $0x7fff, %eax           # imm = 0x7FFF
cvtsi2ss %eax, %xmm0
divss 0x3165a(%rip), %xmm0    # 0x4f288
cvtsi2ss %ebp, %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %eax
xorl %ebx, %ebx
testl %eax, %eax
cmovlel %ebx, %eax
cmpl $0x14, %eax
pushq $0x14
popq %rbp
cmovll %eax, %ebp
incl %ebp
leaq 0x31552(%rip), %r14     # 0x4f1a5
movq %rbx, %rdi
movl $0x138, %esi            # imm = 0x138
movq %r14, %rdx
callq 0x195e0
movq %rax, %rbx
decl %ebp
cmpl $0x1, %ebp
ja 0x1dc53
jmp 0x1dced
pushq $0x1
popq %rbp
xorl %eax, %eax
leaq 0x3153c(%rip), %rbx     # 0x4f1b7
movq %rax, %rdi
movl $0x138, %esi            # imm = 0x138
movq %rbx, %rdx
callq 0x195e0
decl %ebp
testq %rax, %rax
jne 0x1dc7b
xorl %ebx, %ebx
testl %ebp, %ebp
je 0x1dced
negl %ebp
callq 0x19bf0
andl $0x7fff, %eax           # imm = 0x7FFF
cvtsi2ss %eax, %xmm0
divss 0x315d8(%rip), %xmm0    # 0x4f288
cvtsi2ss %ebp, %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %eax
testl %eax, %eax
cmovlel %ebx, %eax
cmpl $0x14, %eax
pushq $0x14
popq %rbp
cmovll %eax, %ebp
incl %ebp
leaq 0x314e4(%rip), %r14     # 0x4f1b7
movq %rbx, %rdi
movl $0x138, %esi            # imm = 0x138
movq %r14, %rdx
callq 0x195e0
movq %rax, %rbx
decl %ebp
cmpl $0x1, %ebp
ja 0x1dcd3
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq