// File: /workspace/github_c_makefile_star2_O2/QwazyWabbitWOS[P]lmctf60/p_hud.c
// Function: BeginIntermission
void BeginIntermission (edict_t *targ)
{
	int		i, n;
	edict_t	*ent, *client;

	if (level.intermissiontime)
		return;		// already activated

	MvpDisp = 1;

    // LM_JORM -- Proclaim a victory!
    Victory();
    // END LM_JORM

	game.autosaved = false;

	// respawn any dead clients
	//bat
	//Too Many overflows!!!!!
	//for (i=0 ; i<maxclients->value ; i++)
	//{
	//	client = g_edicts + 1 + i;
	//	if (!client->inuse)
	//		continue;
	//	if (client->health <= 0)
	//	respawn(client);
	//}

	level.intermissiontime = level.time;
	level.changemap = targ->map;


	if (strstr(level.changemap, "*"))
	{
		if (coop->value)
		{
			for (i=0 ; i<maxclients->value ; i++)
			{
				client = g_edicts + 1 + i;
				if (!client->inuse)
					continue;
				// strip players of all keys between units
				for (n = 0; n < MAX_ITEMS; n++)
				{
					if (itemlist[n].flags & IT_KEY)
						client->client->pers.inventory[n] = 0;
				}
			}
		}
	}
	else
	{
		if (!deathmatch->value)
		{
			level.exitintermission = 1;		// go immediately to the next level
			return;
		}
	}

	level.exitintermission = 0;

	// find an intermission spot
	ent = G_Find (NULL, FOFS(classname), "info_player_intermission");
	if (!ent)
	{	// the map creator forgot to put in an intermission point...
		ent = G_Find (NULL, FOFS(classname), "info_player_start");
		if (!ent)
			ent = G_Find (NULL, FOFS(classname), "info_player_deathmatch");
	}
	else
	{	// chose one of four spots
		i = rand() & 3;
		while (i--)
		{
			ent = G_Find (ent, FOFS(classname), "info_player_intermission");
			if (!ent)	// wrap around the list
				ent = G_Find (ent, FOFS(classname), "info_player_intermission");
		}
	}

	VectorCopy (ent->s.origin, level.intermission_origin);
	VectorCopy (ent->s.angles, level.intermission_angle);


	// move all clients to the intermission point
	for (i=0 ; i<maxclients->value ; i++)
	{
		client = g_edicts + 1 + i;
		if (!client->inuse)
			continue;
		MoveClientToIntermission (client);
	}

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq 0x2258a(%rip), %r15     # 0x66da0
movss 0xc8(%r15), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x44829
jnp 0x44834
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, %rbx
movq 0x21f6a(%rip), %rax     # 0x667a8
movl $0x1, (%rax)
xorl %eax, %eax
callq 0x196e0
movq 0x224ee(%rip), %rax     # 0x66d40
andl $0x0, 0x620(%rax)
movss 0x4(%r15), %xmm0
movss %xmm0, 0xc8(%r15)
movq 0x270(%rbx), %rdi
movq %rdi, 0xd0(%r15)
pushq $0x2a
popq %rsi
callq 0x18780
testq %rax, %rax
je 0x4491b
movq 0x226d2(%rip), %rax     # 0x66f60
movq (%rax), %rax
movss 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x448a4
jnp 0x44938
movq 0x21c85(%rip), %rax     # 0x66530
movq (%rax), %rcx
movq 0x21ca3(%rip), %rdx     # 0x66558
movl $0x4a8, %eax            # imm = 0x4A8
addq (%rdx), %rax
movss 0x20(%rcx), %xmm0
xorl %ecx, %ecx
movq 0x22575(%rip), %rdx     # 0x66e40
addq $0x68, %rdx
cvtsi2ss %ecx, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x44938
imulq $0x4a8, %rcx, %rsi      # imm = 0x4A8
cmpl $0x0, 0x60(%rax,%rsi)
je 0x44916
addq %rax, %rsi
movq %rdx, %rdi
xorl %r8d, %r8d
cmpq $0x100, %r8             # imm = 0x100
je 0x44916
testb $0x10, (%rdi)
je 0x4490a
movq 0x58(%rsi), %r9
andl $0x0, 0x318(%r9,%r8,4)
incq %r8
addq $0x88, %rdi
jmp 0x448ef
incq %rcx
jmp 0x448cf
movq 0x2259e(%rip), %rax     # 0x66ec0
movq (%rax), %rax
movss 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x44938
jnp 0x44a6e
andl $0x0, 0xd8(%r15)
leaq 0xf81e(%rip), %rdx      # 0x54165
xorl %edi, %edi
movl $0x138, %esi            # imm = 0x138
callq 0x195e0
testq %rax, %rax
je 0x4499d
movq %rax, %rbx
callq 0x19bf0
movl %eax, %ebp
andl $0x3, %ebp
leaq 0xf7f9(%rip), %r14      # 0x54165
subl $0x1, %ebp
jb 0x449ce
movq %rbx, %rdi
movl $0x138, %esi            # imm = 0x138
movq %r14, %rdx
callq 0x195e0
movq %rax, %rbx
testq %rax, %rax
jne 0x4496c
xorl %edi, %edi
movl $0x138, %esi            # imm = 0x138
movq %r14, %rdx
callq 0x195e0
movq %rax, %rbx
jmp 0x4496c
leaq 0xabb5(%rip), %rdx      # 0x4f559
xorl %edi, %edi
movl $0x138, %esi            # imm = 0x138
callq 0x195e0
movq %rax, %rbx
testq %rax, %rax
jne 0x449ce
leaq 0xab83(%rip), %rdx      # 0x4f542
xorl %edi, %edi
movl $0x138, %esi            # imm = 0x138
callq 0x195e0
movq %rax, %rbx
movss 0x4(%rbx), %xmm0
movss %xmm0, 0xdc(%r15)
movss 0x8(%rbx), %xmm0
movss %xmm0, 0xe0(%r15)
movss 0xc(%rbx), %xmm0
movss %xmm0, 0xe4(%r15)
movss 0x10(%rbx), %xmm0
movss %xmm0, 0xe8(%r15)
movss 0x14(%rbx), %xmm0
movss %xmm0, 0xec(%r15)
movss 0x18(%rbx), %xmm0
movss %xmm0, 0xf0(%r15)
movq 0x21b07(%rip), %rbx     # 0x66530
movq (%rbx), %rax
movl $0x4a8, %r14d           # imm = 0x4A8
xorl %ebp, %ebp
movq 0x21b1d(%rip), %r15     # 0x66558
cvtsi2ss %ebp, %xmm0
movss 0x20(%rax), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x44829
movq (%r15), %rdi
cmpl $0x0, 0x60(%rdi,%r14)
je 0x44a63
addq %r14, %rdi
callq 0x19250
movq (%rbx), %rax
addq $0x4a8, %r14            # imm = 0x4A8
incl %ebp
jmp 0x44a3b
movl $0x1, 0xd8(%r15)
jmp 0x44829