// File: /workspace/github_c_makefile_star2_O2/QwazyWabbitWOS[P]lmctf60/g_main.c
// Function: G_RunFrame
void G_RunFrame (void)
{
	int		i;
	edict_t	*ent;

	// CTF CODE -- LM_JORM
	int			score;
	edict_t		*cl_ent;

	// Paril
	if (GamePaused())
	{
		ClientEndServerFrames();
		return;
	}
	// Paril

	bluescore = 0; 
	redscore = 0;  

	if ((int)(skinset->value) > 3)
		gi.cvar_set("skinset", va("%d", 3));

	for (i=0 ; i<game.maxclients ; i++)
	{
		cl_ent = g_edicts + 1 + i;
		if (!cl_ent->inuse)
			continue;
		score = stats_get(cl_ent, STATS_SCORE);

		if (cl_ent->client->ctf.teamnum == CTF_TEAM_RED) // RED TEAM
		{
			redscore += score;
		}
		else if (cl_ent->client->ctf.teamnum == CTF_TEAM_BLUE) // BLUE TEAM
		{
			bluescore += score;
		}
	}
	// END CTF CODE -- LM_JORM


	level.framenum++;
	level.time = level.framenum*FRAMETIME;

	// choose a client for monsters to target this frame
	//no monsters
	//bat
#ifdef MONSTERS_OK
	AI_SetSightClient ();
#endif

	// exit intermissions

	if (level.exitintermission)
	{
		ExitLevel ();
		return;
	}

	//
	// treat each object in turn
	// even the world gets a chance to think
	//
	ent = &g_edicts[0];
	for (i=0 ; i<globals.num_edicts ; i++, ent++)
	{
		if (!ent->inuse)
			continue;

		level.current_entity = ent;

		VectorCopy (ent->s.origin, ent->s.old_origin);

		// if the ground entity moved, make sure we are still on it
		if ((ent->groundentity) && (ent->groundentity->linkcount != ent->groundentity_linkcount))
		{
			ent->groundentity = NULL;
#ifdef MONSTERS_OK
			if ( !(ent->flags & (FL_SWIM|FL_FLY)) && (ent->svflags & SVF_MONSTER) )
			{
				M_CheckGround (ent);
			}
#endif
		}

		if (i > 0 && i <= maxclients->value)
		{
			ClientBeginServerFrame (ent);
			continue;
		}

		G_RunEntity (ent);
	}

	// see if it is time to end a deathmatch
	CheckDMRules ();

	// build the playerstate_t structures for all players
	ClientEndServerFrames ();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
xorl %eax, %eax
callq 0x18160
testl %eax, %eax
je 0x2f684
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x190c0
movq 0x373bd(%rip), %rax     # 0x66a48
andl $0x0, (%rax)
movq 0x37543(%rip), %rax     # 0x66bd8
andl $0x0, (%rax)
movq 0x37259(%rip), %rax     # 0x668f8
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
cmpl $0x4, %eax
jl 0x2f6d7
movq 0x36f4d(%rip), %rax     # 0x66600
movq 0x128(%rax), %rbx
leaq 0x1f1c5(%rip), %rdi     # 0x4e886
pushq $0x3
popq %rsi
xorl %eax, %eax
callq 0x194e0
leaq 0x23c30(%rip), %rdi     # 0x53302
movq %rax, %rsi
callq *%rbx
movq 0x37662(%rip), %r13     # 0x66d40
movl 0x610(%r13), %ecx
movl $0x4a8, %ebp            # imm = 0x4A8
xorl %r14d, %r14d
movq 0x36e64(%rip), %r12     # 0x66558
pushq $0x3
popq %rbx
movslq %ecx, %rax
cmpq %rax, %r14
jge 0x2f74e
movq (%r12), %r15
cmpl $0x0, 0x60(%r15,%rbp)
je 0x2f742
leaq (%r15,%rbp), %rdi
movl %ebx, %esi
callq 0x18030
movq 0x58(%r15,%rbp), %rcx
movl 0x1100(%rcx), %edx
movl 0x610(%r13), %ecx
movq 0x374a9(%rip), %rsi     # 0x66bd8
cmpl $0x1, %edx
je 0x2f740
cmpl $0x2, %edx
jne 0x2f742
movq 0x37308(%rip), %rsi     # 0x66a48
addl %eax, (%rsi)
incq %r14
addq $0x4a8, %rbp            # imm = 0x4A8
jmp 0x2f6f7
movq 0x3764b(%rip), %r14     # 0x66da0
movl (%r14), %eax
incl %eax
cvtsi2ss %eax, %xmm0
mulss 0x1fb2a(%rip), %xmm0    # 0x4f290
movl %eax, (%r14)
movss %xmm0, 0x4(%r14)
cmpl $0x0, 0xd8(%r14)
je 0x2f78c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x19360
movq (%r12), %rbx
xorl %ebp, %ebp
movq 0x3736f(%rip), %r15     # 0x66b08
movq 0x36d90(%rip), %r12     # 0x66530
cmpl 0x8c(%r15), %ebp
jge 0x2f81c
cmpl $0x0, 0x60(%rbx)
je 0x2f811
movq %rbx, 0x148(%r14)
movsd 0x4(%rbx), %xmm0
movsd %xmm0, 0x1c(%rbx)
movss 0xc(%rbx), %xmm0
movss %xmm0, 0x24(%rbx)
movq 0x2b8(%rbx), %rax
testq %rax, %rax
je 0x2f7e9
movl 0x64(%rax), %eax
cmpl 0x2c0(%rbx), %eax
je 0x2f7e9
andq $0x0, 0x2b8(%rbx)
testl %ebp, %ebp
je 0x2f7ff
cvtsi2ss %ebp, %xmm0
movq (%r12), %rax
movss 0x20(%rax), %xmm1
ucomiss %xmm0, %xmm1
jae 0x2f809
movq %rbx, %rdi
callq 0x18cf0
jmp 0x2f811
movq %rbx, %rdi
callq 0x191b0
incl %ebp
addq $0x4a8, %rbx            # imm = 0x4A8
jmp 0x2f7a0
callq 0x18820
jmp 0x2f671