// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movq 0x44311(%rip), %rax     # 0x82da0
movss 0xc8(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x3eaa3
jp 0x3eaa3
jmp 0x3eaa8
jmp 0x3ee4e
movq 0x44411(%rip), %rax     # 0x82ec0
movq (%rax), %rax
movss 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x3eac6
jp 0x3eac6
jmp 0x3ee4e
movq 0x43d0b(%rip), %rax     # 0x827d8
cmpl $0x7, (%rax)
jne 0x3eadc
callq 0x18940
jmp 0x3ee4e
movq 0x442f5(%rip), %rax     # 0x82dd8
cmpl $-0x1, (%rax)
jne 0x3ebea
leaq 0x3567b(%rip), %rdi     # 0x7416e
movq 0x43b06(%rip), %rcx     # 0x82600
movb $0x0, %al
callq *0x8(%rcx)
movq 0x43cc2(%rip), %rax     # 0x827c8
movq (%rax), %rdi
movq 0x44290(%rip), %rsi     # 0x82da0
addq $0x48, %rsi
callq 0x18bf0
cmpl $0x0, %eax
jne 0x3eb30
movq 0x442b3(%rip), %rax     # 0x82dd8
movl $0x1, (%rax)
jmp 0x3ee4e
movq 0x43c91(%rip), %rax     # 0x827c8
movq %rax, -0x20(%rbp)
callq 0x19950
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0x31a13(%rip), %rcx     # 0x70562
movq %rcx, 0x138(%rax)
movq 0x43ffb(%rip), %rax     # 0x82b58
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
je 0x3eb7f
callq 0x19670
movl %eax, %edi
callq 0x18710
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x270(%rax)
movq 0x44240(%rip), %rax     # 0x82dd8
movl $0x1, (%rax)
movq -0x10(%rbp), %rax
movq 0x270(%rax), %rcx
movq 0x441f0(%rip), %rax     # 0x82da0
movq %rcx, 0xd0(%rax)
movq 0x441e2(%rip), %rax     # 0x82da0
movl $0x1, 0xd8(%rax)
movq 0x43a31(%rip), %rax     # 0x82600
movq 0x8(%rax), %rcx
movq -0x20(%rbp), %rax
movq (%rax), %rsi
leaq 0x3559d(%rip), %rdi     # 0x7417e
movb $0x0, %al
callq *%rcx
jmp 0x3ee4e
movq 0x43abf(%rip), %rax     # 0x826b0
movq (%rax), %rax
movss 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x3ec08
jp 0x3ec08
jmp 0x3ed85
movb $0x0, %al
callq 0x192e0
cmpl $0x0, %eax
jne 0x3ed85
movl $0x0, -0x4(%rbp)
cvtsi2ssl -0x4(%rbp), %xmm1
movq 0x43905(%rip), %rax     # 0x82530
movq (%rax), %rax
movss 0x20(%rax), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x3ed40
movq 0x43915(%rip), %rax     # 0x82558
movq (%rax), %rax
addq $0x4a8, %rax            # imm = 0x4A8
movslq -0x4(%rbp), %rcx
imulq $0x4a8, %rcx, %rcx      # imm = 0x4A8
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x60(%rax)
jne 0x3ec6d
jmp 0x3ed32
movq 0x4412c(%rip), %rax     # 0x82da0
movss 0x4(%rax), %xmm0
movq 0x43a30(%rip), %rax     # 0x826b0
movq (%rax), %rax
movss 0x20(%rax), %xmm1
movss 0x3125c(%rip), %xmm2    # 0x6feec
subss %xmm2, %xmm1
movss 0x33ee8(%rip), %xmm2    # 0x72b84
mulss %xmm2, %xmm1
ucomiss %xmm1, %xmm0
jb 0x3ecec
movq 0x43a04(%rip), %rax     # 0x826b0
movq (%rax), %rax
movss 0x20(%rax), %xmm0
movq 0x440e5(%rip), %rax     # 0x82da0
movss 0x4(%rax), %xmm1
movd %xmm1, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm1
movss 0x33eaf(%rip), %xmm2    # 0x72b84
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
cvttss2si %xmm0, %ecx
movq 0x43f18(%rip), %rax     # 0x82c00
movl %ecx, (%rax)
jmp 0x3ed30
movq 0x439bd(%rip), %rax     # 0x826b0
movq (%rax), %rax
movss 0x20(%rax), %xmm0
movq 0x4409e(%rip), %rax     # 0x82da0
movss 0x4(%rax), %xmm1
movss 0x33e75(%rip), %xmm2    # 0x72b84
divss %xmm2, %xmm1
subss %xmm1, %xmm0
movss 0x311cd(%rip), %xmm1    # 0x6feec
addss %xmm1, %xmm0
cvttss2si %xmm0, %ecx
movq 0x43ed2(%rip), %rax     # 0x82c00
movl %ecx, (%rax)
jmp 0x3ed32
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x3ec1f
movq 0x44059(%rip), %rax     # 0x82da0
movss 0x4(%rax), %xmm0
movq 0x4395d(%rip), %rax     # 0x826b0
movq (%rax), %rax
movss 0x33e26(%rip), %xmm1    # 0x72b84
mulss 0x20(%rax), %xmm1
ucomiss %xmm1, %xmm0
jb 0x3ed83
movl $0x2, %edi
leaq 0x3541d(%rip), %rsi     # 0x74191
callq 0x19470
callq 0x18940
jmp 0x3ee4e
jmp 0x3ed85
movq 0x44074(%rip), %rax     # 0x82e00
movq (%rax), %rax
movss 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x3eda3
jp 0x3eda3
jmp 0x3ee4e
movb $0x0, %al
callq 0x192e0
cmpl $0x0, %eax
jne 0x3ee4e
movl $0x0, -0x4(%rbp)
cvtsi2ssl -0x4(%rbp), %xmm1
movq 0x4376a(%rip), %rax     # 0x82530
movq (%rax), %rax
movss 0x20(%rax), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x3ee4c
movq 0x4377e(%rip), %rax     # 0x82558
movq (%rax), %rax
addq $0x4a8, %rax            # imm = 0x4A8
movslq -0x4(%rbp), %rcx
imulq $0x4a8, %rcx, %rcx      # imm = 0x4A8
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x60(%rax)
jne 0x3ee01
jmp 0x3ee3e
movq -0x18(%rbp), %rdi
movl $0x3, %esi
callq 0x18030
cvtsi2ss %rax, %xmm0
movq 0x43fe5(%rip), %rax     # 0x82e00
movq (%rax), %rax
ucomiss 0x20(%rax), %xmm0
jb 0x3ee3c
movl $0x2, %edi
leaq 0x35371(%rip), %rsi     # 0x741a1
callq 0x19470
callq 0x18940
jmp 0x3ee4e
jmp 0x3ee3e
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x3edba
jmp 0x3ee4e
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)