// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x10, %rsp
movq $0x0, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rdi
xorl %eax, %eax
addq $0x138, %rax            # imm = 0x138
movl %eax, %esi
leaq 0x50267(%rip), %rdx     # 0x7018b
callq 0x19660
movq %rax, -0x8(%rbp)
cmpq $0x0, %rax
je 0x1ff3e
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x1ff0f
cmpl $0x0, -0xc(%rbp)
jle 0x1ffc2
callq 0x19c80
andl $0x7fff, %eax           # imm = 0x7FFF
cvtsi2ss %eax, %xmm0
movss 0x5032e(%rip), %xmm1    # 0x70288
divss %xmm1, %xmm0
cvtsi2ssl -0xc(%rbp), %xmm1
mulss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0x10(%rbp)
cmpl $0x0, -0x10(%rbp)
jge 0x1ff7b
movl $0x0, -0x10(%rbp)
cmpl $0x14, -0x10(%rbp)
jle 0x1ff88
movl $0x14, -0x10(%rbp)
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rdi
xorl %eax, %eax
addq $0x138, %rax            # imm = 0x138
movl %eax, %esi
leaq 0x501e6(%rip), %rdx     # 0x7018b
callq 0x19660
movq %rax, -0x8(%rbp)
movl -0x10(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x10(%rbp)
cmpl $0x0, -0x10(%rbp)
jg 0x1ff90
jmp 0x2012d
jmp 0x1ffc4
movq -0x8(%rbp), %rdi
xorl %eax, %eax
addq $0x138, %rax            # imm = 0x138
movl %eax, %esi
leaq 0x501c4(%rip), %rdx     # 0x7019d
callq 0x19660
movq %rax, -0x8(%rbp)
cmpq $0x0, %rax
je 0x1fff3
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x1ffc4
cmpl $0x0, -0xc(%rbp)
jle 0x20077
callq 0x19c80
andl $0x7fff, %eax           # imm = 0x7FFF
cvtsi2ss %eax, %xmm0
movss 0x50279(%rip), %xmm1    # 0x70288
divss %xmm1, %xmm0
cvtsi2ssl -0xc(%rbp), %xmm1
mulss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0x10(%rbp)
cmpl $0x0, -0x10(%rbp)
jge 0x20030
movl $0x0, -0x10(%rbp)
cmpl $0x14, -0x10(%rbp)
jle 0x2003d
movl $0x14, -0x10(%rbp)
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rdi
xorl %eax, %eax
addq $0x138, %rax            # imm = 0x138
movl %eax, %esi
leaq 0x50143(%rip), %rdx     # 0x7019d
callq 0x19660
movq %rax, -0x8(%rbp)
movl -0x10(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x10(%rbp)
cmpl $0x0, -0x10(%rbp)
jg 0x20045
jmp 0x2012b
jmp 0x20079
movq -0x8(%rbp), %rdi
xorl %eax, %eax
addq $0x138, %rax            # imm = 0x138
movl %eax, %esi
leaq 0x50121(%rip), %rdx     # 0x701af
callq 0x19660
movq %rax, -0x8(%rbp)
cmpq $0x0, %rax
je 0x200a8
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x20079
cmpl $0x0, -0xc(%rbp)
jle 0x20129
callq 0x19c80
andl $0x7fff, %eax           # imm = 0x7FFF
cvtsi2ss %eax, %xmm0
movss 0x501c4(%rip), %xmm1    # 0x70288
divss %xmm1, %xmm0
cvtsi2ssl -0xc(%rbp), %xmm1
mulss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0x10(%rbp)
cmpl $0x0, -0x10(%rbp)
jge 0x200e5
movl $0x0, -0x10(%rbp)
cmpl $0x14, -0x10(%rbp)
jle 0x200f2
movl $0x14, -0x10(%rbp)
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rdi
xorl %eax, %eax
addq $0x138, %rax            # imm = 0x138
movl %eax, %esi
leaq 0x500a0(%rip), %rdx     # 0x701af
callq 0x19660
movq %rax, -0x8(%rbp)
movl -0x10(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x10(%rbp)
cmpl $0x0, -0x10(%rbp)
jg 0x200fa
jmp 0x20129
jmp 0x2012b
jmp 0x2012d
movq -0x8(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)