// File: /workspace/github_c_makefile_star2_O2/QwazyWabbitWOS[P]lmctf60/p_client.c
// Function: SelectSpawnPoint
void	SelectSpawnPoint (edict_t *ent, vec3_t origin, vec3_t angles)
{
	edict_t	*spot = NULL;
	
	// CTF CODE -- LM_JORM
	if (ent->client->resp.enterframe == level.framenum) // Just entered
		spot = SelectTeamSpawnPoint (ent);
	
	if (!spot)
		spot = SelectAnySpawnPoint (ent);
	
	if (!spot)
		spot = SelectDeathmatchSpawnPoint ();
	
	if (!spot)
		spot = SelectCoopSpawnPoint (ent);
	
	if (!spot)
		spot = G_Find (spot, FOFS(classname), "info_flag_red");
	if (!spot)
		spot = G_Find (spot, FOFS(classname), "info_flag_blue");
	
	// END CTF CODE -- LM_JORM
	
	// find a single player start spot
	if (!spot)
	{
		while ((spot = G_Find (spot, FOFS(classname), "info_player_start")) != NULL)
		{
			if (!game.spawnpoint[0] && !spot->targetname)
				break;

			if (!game.spawnpoint[0] || !spot->targetname)
				continue;

			if (Q_stricmp(game.spawnpoint, spot->targetname) == 0)
				break;
		}

		if (!spot)
		{
			if (!game.spawnpoint[0])
			{	// there wasn't a spawnpoint without a target, so use any
				spot = G_Find (spot, FOFS(classname), "info_player_start");
			}
			if (!spot) 
			{
				gi.error("Couldn't find spawn point %s\n", game.spawnpoint);
				return;
			}
		}
	}

	VectorCopy (spot->s.origin, origin);
	origin[2] += 9;
	VectorCopy (spot->s.angles, angles);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r12
movq 0x58(%rdi), %rax
movl 0xdf0(%rax), %eax
movq 0x264c1(%rip), %rcx     # 0x66da0
cmpl (%rcx), %eax
jne 0x408f0
movq %r12, %rdi
callq 0x19470
testq %rax, %rax
jne 0x40944
movq %r12, %rdi
callq 0x180b0
testq %rax, %rax
jne 0x40944
callq 0x19b40
testq %rax, %rax
jne 0x40944
movq %r12, %rdi
callq 0x19900
testq %rax, %rax
jne 0x40944
leaq 0xe635(%rip), %rdx      # 0x4ef50
xorl %edi, %edi
movl $0x138, %esi            # imm = 0x138
callq 0x195e0
testq %rax, %rax
jne 0x40944
leaq 0xe62b(%rip), %rdx      # 0x4ef5e
xorl %edi, %edi
movl $0x138, %esi            # imm = 0x138
callq 0x195e0
testq %rax, %rax
je 0x409a1
movq %rax, %r15
movss 0x4(%r15), %xmm0
movss %xmm0, (%r14)
movss 0x8(%r15), %xmm0
movss %xmm0, 0x4(%r14)
movss 0xc(%r15), %xmm0
addss 0x14e10(%rip), %xmm0    # 0x5577c
movss %xmm0, 0x8(%r14)
movss 0x10(%r15), %xmm0
movss %xmm0, (%rbx)
movss 0x14(%r15), %xmm0
movss %xmm0, 0x4(%rbx)
movss 0x18(%r15), %xmm0
movss %xmm0, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r15d, %r15d
leaq 0xebae(%rip), %r12      # 0x4f559
movq 0x2638e(%rip), %rbp     # 0x66d40
movl $0x410, %r13d           # imm = 0x410
addq 0x26381(%rip), %r13     # 0x66d40
movq %r15, %rdi
movl $0x138, %esi            # imm = 0x138
movq %r12, %rdx
callq 0x195e0
movq %rax, %r15
movb 0x410(%rbp), %al
testq %r15, %r15
je 0x40a08
movq 0x158(%r15), %rsi
testb %al, %al
je 0x409fe
testq %rsi, %rsi
je 0x409bf
movq %r13, %rdi
callq 0x186d0
testl %eax, %eax
jne 0x409bf
jmp 0x40947
testq %rsi, %rsi
jne 0x409bf
jmp 0x40947
testb %al, %al
je 0x40a3c
movq 0x25bed(%rip), %rax     # 0x66600
movq 0x38(%rax), %rcx
movl $0x410, %esi            # imm = 0x410
addq 0x2631d(%rip), %rsi     # 0x66d40
leaq 0x15933(%rip), %rdi     # 0x5635d
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rcx
leaq 0xeb16(%rip), %rdx      # 0x4f559
xorl %edi, %edi
movl $0x138, %esi            # imm = 0x138
callq 0x195e0
testq %rax, %rax
jne 0x40944
jmp 0x40a0c