// File: /workspace/github_c_makefile_star2_O1/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 0x25082(%rip), %rcx     # 0x69da0
cmpl (%rcx), %eax
jne 0x44d2f
movq %r12, %rdi
callq 0x192f0
movq %rax, %r15
jmp 0x44d32
xorl %r15d, %r15d
testq %r15, %r15
jne 0x44d42
movq %r12, %rdi
callq 0x180b0
movq %rax, %r15
testq %r15, %r15
jne 0x44d4f
callq 0x19970
movq %rax, %r15
testq %r15, %r15
jne 0x44d5f
movq %r12, %rdi
callq 0x19740
movq %rax, %r15
testq %r15, %r15
jne 0x44d7a
leaq 0xf1e5(%rip), %rdx      # 0x53f50
xorl %edi, %edi
movl $0x138, %esi            # imm = 0x138
callq 0x19430
movq %rax, %r15
testq %r15, %r15
jne 0x44d95
leaq 0xf1d8(%rip), %rdx      # 0x53f5e
xorl %edi, %edi
movl $0x138, %esi            # imm = 0x138
callq 0x19430
movq %rax, %r15
testq %r15, %r15
jne 0x44e4c
leaq 0xf784(%rip), %rdx      # 0x54529
xorl %edi, %edi
movl $0x138, %esi            # imm = 0x138
callq 0x19430
testq %rax, %rax
je 0x44e1c
movq %rax, %r15
movq 0x24f80(%rip), %rbp     # 0x69d40
leaq 0xf762(%rip), %r12      # 0x54529
movl $0x410, %r13d           # imm = 0x410
addq 0x24f6c(%rip), %r13     # 0x69d40
movb 0x410(%rbp), %al
testb %al, %al
jne 0x44dec
cmpq $0x0, 0x158(%r15)
je 0x44e4c
testb %al, %al
je 0x44e04
movq 0x158(%r15), %rsi
testq %rsi, %rsi
je 0x44e04
movq %r13, %rdi
callq 0x18690
testl %eax, %eax
je 0x44e4c
movq %r15, %rdi
movl $0x138, %esi            # imm = 0x138
movq %r12, %rdx
callq 0x19430
movq %rax, %r15
testq %rax, %rax
jne 0x44dd4
movq 0x24f1d(%rip), %rax     # 0x69d40
cmpb $0x0, 0x410(%rax)
je 0x44e31
xorl %r15d, %r15d
jmp 0x44e47
leaq 0xf6f1(%rip), %rdx      # 0x54529
xorl %edi, %edi
movl $0x138, %esi            # imm = 0x138
callq 0x19430
movq %rax, %r15
testq %r15, %r15
je 0x44ea6
movss 0x4(%r15), %xmm0
movss %xmm0, (%r14)
movss 0x8(%r15), %xmm0
movss %xmm0, 0x4(%r14)
movss 0xc(%r15), %xmm0
addss 0x156e3(%rip), %xmm0    # 0x5a554
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
movq 0x24753(%rip), %rax     # 0x69600
movq 0x38(%rax), %rcx
movl $0x410, %esi            # imm = 0x410
addq 0x24e83(%rip), %rsi     # 0x69d40
leaq 0x161e9(%rip), %rdi     # 0x5b0ad
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rcx