// File: /workspace/github_cpp_makefile_star2_O3/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 $0x248, %rsp            # imm = 0x248
movq %rsi, %r14
movq %rdi, -0x38(%rbp)
callq 0x11c49
leaq -0x60(%rbp), %r15
movq %r15, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x146ff
movq (%r15), %rsi
leaq -0x268(%rbp), %rdi
movl $0x10, %edx
callq 0x4430
leaq -0x50(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x17a07
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x43f0
movq -0x268(%rbp), %rax
movq -0x18(%rax), %rax
movl -0x248(%rbp,%rax), %ebx
testb $0x5, %bl
jne 0x17cb4
movq 0x2c0af(%rip), %rsi     # 0x43ad8
movq 0x2c0b0(%rip), %rdx     # 0x43ae0
leaq -0x268(%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 -0x68(%rbp), %r14
movq %r14, %rdi
callq 0x43b0
movq %r14, %rdi
callq 0x42b0
leaq 0x1724f(%rip), %rdx     # 0x2ecd0
leaq -0x60(%rbp), %rdi
movl $0x11, %esi
movq %rax, %rcx
callq 0x4300
leaq 0x17246(%rip), %rsi     # 0x2ecdf
leaq -0x268(%rbp), %rdi
movl $0xa, %edx
callq 0x4460
movq %r15, %rdi
callq 0x41a0
leaq -0x268(%rbp), %r14
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x4460
movq -0x268(%rbp), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x43d0
movsbl %al, %esi
leaq -0x268(%rbp), %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4250
movq -0x38(%rbp), %rax
movswl (%rax), %esi
leaq -0x268(%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
movq -0x38(%rbp), %rax
cmpb $0x1, 0x2(%rax)
jne 0x17b5a
leaq -0x29(%rbp), %rsi
movb $0x31, (%rsi)
leaq -0x268(%rbp), %rdi
movl $0x1, %edx
callq 0x4460
jmp 0x17b72
leaq -0x29(%rbp), %rsi
movb $0x30, (%rsi)
leaq -0x268(%rbp), %rdi
movl $0x1, %edx
callq 0x4460
movq -0x268(%rbp), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x43d0
movsbl %al, %esi
leaq -0x268(%rbp), %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4250
movq -0x38(%rbp), %rax
movl 0x4(%rax), %eax
shlq $0x5, %rax
leaq 0x2b9bd(%rip), %rcx     # 0x43570
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
leaq -0x268(%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 %ebx, -0x3c(%rbp)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %r13
cmpq 0x10(%rax), %r13
je 0x17cb1
leaq -0x29(%rbp), %r15
movl $0x2e, %r12d
movq (%r13), %rbx
cmpq 0x8(%r13), %rbx
je 0x17c74
movzbl 0x2(%rbx), %ecx
cmpl $0x23, %ecx
je 0x17c47
cmpl $0x2e, %ecx
jne 0x17c59
movb 0x3(%rbx), %cl
movl $0x2c, %eax
cmpb $0x19, %cl
je 0x17c3e
movl $0x5f, %eax
cmpb $0x18, %cl
cmovel %r12d, %eax
jmp 0x17c5b
movzwl (%rbx), %edx
movb $0x48, %al
btl $0xc, %edx
jb 0x17c5b
movb $0x49, %al
testb $0x1, %dl
jne 0x17c5b
movl %ecx, %eax
movb %al, -0x29(%rbp)
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x4460
addq $0x4, %rbx
jmp 0x17c18
movq -0x268(%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
movq -0x38(%rbp), %rax
cmpq 0x10(%rax), %r13
jne 0x17c14
movl -0x3c(%rbp), %ebx
testb $0x5, %bl
sete %bl
movq 0x282df(%rip), %rax     # 0x3ffa0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x260(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x268(%rbp,%rcx)
callq 0x4330
leaq -0x170(%rbp), %rdi
callq 0x4140
movl %ebx, %eax
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x50(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x17d37
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x43f0
jmp 0x17d37
jmp 0x17d28
jmp 0x17d28
jmp 0x17d28
movq %rax, %rbx
leaq -0x268(%rbp), %rdi
callq 0x45e0
movq %rbx, %rdi
callq 0x4740