// File: /workspace/github_cpp_makefile_star2_O2/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, -0x30(%rbp)
callq 0xde53
leaq -0x60(%rbp), %r15
movq %r15, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0xfe1f
movq (%r15), %rsi
leaq -0x268(%rbp), %rdi
pushq $0x10
popq %rdx
callq 0x4440
leaq -0x60(%rbp), %rdi
callq 0x47e8
movq -0x268(%rbp), %rax
movq -0x18(%rax), %rax
movl -0x248(%rbp,%rax), %ebx
testb $0x5, %bl
jne 0x13002
leaq 0x2dc1d(%rip), %rsi     # 0x40ac8
leaq -0x268(%rbp), %rdi
callq 0x4370
movq %rax, %rdi
callq 0x41c0
movl %ebx, -0x34(%rbp)
leaq -0x68(%rbp), %r14
movq %r14, %rdi
callq 0x43c0
movq %r14, %rdi
callq 0x42a0
leaq 0x15e23(%rip), %rdx     # 0x28d00
leaq -0x60(%rbp), %rdi
pushq $0x11
popq %rsi
movq %rax, %rcx
callq 0x4310
leaq 0x15e1c(%rip), %rsi     # 0x28d0f
leaq -0x268(%rbp), %rdi
callq 0x43e0
leaq -0x60(%rbp), %rsi
movq %rax, %rdi
callq 0x43e0
movq %rax, %rdi
callq 0x41c0
movq -0x30(%rbp), %rax
movswl (%rax), %esi
leaq -0x268(%rbp), %rdi
callq 0x43b0
movq %rax, %rdi
callq 0x41c0
movq -0x30(%rbp), %rax
movzbl 0x2(%rax), %esi
orl $0x30, %esi
leaq -0x268(%rbp), %rdi
callq 0x4470
leaq -0x268(%rbp), %rdi
callq 0x41c0
movq -0x30(%rbp), %rax
movl 0x4(%rax), %eax
shlq $0x5, %rax
leaq 0x2d5fd(%rip), %rsi     # 0x40560
addq %rax, %rsi
leaq -0x268(%rbp), %rdi
callq 0x4370
movq %rax, %rdi
callq 0x41c0
movq -0x30(%rbp), %rax
movq 0x8(%rax), %r12
leaq -0x268(%rbp), %r14
pushq $0x2c
popq %r13
pushq $0x2e
popq %rbx
movq -0x30(%rbp), %rax
cmpq 0x10(%rax), %r12
je 0x12fff
movq (%r12), %r15
cmpq 0x8(%r12), %r15
je 0x12ff1
movzbl 0x2(%r15), %ecx
cmpl $0x23, %ecx
je 0x12fcb
cmpl $0x2e, %ecx
jne 0x12fde
movb 0x3(%r15), %cl
movl %r13d, %eax
cmpb $0x19, %cl
je 0x12fc3
pushq $0x5f
popq %rax
cmpb $0x18, %cl
cmovel %ebx, %eax
jmp 0x12fe0
movzwl (%r15), %edx
movb $0x48, %al
btl $0xc, %edx
jb 0x12fe0
movb $0x49, %al
testb $0x1, %dl
jne 0x12fe0
movl %ecx, %eax
movsbl %al, %esi
movq %r14, %rdi
callq 0x4470
addq $0x4, %r15
jmp 0x12f9e
movq %r14, %rdi
callq 0x41c0
addq $0x18, %r12
jmp 0x12f90
movl -0x34(%rbp), %ebx
testb $0x5, %bl
sete %bl
leaq -0x268(%rbp), %rdi
callq 0x45f0
movl %ebx, %eax
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1303c
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x47e8
jmp 0x1304b
jmp 0x1303c
jmp 0x1303c
movq %rax, %rbx
leaq -0x268(%rbp), %rdi
callq 0x45f0
movq %rbx, %rdi
callq 0x4710