// File: /workspace/github_c_makefile_star2_O2/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 0x36c5a(%rip), %r15     # 0x66da0
movss 0xc8(%r15), %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm1
jne 0x30159
jnp 0x30168
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x36d51(%rip), %rax     # 0x66ec0
movq (%rax), %rax
movss 0x20(%rax), %xmm1
ucomiss %xmm0, %xmm1
jne 0x3017e
jnp 0x30159
movq 0x36653(%rip), %rax     # 0x667d8
cmpl $0x7, (%rax)
jne 0x3019d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x18920
movq 0x36c34(%rip), %r12     # 0x66dd8
cmpl $-0x1, (%r12)
je 0x3029d
movq 0x364fa(%rip), %r14     # 0x666b0
movq (%r14), %rax
movss 0x20(%rax), %xmm0
xorps %xmm10, %xmm10
ucomiss %xmm10, %xmm0
jne 0x301ce
jnp 0x30358
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x19280
xorps %xmm10, %xmm10
testl %eax, %eax
jne 0x30358
movq 0x36346(%rip), %rax     # 0x66530
movq (%rax), %rax
movss 0x20(%rax), %xmm1
movq 0x3635f(%rip), %rdx     # 0x66558
movss 0x4(%r15), %xmm0
movq (%r14), %rax
movaps 0x21aa7(%rip), %xmm2    # 0x51cb0
movaps %xmm0, %xmm3
divss 0x23000(%rip), %xmm3    # 0x53214
xorps %xmm0, %xmm2
movl $0x508, %ecx            # imm = 0x508
addq (%rdx), %rcx
movss 0x21a0d(%rip), %xmm4    # 0x51c34
movss 0x22fe5(%rip), %xmm5    # 0x53214
movss 0x1ecf1(%rip), %xmm6    # 0x4ef28
movq 0x369c2(%rip), %rdx     # 0x66c00
cvtsi2ss %ebx, %xmm7
ucomiss %xmm7, %xmm1
jbe 0x30342
cmpl $0x0, (%rcx)
je 0x30292
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, %esi
movl %esi, (%rdx)
addq $0x4a8, %rcx            # imm = 0x4A8
incl %ebx
jmp 0x3023e
movq 0x3635c(%rip), %r13     # 0x66600
leaq 0x23014(%rip), %rdi     # 0x532bf
xorl %eax, %eax
callq *0x8(%r13)
movq 0x36510(%rip), %rbx     # 0x667c8
movq (%rbx), %rdi
leaq 0x48(%r15), %rsi
callq 0x18bc0
testl %eax, %eax
je 0x303e2
callq 0x198d0
movq %rax, %r14
leaq 0x1f2a7(%rip), %rax     # 0x4f582
movq %rax, 0x138(%r14)
movq 0x3686f(%rip), %rax     # 0x66b58
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
btl $0xc, %eax
jae 0x30306
callq 0x195f0
movl %eax, %edi
callq 0x186f0
movq %rax, %rbx
movq (%rbx), %rsi
movq %rsi, 0x270(%r14)
pushq $0x1
popq %rax
movl %eax, (%r12)
movq %rsi, 0xd0(%r15)
movl %eax, 0xd8(%r15)
movq 0x8(%r13), %rcx
leaq 0x22f9f(%rip), %rdi     # 0x532cf
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rcx
movss 0x20(%rax), %xmm1
mulss 0x22ec5(%rip), %xmm1    # 0x53214
ucomiss %xmm1, %xmm0
jae 0x303ef
movq 0x36aa1(%rip), %r14     # 0x66e00
movq (%r14), %rax
movss 0x20(%rax), %xmm0
ucomiss %xmm10, %xmm0
jne 0x30373
jnp 0x30159
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x19280
testl %eax, %eax
jne 0x30159
movq 0x361a5(%rip), %r15     # 0x66530
movq (%r15), %rax
movl $0x4a8, %r12d           # imm = 0x4A8
movq 0x361bd(%rip), %r13     # 0x66558
pushq $0x3
popq %rbx
cvtsi2ss %ebp, %xmm0
movss 0x20(%rax), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x30159
movq (%r13), %rdi
cmpl $0x0, 0x60(%rdi,%r12)
je 0x303d7
addq %r12, %rdi
movl %ebx, %esi
callq 0x18030
cvtsi2ss %rax, %xmm0
movq (%r14), %rax
ucomiss 0x20(%rax), %xmm0
jae 0x303f8
movq (%r15), %rax
addq $0x4a8, %r12            # imm = 0x4A8
incl %ebp
jmp 0x3039e
movl $0x1, (%r12)
jmp 0x30159
leaq 0x22eec(%rip), %rsi     # 0x532e2
jmp 0x303ff
leaq 0x22ef3(%rip), %rsi     # 0x532f2
pushq $0x2
popq %rdi
callq 0x193f0
jmp 0x3018a