// File: /workspace/github_cpp_makefile_star2_O1/lotuskip[P]yuxtapa/server/map.cpp
// Function: Map::save_to_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) const
bool Map::save_to_file(const std::string &mapname) const
{
	ofstream file((Config::get_mapdir() + mapname).c_str());
	if(!file)
		return false;
	// else:
	file << mapfile_begin_string << endl;

	time_t rawtime;
	struct tm *timeinfo;
	char buffer[17]; // eg. "01/02/2011 12:13" (and '\0')
	time(&rawtime);
 	timeinfo = localtime(&rawtime);
	strftime(buffer, 17, "%d/%m/%Y %H:%M", timeinfo);
	file << "Saved on: " << buffer << endl;

	file << mapsize << endl;
	// force using "1" for true and "0" for false; can't trust locales:
	if(inhabited)
		file << '1';
	else
		file << '0';
	file << endl;
	file << short_mtype_name[maptype] << endl;

	vector<Tile>::const_iterator i;	
	for(vector< vector<Tile> >::const_iterator it = data.begin(); it != data.end(); ++it)
	{
		for(i = it->begin(); i != it->end(); ++i)
			file << char_from_tile(*i);
		file << endl;
	}
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movq %rsi, %r14
movq %rdi, %rbx
callq 0x11daa
leaq -0x50(%rbp), %r15
movq %r15, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x1483d
movq (%r15), %rsi
leaq -0x258(%rbp), %rdi
movl $0x10, %edx
callq 0x4430
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x17b4a
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x43f0
movq -0x258(%rbp), %rax
movq -0x18(%rax), %rax
movl -0x238(%rbp,%rax), %r12d
testb $0x5, %r12b
jne 0x17de4
movq 0x2bf6a(%rip), %rsi     # 0x43ad8
movq 0x2bf6b(%rip), %rdx     # 0x43ae0
leaq -0x258(%rbp), %rdi
callq 0x4460
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x43d0
movsbl %al, %esi
movq %r14, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4250
leaq -0x58(%rbp), %r14
movq %r14, %rdi
callq 0x43b0
movq %r14, %rdi
callq 0x42b0
leaq 0x1710a(%rip), %rdx     # 0x2ecd0
leaq -0x50(%rbp), %rdi
movl $0x11, %esi
movq %rax, %rcx
callq 0x4300
leaq 0x17101(%rip), %rsi     # 0x2ecdf
leaq -0x258(%rbp), %rdi
movl $0xa, %edx
callq 0x4460
movq %r15, %rdi
callq 0x41a0
leaq -0x258(%rbp), %r14
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x4460
movq -0x258(%rbp), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x43d0
movsbl %al, %esi
leaq -0x258(%rbp), %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4250
movswl (%rbx), %esi
leaq -0x258(%rbp), %r14
movq %r14, %rdi
callq 0x43a0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x43d0
movsbl %al, %esi
movq %r15, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4250
cmpb $0x1, 0x2(%rbx)
jne 0x17c97
leaq -0x29(%rbp), %rsi
movb $0x31, (%rsi)
leaq -0x258(%rbp), %rdi
movl $0x1, %edx
callq 0x4460
jmp 0x17caf
leaq -0x29(%rbp), %rsi
movb $0x30, (%rsi)
leaq -0x258(%rbp), %rdi
movl $0x1, %edx
callq 0x4460
movq -0x258(%rbp), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x43d0
movsbl %al, %esi
leaq -0x258(%rbp), %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4250
movl 0x4(%rbx), %eax
shlq $0x5, %rax
leaq 0x2b884(%rip), %rcx     # 0x43570
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
leaq -0x258(%rbp), %r14
movq %r14, %rdi
callq 0x4460
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x43d0
movsbl %al, %esi
movq %r15, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4250
movl %r12d, -0x30(%rbp)
movq 0x8(%rbx), %r13
cmpq 0x10(%rbx), %r13
je 0x17de0
leaq -0x29(%rbp), %r15
movq (%r13), %r12
cmpq 0x8(%r13), %r12
je 0x17da7
movzbl 0x2(%r12), %eax
cmpl $0x23, %eax
je 0x17d74
cmpl $0x2e, %eax
jne 0x17d88
movzbl 0x3(%r12), %edx
movl %eax, %ecx
cmpl $0x18, %edx
je 0x17d8e
cmpl $0x19, %edx
jne 0x17d8c
movb $0x2c, %cl
jmp 0x17d8e
movzwl (%r12), %edx
movb $0x48, %cl
btl $0xc, %edx
jb 0x17d8e
movb $0x49, %cl
testb $0x1, %dl
jne 0x17d8e
movl %eax, %ecx
jmp 0x17d8e
movb $0x5f, %cl
movb %cl, -0x29(%rbp)
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x4460
addq $0x4, %r12
jmp 0x17d48
movq -0x258(%rbp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x43d0
movsbl %al, %esi
movq %r14, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4250
addq $0x18, %r13
cmpq 0x10(%rbx), %r13
jne 0x17d44
movl -0x30(%rbp), %r12d
testb $0x5, %r12b
sete %bl
movq 0x281b6(%rip), %rax     # 0x3ffa8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x250(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x258(%rbp,%rcx)
callq 0x4330
leaq -0x160(%rbp), %rdi
callq 0x4140
movl %ebx, %eax
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x17e68
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x43f0
jmp 0x17e68
jmp 0x17e59
jmp 0x17e59
jmp 0x17e59
movq %rax, %rbx
leaq -0x258(%rbp), %rdi
callq 0x45f0
movq %rbx, %rdi
callq 0x4750