// File: /workspace/github_c_makefile_star2_O2/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
pushq $-0x7
popq %rdx
movq %r15, %rdi
callq 0x18210
cmpl $0x0, (%r14)
leaq 0x2b1b2(%rip), %rax     # 0x4e613
leaq 0x2c97e(%rip), %r8      # 0x4fde6
cmoveq %rax, %r8
movq 0x238(%r14), %rbp
addq 0x230(%r14), %rbp
leaq 0x10(%rsp), %rax
movb %r12b, (%rax)
leaq 0x2c962(%rip), %rdx     # 0x4fdeb
leaq 0x210(%rsp), %rbx
movq %rbx, %rdi
movl $0x200, %esi            # imm = 0x200
movq %r15, %rcx
movq %r13, %r9
xorl %eax, %eax
callq 0x18f30
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x19800
movq 0x220(%r14), %r9
movq 0x230(%r14), %rcx
movq 0x238(%r14), %r8
testl %ebp, %ebp
je 0x234db
imulq $0x64, %rcx, %rax
movslq %ebp, %rsi
cqto
idivq %rsi
movq %rax, %r12
leaq 0x2c918(%rip), %rsi     # 0x4fdfa
leaq 0x210(%rsp), %r15
movq %r15, %rdi
movq %r9, %rdx
movq %r12, %r9
xorl %eax, %eax
callq 0x198c0
leaq 0x10(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x19800
movq 0x248(%r14), %rdx
movq 0x240(%r14), %rcx
movq 0x250(%r14), %r8
movq 0x268(%r14), %r9
leaq 0x2c8f7(%rip), %rsi     # 0x4fe24
movq %r15, %rdi
xorl %eax, %eax
pushq 0x228(%r14)
pushq 0x278(%r14)
callq 0x198c0
popq %rcx
popq %rdx
movq %r12, %rdi
movq %r15, %rsi
callq 0x19800
movq 0x270(%r14), %r9
movq 0x260(%r14), %rcx
movq 0x258(%r14), %r8
movq 0x208(%r14), %rax
movq 0x210(%r14), %r10
cmpq $0x2, %r10
pushq $0x1
popq %rsi
cmovgeq %r10, %rsi
cqto
idivq %rsi
subq $0x8, %rsp
leaq 0x2c8e7(%rip), %rsi     # 0x4fe77
movq %r15, %rdi
movq %r9, %rdx
movq %rax, %r9
xorl %eax, %eax
pushq %r10
callq 0x198c0
popq %rcx
popq %rdx
movq %r12, %rdi
movq %r15, %rsi
callq 0x19800
pushq $0x2
popq %rsi
movq 0x8(%rsp), %rdi
movq %r12, %rdx
callq 0x18ec0
addq $0x618, %rsp            # imm = 0x618
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq