// File: 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
subq $0x290, %rsp            # imm = 0x290
callq 0x1ef50
movq %rax, %rsi
leaq 0x6d70e(%rip), %rdx     # 0x90058
leaq -0x20(%rbp), %rdi
movq %rdi, -0x278(%rbp)
callq 0x24cb0
movq -0x278(%rbp), %rdi
callq 0x5200
movq %rax, %rsi
leaq -0x220(%rbp), %rdi
movl $0x4, %edx
callq 0x55a0
jmp 0x2297c
movq -0x220(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x220(%rbp,%rax), %rdi
callq 0x5250
movb %al, -0x279(%rbp)
jmp 0x2299c
movb -0x279(%rbp), %al
testb $0x1, %al
jne 0x229ab
jmp 0x22a80
leaq -0x251(%rbp), %rdi
movq %rdi, -0x288(%rbp)
callq 0x5930
movq -0x288(%rbp), %rdx
leaq 0x3ef42(%rip), %rsi     # 0x6190e
leaq -0x250(%rbp), %rdi
callq 0x18880
jmp 0x229da
leaq -0x250(%rbp), %rdi
callq 0x28d70
jmp 0x229e8
leaq -0x250(%rbp), %rdi
callq 0x5a48
leaq -0x251(%rbp), %rdi
callq 0x5590
movl $0x1, -0x258(%rbp)
jmp 0x22e05
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x228(%rbp)
movl %eax, -0x22c(%rbp)
jmp 0x22e2f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x228(%rbp)
movl %eax, -0x22c(%rbp)
jmp 0x22e23
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x228(%rbp)
movl %eax, -0x22c(%rbp)
jmp 0x22a6f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x228(%rbp)
movl %eax, -0x22c(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x5a48
leaq -0x251(%rbp), %rdi
callq 0x5590
jmp 0x22e23
leaq 0x3efdd(%rip), %rsi     # 0x61a64
leaq -0x220(%rbp), %rdi
movl $0x2, %edx
callq 0x5740
jmp 0x22a9a
leaq 0x6d777(%rip), %rdi     # 0x90218
callq 0x24d70
cmpl $0x2710, %eax           # imm = 0x2710
jle 0x22ab8
movw $0x2710, -0x25a(%rbp)   # imm = 0x2710
jmp 0x22acb
leaq 0x6d759(%rip), %rdi     # 0x90218
callq 0x24d70
movw %ax, -0x25a(%rbp)
leaq -0x220(%rbp), %rdi
leaq -0x25a(%rbp), %rsi
movl $0x2, %edx
callq 0x5740
jmp 0x22ae5
leaq 0x6d72c(%rip), %rdi     # 0x90218
callq 0x24e30
movq %rax, -0x268(%rbp)
leaq 0x6d719(%rip), %rdi     # 0x90218
callq 0x24e90
movq %rax, -0x270(%rbp)
leaq -0x268(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0x24e60
testb $0x1, %al
jne 0x22b27
jmp 0x22dfb
leaq -0x268(%rbp), %rdi
callq 0x1b390
movq %rax, %rsi
leaq -0x220(%rbp), %rdi
movl $0x2, %edx
callq 0x5740
jmp 0x22b49
leaq 0x6d6c8(%rip), %rdi     # 0x90218
callq 0x24ec0
movq %rax, %rsi
addq $0x2, %rsi
leaq -0x220(%rbp), %rdi
movl $0x8, %edx
callq 0x5740
jmp 0x22b6f
leaq -0x268(%rbp), %rdi
callq 0x1b390
movq %rax, %rsi
addq $0x38, %rsi
leaq -0x220(%rbp), %rdi
movl $0x58, %edx
callq 0x5740
jmp 0x22b95
leaq -0x268(%rbp), %rdi
callq 0x1b390
movq %rax, %rsi
addq $0x30, %rsi
leaq -0x220(%rbp), %rdi
movl $0x8, %edx
callq 0x5740
jmp 0x22bbb
leaq -0x268(%rbp), %rdi
callq 0x1b390
movq %rax, %rsi
addq $0x90, %rsi
leaq -0x220(%rbp), %rdi
movl $0x8, %edx
callq 0x5740
jmp 0x22be4
leaq -0x268(%rbp), %rdi
callq 0x1b390
movq %rax, %rsi
addq $0x98, %rsi
leaq -0x220(%rbp), %rdi
movl $0x8, %edx
callq 0x5740
jmp 0x22c0d
leaq -0x268(%rbp), %rdi
callq 0x1b390
movq %rax, %rsi
addq $0xa0, %rsi
leaq -0x220(%rbp), %rdi
movl $0x8, %edx
callq 0x5740
jmp 0x22c36
leaq -0x268(%rbp), %rdi
callq 0x1b390
movq %rax, %rsi
addq $0xa8, %rsi
leaq -0x220(%rbp), %rdi
movl $0x8, %edx
callq 0x5740
jmp 0x22c5f
leaq -0x268(%rbp), %rdi
callq 0x1b390
movq %rax, %rsi
addq $0xb0, %rsi
leaq -0x220(%rbp), %rdi
movl $0x58, %edx
callq 0x5740
jmp 0x22c88
leaq -0x268(%rbp), %rdi
callq 0x1b390
movq %rax, %rsi
addq $0x108, %rsi            # imm = 0x108
leaq -0x220(%rbp), %rdi
movl $0x8, %edx
callq 0x5740
jmp 0x22cb1
leaq -0x268(%rbp), %rdi
callq 0x1b390
movq %rax, %rsi
addq $0x110, %rsi            # imm = 0x110
leaq -0x220(%rbp), %rdi
movl $0x8, %edx
callq 0x5740
jmp 0x22cda
leaq -0x268(%rbp), %rdi
callq 0x1b390
movq %rax, %rsi
addq $0x118, %rsi            # imm = 0x118
leaq -0x220(%rbp), %rdi
movl $0x8, %edx
callq 0x5740
jmp 0x22d03
leaq -0x268(%rbp), %rdi
callq 0x1b390
movq %rax, %rsi
addq $0x120, %rsi            # imm = 0x120
leaq -0x220(%rbp), %rdi
movl $0x8, %edx
callq 0x5740
jmp 0x22d2c
leaq -0x268(%rbp), %rdi
callq 0x1b390
movq %rax, %rsi
addq $0x130, %rsi            # imm = 0x130
leaq -0x220(%rbp), %rdi
movl $0x4, %edx
callq 0x5740
jmp 0x22d55
leaq -0x268(%rbp), %rdi
callq 0x1b390
movq %rax, %rsi
addq $0x128, %rsi            # imm = 0x128
leaq -0x220(%rbp), %rdi
movl $0x8, %edx
callq 0x5740
jmp 0x22d7e
leaq -0x268(%rbp), %rdi
callq 0x1b390
movq %rax, %rdi
addq $0x10, %rdi
callq 0x5340
movw %ax, -0x25a(%rbp)
leaq -0x220(%rbp), %rdi
leaq -0x25a(%rbp), %rsi
movl $0x2, %edx
callq 0x5740
jmp 0x22db7
leaq -0x268(%rbp), %rdi
callq 0x1b390
movq %rax, %rdi
addq $0x10, %rdi
callq 0x5200
movq %rax, %rsi
movswq -0x25a(%rbp), %rdx
leaq -0x220(%rbp), %rdi
callq 0x5740
jmp 0x22de8
jmp 0x22dea
leaq -0x268(%rbp), %rdi
callq 0x24ef0
jmp 0x22af8
movl $0x0, -0x258(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x57d0
leaq -0x20(%rbp), %rdi
callq 0x5a48
addq $0x290, %rsp            # imm = 0x290
popq %rbp
retq
leaq -0x220(%rbp), %rdi
callq 0x57d0
leaq -0x20(%rbp), %rdi
callq 0x5a48
movq -0x228(%rbp), %rdi
callq 0x5920
nopw %cs:(%rax,%rax)