// File: /workspace/github_c_makefile_star2_O1/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
movl $0x1, %ebp
xorl %eax, %eax
leaq 0x34dfd(%rip), %rbx     # 0x54193
movq %rax, %rdi
movl $0x138, %esi            # imm = 0x138
movq %rbx, %rdx
callq 0x19430
decl %ebp
testq %rax, %rax
jne 0x1f396
testl %ebp, %ebp
je 0x1f40f
negl %ebp
callq 0x19a20
andl $0x7fff, %eax           # imm = 0x7FFF
cvtsi2ss %eax, %xmm0
divss 0x34ebf(%rip), %xmm0    # 0x54288
cvtsi2ss %ebp, %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %eax
xorl %ebx, %ebx
testl %eax, %eax
cmovlel %ebx, %eax
cmpl $0x14, %eax
movl $0x14, %ebp
cmovll %eax, %ebp
incl %ebp
leaq 0x34da3(%rip), %r14     # 0x54193
movq %rbx, %rdi
movl $0x138, %esi            # imm = 0x138
movq %r14, %rdx
callq 0x19430
movq %rax, %rbx
decl %ebp
cmpl $0x1, %ebp
jg 0x1f3f0
jmp 0x1f50f
incl %ebp
xorl %eax, %eax
leaq 0x34d8b(%rip), %rbx     # 0x541a5
movq %rax, %rdi
movl $0x138, %esi            # imm = 0x138
movq %rbx, %rdx
callq 0x19430
decl %ebp
testq %rax, %rax
jne 0x1f41a
testl %ebp, %ebp
je 0x1f490
negl %ebp
callq 0x19a20
andl $0x7fff, %eax           # imm = 0x7FFF
cvtsi2ss %eax, %xmm0
divss 0x34e3b(%rip), %xmm0    # 0x54288
cvtsi2ss %ebp, %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %eax
xorl %ebx, %ebx
testl %eax, %eax
cmovlel %ebx, %eax
cmpl $0x14, %eax
movl $0x14, %ebp
cmovll %eax, %ebp
incl %ebp
leaq 0x34d31(%rip), %r14     # 0x541a5
movq %rbx, %rdi
movl $0x138, %esi            # imm = 0x138
movq %r14, %rdx
callq 0x19430
movq %rax, %rbx
decl %ebp
cmpl $0x1, %ebp
jg 0x1f474
jmp 0x1f50f
incl %ebp
xorl %eax, %eax
leaq 0x34d1c(%rip), %rbx     # 0x541b7
movq %rax, %rdi
movl $0x138, %esi            # imm = 0x138
movq %rbx, %rdx
callq 0x19430
decl %ebp
testq %rax, %rax
jne 0x1f49b
xorl %ebx, %ebx
testl %ebp, %ebp
je 0x1f50f
negl %ebp
callq 0x19a20
andl $0x7fff, %eax           # imm = 0x7FFF
cvtsi2ss %eax, %xmm0
divss 0x34db8(%rip), %xmm0    # 0x54288
cvtsi2ss %ebp, %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %eax
testl %eax, %eax
cmovlel %ebx, %eax
cmpl $0x14, %eax
movl $0x14, %ebp
cmovll %eax, %ebp
incl %ebp
leaq 0x34cc2(%rip), %r14     # 0x541b7
movq %rbx, %rdi
movl $0x138, %esi            # imm = 0x138
movq %r14, %rdx
callq 0x19430
movq %rax, %rbx
decl %ebp
cmpl $0x1, %ebp
jg 0x1f4f5
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq