// File: /workspace/github_cpp_makefile_star2_O1/aempirei[P]Chat-Art/include/tile.hh
// Function: tile::to_string[abi:cxx11]() const
std::string tile::to_string() const {

	char buf[256];
	char basebuf[16];

	switch(geo.mode) {
		case geometry::BGCOLOR: 
			snprintf(basebuf, sizeof(basebuf), "%d,%d", geo.base, 40 + geo.code );
			break;
		case geometry::FGCOLOR: 
			snprintf(basebuf, sizeof(basebuf), "%d,%d", geo.base, 30 + geo.code );
			break;
		case geometry::SYMBOL:
			snprintf(basebuf, sizeof(basebuf), "(%c)" , geo.base + geo.code);
			break;
		case geometry::NOP:
		default:
			*basebuf = '\0';
	}

	snprintf(buf, sizeof(buf), 
			"mode %02x "
			"code %02x "
			"base %02x "
			"%4s "
			"color #%02x%02x%02x "
			"~ #%02x%02x%02x "
			"ratio %2d:%-2d %3d%% "
			"n %3d "
			"x %3d "
			"y %3d "
			"rgb_mean %3d %3d %3d "
			"rgb_stdev %3d %3d %3d "
			"size %dx%d",
			geo.mode,
			geo.code,
			geo.base,
			basebuf,
			(uint8_t)rgb_mean[0], (uint8_t)rgb_mean[1], (uint8_t)rgb_mean[2],
			geo.color[0],geo.color[1],geo.color[2],
			geo.ratio, geometry::ratio_max-geo.ratio, 100*geo.ratio/geometry::ratio_max,
			(int)n(),
			(int)pos[0], (int)pos[1],
			(int)rgb_mean[0],
			(int)rgb_mean[1],
			(int)rgb_mean[2],
			(int)rgb_stdev[0],
			(int)rgb_stdev[1],
			(int)rgb_stdev[2],
			(int)geo.size[1], (int)geo.size[0]
	);

	return std::string(buf);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %rsi, %r14
movq %rdi, 0x78(%rsp)
movl 0x20(%rsi), %eax
cmpl $0x3, %eax
je 0x2c8f
cmpl $0x2, %eax
je 0x2c6b
cmpl $0x1, %eax
jne 0x2caf
movl 0x24(%r14), %r8d
movl 0x28(%r14), %ecx
addl $0x28, %r8d
jmp 0x2c77
movl 0x24(%r14), %r8d
movl 0x28(%r14), %ecx
addl $0x1e, %r8d
leaq 0x244c(%rip), %rdx      # 0x50ca
movq %rsp, %rdi
movl $0x10, %esi
xorl %eax, %eax
callq 0x22b0
jmp 0x2cb3
movl 0x24(%r14), %ecx
addl 0x28(%r14), %ecx
leaq 0x2409(%rip), %rdx      # 0x50a7
movq %rsp, %rdi
movl $0x10, %esi
xorl %eax, %eax
callq 0x22b0
jmp 0x2cb3
movb $0x0, (%rsp)
movl 0x20(%r14), %ecx
movl 0x24(%r14), %r8d
movl 0x34(%r14), %eax
movq %rax, 0x58(%rsp)
movl $0xff, %r11d
andl %r11d, %eax
movq %rax, 0x70(%rsp)
movl 0x38(%r14), %eax
movq %rax, 0x50(%rsp)
andl %r11d, %eax
movq %rax, 0x68(%rsp)
movl 0x3c(%r14), %eax
movq %rax, 0x38(%rsp)
andl %eax, %r11d
movl 0x1c(%r14), %eax
movq %rax, 0x60(%rsp)
movl $0x3f, %r13d
subl %eax, %r13d
imull $0x64, %eax, %ebx
imulq $0x4104105, %rbx, %rax  # imm = 0x4104105
shrq $0x20, %rax
subl %eax, %ebx
shrl %ebx
addl %eax, %ebx
shrl $0x5, %ebx
movl 0x8(%r14), %r15d
movl 0xc(%r14), %ebp
movl %ebp, %r10d
imull %r15d, %r10d
movl 0x28(%r14), %r9d
movl 0x10(%r14), %eax
movq %rax, 0x48(%rsp)
movl 0x14(%r14), %eax
movq %rax, 0x40(%rsp)
movl 0x18(%r14), %eax
movq %rax, 0x30(%rsp)
movl 0x2c(%r14), %eax
movq %rax, 0x28(%rsp)
movl 0x30(%r14), %eax
movq %rax, 0x20(%rsp)
movl 0x4c(%r14), %eax
movq %rax, 0x18(%rsp)
movl 0x50(%r14), %r12d
movl 0x54(%r14), %r14d
subq $0x8, %rsp
leaq 0x235c(%rip), %rdx      # 0x50d0
leaq 0x88(%rsp), %rdi
movl $0x100, %esi            # imm = 0x100
xorl %eax, %eax
pushq %r15
pushq %rbp
pushq %r14
pushq %r12
pushq 0x40(%rsp)
pushq 0x68(%rsp)
pushq 0x88(%rsp)
pushq 0x98(%rsp)
pushq 0x68(%rsp)
pushq 0x78(%rsp)
pushq %r10
pushq %rbx
pushq %r13
pushq 0xd0(%rsp)
pushq 0xa8(%rsp)
pushq 0xc0(%rsp)
pushq 0xd0(%rsp)
pushq %r11
pushq 0x100(%rsp)
pushq 0x110(%rsp)
leaq 0xa8(%rsp), %r10
pushq %r10
callq 0x22b0
addq $0xb0, %rsp
movq 0x78(%rsp), %rbx
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x80(%rsp), %r14
movq %r14, %rdi
callq 0x20e0
leaq (%rsp,%rax), %rdx
addq $0x80, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x43fe
movq %rbx, %rax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq