// File: /workspace/github_cpp_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
subq $0x248, %rsp            # imm = 0x248
callq 0xdc2d
leaq 0x31155(%rip), %rdx     # 0x3fed8
leaq -0x70(%rbp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0xfe1f
movq (%rbx), %rsi
leaq -0x270(%rbp), %rdi
pushq $0x4
popq %rdx
callq 0x4440
movq -0x270(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x250(%rbp,%rax)
je 0xee06
leaq 0x17b7e(%rip), %rsi     # 0x2693e
leaq -0x50(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0xb292
leaq -0x50(%rbp), %rdi
callq 0x10b68
leaq -0x50(%rbp), %rdi
callq 0x47e8
leaq -0x270(%rbp), %rdi
callq 0x45f0
leaq -0x70(%rbp), %rdi
callq 0x47e8
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x17c83(%rip), %rsi     # 0x26a90
leaq -0x270(%rbp), %rdi
pushq $0x2
popq %rdx
callq 0x4570
movl 0x31286(%rip), %eax     # 0x400a8
cmpl $0x2711, %eax           # imm = 0x2711
movl $0x2710, %ecx           # imm = 0x2710
cmovll %eax, %ecx
leaq -0x50(%rbp), %rsi
movw %cx, (%rsi)
leaq -0x270(%rbp), %rdi
pushq $0x2
popq %rdx
callq 0x4570
leaq 0x3124c(%rip), %r13     # 0x40098
leaq -0x270(%rbp), %rbx
pushq $0x2
popq %r14
pushq $0x8
popq %r15
pushq $0x58
popq %r12
movq (%r13), %r13
leaq 0x3122e(%rip), %rax     # 0x40098
cmpq %rax, %r13
je 0xeddf
leaq 0x10(%r13), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x4570
movq 0x3120f(%rip), %rsi     # 0x40098
addq $0x12, %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x4570
leaq 0x48(%r13), %rsi
movq %rbx, %rdi
movq %r12, %rdx
callq 0x4570
leaq 0x40(%r13), %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x4570
leaq 0xa0(%r13), %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x4570
leaq 0xa8(%r13), %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x4570
leaq 0xb0(%r13), %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x4570
leaq 0xb8(%r13), %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x4570
leaq 0xc0(%r13), %rsi
movq %rbx, %rdi
movq %r12, %rdx
callq 0x4570
leaq 0x118(%r13), %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x4570
leaq 0x120(%r13), %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x4570
leaq 0x128(%r13), %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x4570
leaq 0x130(%r13), %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x4570
leaq 0x140(%r13), %rsi
movq %rbx, %rdi
pushq $0x4
popq %rdx
callq 0x4570
leaq 0x138(%r13), %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x4570
movzwl 0x28(%r13), %eax
movw %ax, -0x50(%rbp)
movq %rbx, %rdi
leaq -0x50(%rbp), %rsi
movq %r14, %rdx
callq 0x4570
movq 0x20(%r13), %rsi
movswq -0x50(%rbp), %rdx
movq %rbx, %rdi
callq 0x4570
jmp 0xee5f
jmp 0xefc3
jmp 0xefc3
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x47e8
jmp 0xefc6
jmp 0xefc3
movq %rax, %rbx
jmp 0xefd2
movq %rax, %rbx
leaq -0x270(%rbp), %rdi
callq 0x45f0
leaq -0x70(%rbp), %rdi
callq 0x47e8
movq %rbx, %rdi
callq 0x4710