// File: /workspace/github_c_makefile_star2_O3/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 0x3610b(%rip), %r15     # 0x68da0
movss 0xc8(%r15), %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm1
jne 0x32ca8
jnp 0x32cb7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x36202(%rip), %rax     # 0x68ec0
movq (%rax), %rax
movss 0x20(%rax), %xmm1
ucomiss %xmm0, %xmm1
jne 0x32ccd
jnp 0x32ca8
movq 0x35b04(%rip), %rax     # 0x687d8
cmpl $0x7, (%rax)
jne 0x32cec
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x188c0
movq 0x360e5(%rip), %r12     # 0x68dd8
cmpl $-0x1, (%r12)
je 0x32eb7
movq 0x359ab(%rip), %rbx     # 0x686b0
movq (%rbx), %rax
movss 0x20(%rax), %xmm0
xorps %xmm10, %xmm10
ucomiss %xmm10, %xmm0
jne 0x32d1d
jnp 0x32e0e
xorl %eax, %eax
callq 0x19110
xorps %xmm10, %xmm10
testl %eax, %eax
jne 0x32e0e
movq 0x357f9(%rip), %rax     # 0x68530
movq (%rax), %rax
movss 0x20(%rax), %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm1
movss 0x4(%r15), %xmm0
movq (%rbx), %rax
jbe 0x32df8
movq 0x357fd(%rip), %rdx     # 0x68558
movaps 0x22f6e(%rip), %xmm2    # 0x55cd0
xorps %xmm0, %xmm2
movaps %xmm0, %xmm3
divss 0x244c4(%rip), %xmm3    # 0x57234
movl $0x508, %ecx            # imm = 0x508
addq (%rdx), %rcx
movl $0x1, %edx
movss 0x22ecf(%rip), %xmm4    # 0x55c54
movss 0x244a7(%rip), %xmm5    # 0x57234
movss 0x20193(%rip), %xmm6    # 0x52f28
movq 0x35e64(%rip), %rsi     # 0x68c00
cmpl $0x0, (%rcx)
je 0x32de3
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 %xmm0, %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, %xmm1
ja 0x32d9c
movss 0x20(%rax), %xmm1
mulss 0x2442f(%rip), %xmm1    # 0x57234
ucomiss %xmm1, %xmm0
jae 0x32f67
movq 0x35feb(%rip), %rbx     # 0x68e00
movq (%rbx), %rax
movss 0x20(%rax), %xmm0
ucomiss %xmm10, %xmm0
jne 0x32e29
jnp 0x32ca8
xorl %eax, %eax
callq 0x19110
testl %eax, %eax
jne 0x32ca8
movq 0x356f1(%rip), %r14     # 0x68530
movq (%r14), %rax
movss 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x32ca8
movq 0x356fe(%rip), %r15     # 0x68558
movq (%r15), %rdi
movl $0x4a8, %r12d           # imm = 0x4A8
movl $0x1, %ebp
cmpl $0x0, 0x60(%rdi,%r12)
je 0x32e98
addq %r12, %rdi
movl $0x3, %esi
callq 0x18030
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
movq (%rbx), %rax
ucomiss 0x20(%rax), %xmm0
jae 0x32f70
movq (%r15), %rdi
movq (%r14), %rax
xorps %xmm0, %xmm0
cvtsi2ss %ebp, %xmm0
movss 0x20(%rax), %xmm1
addq $0x4a8, %r12            # imm = 0x4A8
incl %ebp
ucomiss %xmm0, %xmm1
ja 0x32e68
jmp 0x32ca8
movq 0x35742(%rip), %r13     # 0x68600
leaq 0x2441a(%rip), %rdi     # 0x572df
xorl %eax, %eax
callq *0x8(%r13)
movq 0x358f6(%rip), %rbx     # 0x687c8
movq (%rbx), %rdi
leaq 0x48(%r15), %rsi
callq 0x18b20
testl %eax, %eax
je 0x32f5a
callq 0x19700
movq %rax, %r14
leaq 0x20691(%rip), %rax     # 0x53582
movq %rax, 0x138(%r14)
movq 0x35c59(%rip), %rax     # 0x68b58
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
btl $0xc, %eax
jae 0x32f1c
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 0x243a7(%rip), %rdi     # 0x572ef
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rcx
movl $0x1, (%r12)
jmp 0x32ca8
leaq 0x24394(%rip), %rsi     # 0x57302
jmp 0x32f77
leaq 0x2439b(%rip), %rsi     # 0x57312
movl $0x2, %edi
callq 0x19270
jmp 0x32cd9