// File: /workspace/github_c_makefile_star2_O3/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 %ebx, %ebx
xorl %eax, %eax
callq 0x18160
testl %eax, %eax
je 0x3212c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x18f90
movq 0x36915(%rip), %rax     # 0x68a48
movl %ebx, (%rax)
movq 0x36a9c(%rip), %r14     # 0x68bd8
movl %ebx, (%r14)
movq 0x367b2(%rip), %rax     # 0x688f8
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
cmpl $0x4, %eax
jl 0x32180
movq 0x364a6(%rip), %rax     # 0x68600
movq 0x128(%rax), %rbx
leaq 0x2071e(%rip), %rdi     # 0x52886
movl $0x3, %esi
xorl %eax, %eax
callq 0x19340
leaq 0x251a7(%rip), %rdi     # 0x57322
movq %rax, %rsi
callq *%rbx
movq 0x36bb9(%rip), %r15     # 0x68d40
cmpl $0x0, 0x610(%r15)
jle 0x321f7
movq 0x363c0(%rip), %r12     # 0x68558
movq (%r12), %rbp
movl $0x4a8, %r13d           # imm = 0x4A8
xorl %ebx, %ebx
cmpl $0x0, 0x60(%rbp,%r13)
je 0x321e1
movq %rbp, %rdi
addq %r13, %rdi
movl $0x3, %esi
callq 0x18030
movq 0x58(%rbp,%r13), %rcx
movl 0x1100(%rcx), %ecx
movq (%r12), %rbp
movq %r14, %rdx
cmpl $0x1, %ecx
je 0x321df
cmpl $0x2, %ecx
jne 0x321e1
movq 0x36869(%rip), %rdx     # 0x68a48
addl %eax, (%rdx)
incq %rbx
movslq 0x610(%r15), %rax
addq $0x4a8, %r13            # imm = 0x4A8
cmpq %rax, %rbx
jl 0x321a4
movq 0x36ba2(%rip), %r14     # 0x68da0
movl (%r14), %eax
incl %eax
cvtsi2ss %eax, %xmm0
mulss 0x21081(%rip), %xmm0    # 0x53290
movl %eax, (%r14)
movss %xmm0, 0x4(%r14)
cmpl $0x0, 0xd8(%r14)
je 0x32235
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x191e0
movq 0x368cc(%rip), %r15     # 0x68b08
cmpl $0x0, 0x8c(%r15)
jle 0x322dd
movq 0x36307(%rip), %rax     # 0x68558
movq (%rax), %rbx
xorl %ebp, %ebp
movq 0x362d3(%rip), %r12     # 0x68530
cmpl $0x0, 0x60(%rbx)
je 0x322cb
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 0x322a0
movl 0x64(%rax), %eax
cmpl 0x2c0(%rbx), %eax
je 0x322a0
movq $0x0, 0x2b8(%rbx)
testl %ebp, %ebp
je 0x322b9
xorps %xmm0, %xmm0
cvtsi2ss %ebp, %xmm0
movq (%r12), %rax
movss 0x20(%rax), %xmm1
ucomiss %xmm0, %xmm1
jae 0x322c3
movq %rbx, %rdi
callq 0x18c10
jmp 0x322cb
movq %rbx, %rdi
callq 0x19060
incl %ebp
addq $0x4a8, %rbx            # imm = 0x4A8
cmpl 0x8c(%r15), %ebp
jl 0x3225d
callq 0x187c0
jmp 0x32119