// File: /workspace/github_c_makefile_star2_O3/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 0x24bb0(%rip), %rcx     # 0x68da0
cmpl (%rcx), %eax
jne 0x44201
movq %r12, %rdi
callq 0x192f0
testq %rax, %rax
jne 0x44255
movq %r12, %rdi
callq 0x180b0
testq %rax, %rax
jne 0x44255
callq 0x19960
testq %rax, %rax
jne 0x44255
movq %r12, %rdi
callq 0x19730
testq %rax, %rax
jne 0x44255
leaq 0xed24(%rip), %rdx      # 0x52f50
xorl %edi, %edi
movl $0x138, %esi            # imm = 0x138
callq 0x19430
testq %rax, %rax
jne 0x44255
leaq 0xed1a(%rip), %rdx      # 0x52f5e
xorl %edi, %edi
movl $0x138, %esi            # imm = 0x138
callq 0x19430
testq %rax, %rax
je 0x442b2
movq %rax, %r15
movss 0x4(%r15), %xmm0
movss %xmm0, (%r14)
movss 0x8(%r15), %xmm0
movss %xmm0, 0x4(%r14)
movss 0xc(%r15), %xmm0
addss 0x15517(%rip), %xmm0    # 0x59794
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
leaq 0xf2a0(%rip), %rdx      # 0x53559
xorl %edi, %edi
movl $0x138, %esi            # imm = 0x138
callq 0x19430
testq %rax, %rax
je 0x4432f
movq %rax, %r15
movq 0x24a6c(%rip), %rbp     # 0x68d40
leaq 0xf27e(%rip), %r12      # 0x53559
movl $0x410, %r13d           # imm = 0x410
addq 0x24a58(%rip), %r13     # 0x68d40
cmpb $0x0, 0x410(%rbp)
movq 0x158(%r15), %rsi
je 0x4430e
testq %rsi, %rsi
je 0x44317
movq %r13, %rdi
callq 0x18690
testl %eax, %eax
jne 0x44317
jmp 0x44258
testq %rsi, %rsi
je 0x44258
movq %r15, %rdi
movl $0x138, %esi            # imm = 0x138
movq %r12, %rdx
callq 0x19430
movq %rax, %r15
testq %rax, %rax
jne 0x442e8
movq 0x24a0a(%rip), %rax     # 0x68d40
cmpb $0x0, 0x410(%rax)
je 0x4436f
movq 0x242ba(%rip), %rax     # 0x68600
movq 0x38(%rax), %rcx
movl $0x410, %esi            # imm = 0x410
addq 0x249ea(%rip), %rsi     # 0x68d40
leaq 0x16010(%rip), %rdi     # 0x5a36d
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rcx
leaq 0xf1e3(%rip), %rdx      # 0x53559
xorl %edi, %edi
movl $0x138, %esi            # imm = 0x138
callq 0x19430
testq %rax, %rax
jne 0x44255
jmp 0x4433f