// File: /workspace/github_c_makefile_star2_O3/QwazyWabbitWOS[P]lmctf60/p_stats.c
// Function: stats_output
void stats_output(edict_t *ent, stats_player_s *p_player)
{
	int total_encounters;
	char teambuf[MAX_INFO_STRING];
	char *conbuf;
	char outbuf[MAX_INFO_STRING];
	char tmpbuf[MAX_INFO_STRING];

	strcpy(teambuf,"");
	ctf_teamstring(teambuf, p_player->info.teamnum, CTF_TEAM_MATCHING);

	if (p_player->dropped)
		conbuf = "quit";
	else
		conbuf = "active";

	
	
	total_encounters = p_player->stats[STATS_FRAGS] + p_player->stats[STATS_DEATHS];

	strcpy(outbuf,"");


	Com_sprintf (tmpbuf, sizeof tmpbuf, "\n(%s) [%s] %s\n", teambuf, conbuf, p_player->info.name);
	strcat(outbuf,tmpbuf);

	sprintf (tmpbuf,
					"Score=%ld "
					"Frags=%ld "
					"Deaths=%ld "
					"Eff=%ld%%\n",
					p_player->stats[STATS_SCORE], p_player->stats[STATS_FRAGS], p_player->stats[STATS_DEATHS],
					total_encounters == 0 ? 0 : 100 * p_player->stats[STATS_FRAGS] / total_encounters);
	strcat(outbuf,tmpbuf);

	sprintf (tmpbuf, "Def Base=%ld Def Flag=%ld Def Carrier=%ld\nGot Flag=%ld Lost Flag=%ld Captures=%ld\n", 
				p_player->stats[STATS_DEFENSE_BASE],
				p_player->stats[STATS_DEFENSE_FLAG],
				p_player->stats[STATS_DEFENSE_CARRIER],
				p_player->stats[STATS_OFFENSE_FLAG],
				p_player->stats[STATS_OFFENSE_FLAGLOST],
				p_player->stats[STATS_CAPTURES]);
	strcat(outbuf,tmpbuf);

	sprintf (tmpbuf, "Kill Carrier=%ld Flag Returns=%ld Assists=%ld\nAverage Ping=%ld Samples=%ld\n",
					p_player->stats[STATS_OFFENSE_CARRIER],
					p_player->stats[STATS_RETURNS],
					p_player->stats[STATS_ASSISTS],
					p_player->stats[STATS_PING_TOTAL] / (p_player->stats[STATS_PING_SAMPLES] > 0 ? p_player->stats[STATS_PING_SAMPLES] : 1),
					p_player->stats[STATS_PING_SAMPLES]);
	strcat(outbuf,tmpbuf);
	ctf_SafePrint(ent, PRINT_HIGH, outbuf);

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x618, %rsp            # imm = 0x618
movq %rsi, %r14
movq %rdi, 0x8(%rsp)
xorl %r12d, %r12d
leaq 0x410(%rsp), %r15
movb %r12b, (%r15)
leaq 0x4(%rsi), %r13
movl 0x204(%rsi), %esi
movq %r15, %rdi
movl $0xfffffff9, %edx       # imm = 0xFFFFFFF9
callq 0x181f0
cmpl $0x0, (%r14)
leaq 0x2d2be(%rip), %rax     # 0x52613
leaq 0x2ea8a(%rip), %r8      # 0x53de6
cmoveq %rax, %r8
movq 0x238(%r14), %rbp
addq 0x230(%r14), %rbp
leaq 0x10(%rsp), %rax
movb %r12b, (%rax)
leaq 0x2ea6e(%rip), %rdx     # 0x53deb
leaq 0x210(%rsp), %rbx
movq %rbx, %rdi
movl $0x200, %esi            # imm = 0x200
movq %r15, %rcx
movq %r13, %r9
xorl %eax, %eax
callq 0x18e10
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x19640
movq 0x220(%r14), %r9
movq 0x230(%r14), %rcx
movq 0x238(%r14), %r8
testl %ebp, %ebp
je 0x253cf
imulq $0x64, %rcx, %rax
movslq %ebp, %rsi
cqto
idivq %rsi
movq %rax, %r12
leaq 0x2ea24(%rip), %rsi     # 0x53dfa
leaq 0x210(%rsp), %r15
movq %r15, %rdi
movq %r9, %rdx
movq %r12, %r9
xorl %eax, %eax
callq 0x196f0
leaq 0x10(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x19640
movq 0x248(%r14), %rdx
movq 0x240(%r14), %rcx
movq 0x250(%r14), %r8
movq 0x268(%r14), %r9
leaq 0x2ea03(%rip), %rsi     # 0x53e24
movq %r15, %rdi
xorl %eax, %eax
pushq 0x228(%r14)
pushq 0x278(%r14)
callq 0x196f0
addq $0x10, %rsp
movq %r12, %rdi
movq %r15, %rsi
callq 0x19640
movq 0x270(%r14), %r9
movq 0x260(%r14), %rcx
movq 0x258(%r14), %r8
movq 0x208(%r14), %rax
movq 0x210(%r14), %r10
cmpq $0x2, %r10
movl $0x1, %esi
cmovgeq %r10, %rsi
cqto
idivq %rsi
subq $0x8, %rsp
leaq 0x2e9ef(%rip), %rsi     # 0x53e77
movq %r15, %rdi
movq %r9, %rdx
movq %rax, %r9
xorl %eax, %eax
pushq %r10
callq 0x196f0
addq $0x10, %rsp
movq %r12, %rdi
movq %r15, %rsi
callq 0x19640
movl $0x2, %esi
movq 0x8(%rsp), %rdi
movq %r12, %rdx
callq 0x18da0
addq $0x618, %rsp            # imm = 0x618
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq