// File: /workspace/github_cpp_makefile_star2_O3/lotuskip[P]yuxtapa/server/players.cpp
// Function: write_player_stats()
void write_player_stats()
{
	string fname = Config::get_config_dir() + playerfilename;
	ofstream file(fname.c_str(), ios_base::binary);
	if(!file)
	{
		to_log("ERROR: could not open player data for writing!");
		return;
	}

	file.write(reinterpret_cast<const char*>(&STAT_VERSION), sizeof(short));

	short numpl;
	if((signed int)(known_players.size()) > MAX_STORED_PLAYERS)
		numpl = MAX_STORED_PLAYERS;
	else // this is done like this 'cuz basically the size can be more than a short fits
		numpl = known_players.size();
	// Note that when called between maps we are writing bots' stats into the
	// file, too!
	file.write(reinterpret_cast<char*>(&numpl), sizeof(short));
	for(list<PlayerStats>::iterator it = known_players.begin();
		it != known_players.end(); ++it)
	{
		file.write(reinterpret_cast<char*>(&it->ID), sizeof(short));
		file.write(known_players.front().password, PASSW_LEN);
		file.write(reinterpret_cast<char*>(it->kills), MAX_WAY_TO_KILL*sizeof(long));
		file.write(reinterpret_cast<char*>(&it->deaths), sizeof(long));
		file.write(reinterpret_cast<char*>(&it->tks), sizeof(long));
		file.write(reinterpret_cast<char*>(&it->healing_recvd), sizeof(long));
		file.write(reinterpret_cast<char*>(&it->total_time), sizeof(long));
		file.write(reinterpret_cast<char*>(&it->time_specced), sizeof(long));
		file.write(reinterpret_cast<char*>(it->time_played), NO_CLASS*sizeof(long));
		file.write(reinterpret_cast<char*>(&it->arch_hits), sizeof(long));
		file.write(reinterpret_cast<char*>(&it->arch_shots), sizeof(long));
		file.write(reinterpret_cast<char*>(&it->cm_hits), sizeof(long));
		file.write(reinterpret_cast<char*>(&it->cm_shots), sizeof(long));
		file.write(reinterpret_cast<char*>(&it->ad_lvl), sizeof(e_AdminLvl));
		file.write(reinterpret_cast<char*>(&it->last_seen), sizeof(time_t));
		numpl = it->last_known_as.size();
		file.write(reinterpret_cast<char *>(&numpl), sizeof(short));
		file.write(it->last_known_as.c_str(), numpl);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x240, %rsp            # imm = 0x240
callq 0x11983
leaq 0x3009f(%rip), %rdx     # 0x42ee8
leaq -0x60(%rbp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x146ff
movq (%rbx), %rsi
leaq -0x260(%rbp), %rdi
movl $0x4, %edx
callq 0x4430
movq -0x260(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x240(%rbp,%rax)
je 0x12f21
leaq -0x30(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x19a75(%rip), %rsi     # 0x2c909
leaq 0x19a9c(%rip), %rdx     # 0x2c937
leaq -0x40(%rbp), %rdi
callq 0xe01c
leaq -0x40(%rbp), %rdi
callq 0x14f24
movq -0x40(%rbp), %rdi
cmpq %r14, %rdi
je 0x12ec2
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x43f0
movq 0x2d0d7(%rip), %rax     # 0x3ffa0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x258(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x260(%rbp,%rcx)
callq 0x4330
leaq -0x168(%rbp), %rdi
callq 0x4140
leaq -0x50(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x12f11
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x43f0
addq $0x240, %rsp            # imm = 0x240
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x19b38(%rip), %rsi     # 0x2ca60
leaq -0x260(%rbp), %rdi
movl $0x2, %edx
callq 0x4560
movl 0x30179(%rip), %eax     # 0x430b8
cmpl $0x2711, %eax           # imm = 0x2711
movl $0x2710, %ecx           # imm = 0x2710
cmovll %eax, %ecx
leaq -0x40(%rbp), %rsi
movw %cx, (%rsi)
leaq -0x260(%rbp), %rdi
movl $0x2, %edx
callq 0x4560
leaq 0x3013d(%rip), %r15     # 0x430a8
leaq -0x260(%rbp), %rbx
leaq -0x40(%rbp), %r14
movq %r15, %r12
movq (%r12), %r12
cmpq %r15, %r12
je 0x12ec2
leaq 0x10(%r12), %rsi
movl $0x2, %edx
movq %rbx, %rdi
callq 0x4560
movq 0x30109(%rip), %rsi     # 0x430a8
addq $0x12, %rsi
movl $0x8, %edx
movq %rbx, %rdi
callq 0x4560
leaq 0x48(%r12), %rsi
movl $0x58, %edx
movq %rbx, %rdi
callq 0x4560
leaq 0x40(%r12), %rsi
movl $0x8, %edx
movq %rbx, %rdi
callq 0x4560
leaq 0xa0(%r12), %rsi
movl $0x8, %edx
movq %rbx, %rdi
callq 0x4560
leaq 0xa8(%r12), %rsi
movl $0x8, %edx
movq %rbx, %rdi
callq 0x4560
leaq 0xb0(%r12), %rsi
movl $0x8, %edx
movq %rbx, %rdi
callq 0x4560
leaq 0xb8(%r12), %rsi
movl $0x8, %edx
movq %rbx, %rdi
callq 0x4560
leaq 0xc0(%r12), %rsi
movl $0x58, %edx
movq %rbx, %rdi
callq 0x4560
leaq 0x118(%r12), %rsi
movl $0x8, %edx
movq %rbx, %rdi
callq 0x4560
leaq 0x120(%r12), %rsi
movl $0x8, %edx
movq %rbx, %rdi
callq 0x4560
leaq 0x128(%r12), %rsi
movl $0x8, %edx
movq %rbx, %rdi
callq 0x4560
leaq 0x130(%r12), %rsi
movl $0x8, %edx
movq %rbx, %rdi
callq 0x4560
leaq 0x140(%r12), %rsi
movl $0x4, %edx
movq %rbx, %rdi
callq 0x4560
leaq 0x138(%r12), %rsi
movl $0x8, %edx
movq %rbx, %rdi
callq 0x4560
movzwl 0x28(%r12), %eax
movw %ax, -0x40(%rbp)
movl $0x2, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4560
movq 0x20(%r12), %rsi
movswq -0x40(%rbp), %rdx
movq %rbx, %rdi
callq 0x4560
jmp 0x12f79
jmp 0x13111
jmp 0x13111
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r14, %rdi
je 0x13114
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x43f0
jmp 0x13114
jmp 0x13111
movq %rax, %rbx
jmp 0x13120
movq %rax, %rbx
leaq -0x260(%rbp), %rdi
callq 0x45e0
leaq -0x50(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x13139
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x43f0
movq %rbx, %rdi
callq 0x4740