// File: /workspace/github_c_makefile_star2_O1/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 %ebp, %ebp
xorl %eax, %eax
callq 0x18160
testl %eax, %eax
je 0x326a0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x18f90
movq 0x373a1(%rip), %rax     # 0x69a48
movl %ebp, (%rax)
movq 0x37528(%rip), %r14     # 0x69bd8
movl %ebp, (%r14)
movq 0x3723e(%rip), %rax     # 0x698f8
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
cmpl $0x4, %eax
jl 0x326f4
movq 0x36f32(%rip), %rax     # 0x69600
movq 0x128(%rax), %rbx
leaq 0x211aa(%rip), %rdi     # 0x53886
movl $0x3, %esi
xorl %eax, %eax
callq 0x19340
leaq 0x25b3a(%rip), %rdi     # 0x58229
movq %rax, %rsi
callq *%rbx
movq 0x37645(%rip), %r15     # 0x69d40
cmpl $0x0, 0x610(%r15)
jle 0x32766
movl $0x4a8, %r12d           # imm = 0x4A8
xorl %r13d, %r13d
movq 0x36e43(%rip), %rbp     # 0x69558
movq (%rbp), %rbx
cmpl $0x0, 0x60(%rbx,%r12)
je 0x32750
leaq (%rbx,%r12), %rdi
movl $0x3, %esi
callq 0x18030
movq 0x58(%rbx,%r12), %rcx
movl 0x1100(%rcx), %edx
movq %r14, %rcx
cmpl $0x1, %edx
je 0x3274e
cmpl $0x2, %edx
jne 0x32750
movq 0x372fa(%rip), %rcx     # 0x69a48
addl %eax, (%rcx)
incq %r13
movslq 0x610(%r15), %rax
addq $0x4a8, %r12            # imm = 0x4A8
cmpq %rax, %r13
jl 0x32715
movq 0x37633(%rip), %r14     # 0x69da0
movl (%r14), %eax
incl %eax
cvtsi2ss %eax, %xmm0
mulss 0x21b12(%rip), %xmm0    # 0x54290
movl %eax, (%r14)
movss %xmm0, 0x4(%r14)
cmpl $0x0, 0xd8(%r14)
je 0x327a4
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x191e0
movq 0x3735d(%rip), %r15     # 0x69b08
cmpl $0x0, 0x8c(%r15)
jle 0x3284a
movq 0x36d98(%rip), %rax     # 0x69558
movq (%rax), %rbx
xorl %ebp, %ebp
movq 0x36d64(%rip), %r12     # 0x69530
cmpl $0x0, 0x60(%rbx)
je 0x32838
movq %rbx, 0x148(%r14)
movss 0x4(%rbx), %xmm0
movss %xmm0, 0x1c(%rbx)
movq 0x8(%rbx), %rax
movq %rax, 0x20(%rbx)
movq 0x2b8(%rbx), %rax
testq %rax, %rax
je 0x3280d
movl 0x64(%rax), %eax
cmpl 0x2c0(%rbx), %eax
je 0x3280d
movq $0x0, 0x2b8(%rbx)
testl %ebp, %ebp
je 0x32826
xorps %xmm0, %xmm0
cvtsi2ss %ebp, %xmm0
movq (%r12), %rax
movss 0x20(%rax), %xmm1
ucomiss %xmm0, %xmm1
jae 0x32830
movq %rbx, %rdi
callq 0x18c10
jmp 0x32838
movq %rbx, %rdi
callq 0x19060
incl %ebp
addq $0x4a8, %rbx            # imm = 0x4A8
cmpl 0x8c(%r15), %ebp
jl 0x327cc
callq 0x187c0
jmp 0x3268d