// File: /workspace/github_c_makefile_star2_O1/QwazyWabbitWOS[P]lmctf60/g_main.c
// Function: CheckDMRules
void CheckDMRules (void)
{
	int			i;
	//gclient_t	*cl;
	edict_t		*ent, *player;

	if (level.intermissiontime)
		return;

	if (!deathmatch->value)
		return;


	if(matchstate == MATCH_RAILGUN_OVER)
	{
		EndDMLevel();
		return;
	}


	//maplist support stuff
	if (maplistindex == -1) // First time through the list
	{
		gi.dprintf ("Using Maplist.\n");
		if (!strcmp(maplist[0].mapname, level.mapname))
		{
			maplistindex = 1;
			return;
		}
		else
		{
			MapInfo *firstmap = &maplist[0];
			ent = G_Spawn ();
			ent->classname = "target_changelevel";
	                if((int)ctfflags->value & CTF_RANDOM_MAPS)
                	        firstmap = getRandomMapByPlayerCount(playerCount());
			ent->map = firstmap->mapname;
			maplistindex = 1;
			level.changemap = ent->map;
			level.exitintermission = 1;
                        gi.dprintf("Startup Map :  %s\n",  firstmap->mapname);
			return;
		}
	}
	
	if (timelimit->value && !Match_Mode()) // Don't end a map if a Match is in play
	{
		for (i=0 ; i<maxclients->value ; i++)
		{
			player = g_edicts + 1 + i;
			if (!player->inuse)
				continue;

			//seconds
			if(level.time >= (timelimit->value - 1)*60)
				Time_Left = (timelimit->value*60) - level.time;
			else
				Time_Left = timelimit->value - (level.time/60) + 1;
		}

		if (level.time >= timelimit->value*60)
		{
			ctf_BSafePrint(PRINT_HIGH, "Timelimit hit.\n");
			EndDMLevel ();
			return;
		}
	}

	if (fraglimit->value && !Match_Mode()) // Don't end a map if a match is in play
	{
		
		for (i=0 ; i<maxclients->value ; i++)
		{
			player = g_edicts + 1 + i;
			if (!player->inuse)
				continue;

			if (stats_get(player, STATS_SCORE) >= fraglimit->value)
			{
				ctf_BSafePrint(PRINT_HIGH, "Fraglimit hit.\n");
				EndDMLevel ();
				return;
			}
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x36ba0(%rip), %r15     # 0x69da0
movss 0xc8(%r15), %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm1
jne 0x33213
jnp 0x33222
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x36c97(%rip), %rax     # 0x69ec0
movq (%rax), %rax
movss 0x20(%rax), %xmm1
ucomiss %xmm0, %xmm1
jne 0x33238
jnp 0x33213
movq 0x36599(%rip), %rax     # 0x697d8
cmpl $0x7, (%rax)
jne 0x33257
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x188c0
movq 0x36b7a(%rip), %r12     # 0x69dd8
cmpl $-0x1, (%r12)
je 0x33429
movq 0x36440(%rip), %rbx     # 0x696b0
movq (%rbx), %rax
movss 0x20(%rax), %xmm0
xorps %xmm10, %xmm10
ucomiss %xmm10, %xmm0
jne 0x33288
jnp 0x33382
xorl %eax, %eax
callq 0x19110
xorps %xmm10, %xmm10
testl %eax, %eax
jne 0x33382
movq 0x3628e(%rip), %rax     # 0x69530
movq (%rax), %rax
movss 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x33363
movq 0x3629b(%rip), %rdx     # 0x69558
movss 0x4(%r15), %xmm1
movq (%rbx), %rax
movaps 0x23943(%rip), %xmm2    # 0x56c10
xorps %xmm1, %xmm2
movaps %xmm1, %xmm3
divss 0x23921(%rip), %xmm3    # 0x56bfc
movl $0x508, %ecx            # imm = 0x508
addq (%rdx), %rcx
movl $0x1, %edx
movss 0x23910(%rip), %xmm4    # 0x56c00
movss 0x23904(%rip), %xmm5    # 0x56bfc
movss 0x20c28(%rip), %xmm6    # 0x53f28
movq 0x368f9(%rip), %rsi     # 0x69c00
cmpl $0x0, (%rcx)
je 0x3334e
movss 0x20(%rax), %xmm7
movaps %xmm7, %xmm8
addss %xmm4, %xmm8
mulss %xmm5, %xmm8
movaps %xmm7, %xmm9
mulss %xmm5, %xmm9
addss %xmm2, %xmm9
subss %xmm3, %xmm7
addss %xmm6, %xmm7
cmpnless %xmm1, %xmm8
andps %xmm8, %xmm7
andnps %xmm9, %xmm8
orps %xmm7, %xmm8
cvttss2si %xmm8, %edi
movl %edi, (%rsi)
xorps %xmm7, %xmm7
cvtsi2ss %edx, %xmm7
addq $0x4a8, %rcx            # imm = 0x4A8
incl %edx
ucomiss %xmm7, %xmm0
ja 0x33307
movss 0x4(%r15), %xmm0
movq (%rbx), %rax
movss 0x20(%rax), %xmm1
mulss 0x23883(%rip), %xmm1    # 0x56bfc
ucomiss %xmm1, %xmm0
jae 0x334d9
movq 0x36a77(%rip), %rbx     # 0x69e00
movq (%rbx), %rax
movss 0x20(%rax), %xmm0
ucomiss %xmm10, %xmm0
jne 0x3339d
jnp 0x33213
xorl %eax, %eax
callq 0x19110
testl %eax, %eax
jne 0x33213
movq 0x3617d(%rip), %r14     # 0x69530
movq (%r14), %rax
movss 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x33213
movl $0x4a8, %r15d           # imm = 0x4A8
movl $0x1, %ebp
movq 0x3617f(%rip), %r12     # 0x69558
movq (%r12), %rdi
cmpl $0x0, 0x60(%rdi,%r15)
je 0x33407
addq %r15, %rdi
movl $0x3, %esi
callq 0x18030
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
movq (%rbx), %rax
ucomiss 0x20(%rax), %xmm0
jae 0x334e2
xorps %xmm0, %xmm0
cvtsi2ss %ebp, %xmm0
movq (%r14), %rax
movss 0x20(%rax), %xmm1
addq $0x4a8, %r15            # imm = 0x4A8
incl %ebp
ucomiss %xmm0, %xmm1
ja 0x333d9
jmp 0x33213
movq 0x361d0(%rip), %r13     # 0x69600
leaq 0x24daf(%rip), %rdi     # 0x581e6
xorl %eax, %eax
callq *0x8(%r13)
movq 0x36384(%rip), %rbx     # 0x697c8
movq (%rbx), %rdi
leaq 0x48(%r15), %rsi
callq 0x18b20
testl %eax, %eax
je 0x334cc
callq 0x19710
movq %rax, %r14
leaq 0x210ef(%rip), %rax     # 0x54552
movq %rax, 0x138(%r14)
movq 0x366e7(%rip), %rax     # 0x69b58
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
btl $0xc, %eax
jae 0x3348e
callq 0x19440
movl %eax, %edi
callq 0x186b0
movq %rax, %rbx
movq (%rbx), %rsi
movq %rsi, 0x270(%r14)
movl $0x1, %eax
movl %eax, (%r12)
movq %rsi, 0xd0(%r15)
movl %eax, 0xd8(%r15)
movq 0x8(%r13), %rcx
leaq 0x24d3c(%rip), %rdi     # 0x581f6
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rcx
movl $0x1, (%r12)
jmp 0x33213
leaq 0x24d29(%rip), %rsi     # 0x58209
jmp 0x334e9
leaq 0x24d30(%rip), %rsi     # 0x58219
movl $0x2, %edi
callq 0x19270
jmp 0x33244