// File: /workspace/github_cpp_makefile_star2_O3/aempirei[P]Chat-Art/calibration.cc
// Function: process_tiles(config&, pnm const&, int const*, int const*)
void process_tiles(config& cfg, const pnm& snapshot, const pos_t size, const pos_t origin) {

	tile base(&snapshot, size, origin);

	tiles     solid_tiles( 8, base);
	tiles uppercase_tiles(26, base);
	tiles lowercase_tiles(26, base);
	tiles    number_tiles(10, base);

	cfg.bg_colors.resize(8, base);
	cfg.fg_colors.resize(8, base);

	assign_tiles(    solid_tiles, 1, geometry::NOP    , 0);

	assign_tiles(  cfg.bg_colors, 2, geometry::BGCOLOR, 0);
	assign_tiles(  cfg.fg_colors, 3, geometry::FGCOLOR, 1);

	assign_tiles(uppercase_tiles, 4, geometry::SYMBOL, 'A');
	assign_tiles(lowercase_tiles, 5, geometry::SYMBOL, 'a');
	assign_tiles(   number_tiles, 6, geometry::SYMBOL, '0');

	for(tile t : cfg.bg_colors) {
		t.geo.mode = geometry::FGCOLOR;
		cfg.fg_colors.push_back(t);
	}

	tile space_tile = solid_tiles.front();

	space_tile.set_status(geometry::SYMBOL, 0, ' ');

	assign_symbolic_tiles(cfg, {uppercase_tiles, lowercase_tiles, number_tiles, tiles(1, space_tile)});

	print_tiles(cfg.bg_colors, "background colors");
	print_tiles(cfg.fg_colors, "foreground colors");
	print_tiles(cfg.symbols  , "character symbols");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rdi, %r14
leaq 0x150(%rsp), %r15
movq %rsi, (%r15)
movq (%rdx), %rax
movq %rax, 0x8(%r15)
movq (%rcx), %rax
movq %rax, 0x2c(%r15)
movl $0x2c0, %edi            # imm = 0x2C0
callq 0x21c0
movq %rax, %rbx
movq %rax, 0x88(%rsp)
addq $0x2c0, %rax            # imm = 0x2C0
movq %rax, 0x98(%rsp)
xorl %eax, %eax
leaq (%rbx,%rax), %rdi
movl $0xb, %ecx
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
addq $0x58, %rax
cmpq $0x2c0, %rax            # imm = 0x2C0
jne 0x32ee
movq %rbx, %rcx
addq %rax, %rcx
movq %rcx, 0x90(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
movl $0x8f0, %edi            # imm = 0x8F0
callq 0x21c0
movq %rax, 0x50(%rsp)
leaq 0x8f0(%rax), %rcx
movq %rcx, 0x60(%rsp)
xorl %r8d, %r8d
leaq 0x150(%rsp), %rdx
leaq (%rax,%r8), %rdi
movl $0xb, %ecx
movq %rdx, %rsi
rep  movsq (%rsi), %es:(%rdi)
addq $0x58, %r8
cmpq $0x8f0, %r8             # imm = 0x8F0
jne 0x334e
addq %r8, %rax
movq %rax, 0x58(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
movl $0x8f0, %edi            # imm = 0x8F0
callq 0x21c0
movq %rax, 0x30(%rsp)
leaq 0x8f0(%rax), %rcx
movq %rcx, 0x40(%rsp)
xorl %r8d, %r8d
leaq 0x150(%rsp), %rdx
leaq (%rax,%r8), %rdi
movl $0xb, %ecx
movq %rdx, %rsi
rep  movsq (%rsi), %es:(%rdi)
addq $0x58, %r8
cmpq $0x8f0, %r8             # imm = 0x8F0
jne 0x33a9
addq %r8, %rax
movq %rax, 0x38(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movl $0x370, %edi            # imm = 0x370
callq 0x21c0
movq %rax, 0x10(%rsp)
leaq 0x370(%rax), %rcx
movq %rcx, 0x20(%rsp)
xorl %r8d, %r8d
leaq 0x150(%rsp), %rdx
leaq (%rax,%r8), %rdi
movl $0xb, %ecx
movq %rdx, %rsi
rep  movsq (%rsi), %es:(%rdi)
addq $0x58, %r8
cmpq $0x370, %r8             # imm = 0x370
jne 0x3404
addq %r8, %rax
movq %rax, 0x18(%rsp)
leaq 0x150(%rsp), %rdx
movl $0x8, %esi
movq %r14, %rdi
callq 0x41fe
leaq 0x18(%r14), %r15
leaq 0x150(%rsp), %rdx
movl $0x8, %esi
movq %r15, %rdi
callq 0x41fe
leaq 0x88(%rsp), %rdi
movl $0x1, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3035
movq %r14, %rdi
movl $0x2, %esi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x3035
movq %r15, %rdi
movl $0x3, %esi
movl $0x2, %edx
movl $0x1, %ecx
callq 0x3035
leaq 0x50(%rsp), %rdi
movl $0x4, %esi
movl $0x3, %edx
movl $0x41, %ecx
callq 0x3035
leaq 0x30(%rsp), %rdi
movl $0x5, %esi
movl $0x3, %edx
movl $0x61, %ecx
callq 0x3035
leaq 0x10(%rsp), %rdi
movl $0x6, %esi
movl $0x3, %edx
movl $0x30, %ecx
callq 0x3035
movq (%r14), %r12
movq 0x8(%r14), %rbp
cmpq %rbp, %r12
je 0x3542
leaq 0xf0(%rsp), %r13
movl $0xb, %ecx
movq %r13, %rdi
movq %r12, %rsi
rep  movsq (%rsi), %es:(%rdi)
movl $0x2, 0x110(%rsp)
movq 0x20(%r14), %rsi
cmpq 0x28(%r14), %rsi
je 0x352e
movl $0xb, %ecx
movq %rsi, %rdi
movq %r13, %rsi
rep  movsq (%rsi), %es:(%rdi)
addq $0x58, 0x20(%r14)
jmp 0x3539
movq %r15, %rdi
movq %r13, %rdx
callq 0x4624
addq $0x58, %r12
cmpq %rbp, %r12
jne 0x34f6
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movaps %xmm0, 0xd0(%rsp)
movaps %xmm1, 0xe0(%rsp)
movups 0x2c(%rbx), %xmm0
movups 0x3c(%rbx), %xmm1
movups 0x48(%rbx), %xmm2
movaps %xmm0, 0xa0(%rsp)
movaps %xmm1, 0xb0(%rsp)
movups %xmm2, 0xbc(%rsp)
leaq 0xf0(%rsp), %r12
leaq 0x50(%rsp), %rsi
movq %r12, %rdi
callq 0x410a
leaq 0x108(%rsp), %r13
leaq 0x30(%rsp), %rsi
movq %r13, %rdi
callq 0x410a
leaq 0x120(%rsp), %r13
leaq 0x10(%rsp), %rsi
movq %r13, %rdi
callq 0x410a
leaq 0x138(%rsp), %r13
xorps %xmm0, %xmm0
movups %xmm0, (%r13)
movq $0x0, 0x10(%r13)
movl $0x58, %edi
callq 0x21c0
leaq 0xf0(%rsp), %rsi
movq %rax, 0x48(%rsi)
movq %rax, %rcx
addq $0x58, %rcx
movq %rcx, 0x58(%rsi)
movaps 0xd0(%rsp), %xmm0
movaps 0xe0(%rsp), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
movq $0x3, 0x20(%rax)
movl $0x20, 0x28(%rax)
movups 0xbc(%rsp), %xmm0
movups %xmm0, 0x48(%rax)
movaps 0xa0(%rsp), %xmm0
movaps 0xb0(%rsp), %xmm1
movups %xmm1, 0x3c(%rax)
movups %xmm0, 0x2c(%rax)
movq %rcx, 0x50(%rsi)
leaq 0x70(%rsp), %rdi
leaq 0xf(%rsp), %rcx
movl $0x4, %edx
callq 0x4242
leaq 0x70(%rsp), %rsi
movq %r14, %rdi
callq 0x30b3
leaq 0x70(%rsp), %rdi
callq 0x4320
movl $0x60, %r12d
movq 0xd8(%rsp,%r12), %rdi
testq %rdi, %rdi
je 0x3691
movq 0xe8(%rsp,%r12), %rsi
subq %rdi, %rsi
callq 0x21d0
addq $-0x18, %r12
jne 0x3674
leaq 0x1adf(%rip), %rsi      # 0x517d
movq %r14, %rdi
callq 0x320f
leaq 0x1ae2(%rip), %rsi      # 0x518f
movq %r15, %rdi
callq 0x320f
addq $0x30, %r14
leaq 0x1ae1(%rip), %rsi      # 0x51a1
movq %r14, %rdi
callq 0x320f
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x36df
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x36f6
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x370d
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movl $0x2c0, %esi            # imm = 0x2C0
movq %rbx, %rdi
callq 0x21d0
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq 0x70(%rsp), %rdi
callq 0x4320
jmp 0x373e
movq %rax, %r14
movl $0x60, %r15d
movq 0xd8(%rsp,%r15), %rdi
testq %rdi, %rdi
je 0x3761
movq 0xe8(%rsp,%r15), %rsi
subq %rdi, %rsi
callq 0x21d0
addq $-0x18, %r15
jne 0x3744
jmp 0x37a6
jmp 0x377c
jmp 0x37a3
movq %rax, %r14
jmp 0x37bd
movq %rax, %r14
jmp 0x37d4
movq %rax, %r14
jmp 0x37eb
movq %rax, %r14
movq -0x18(%r13), %rdi
testq %rdi, %rdi
je 0x3794
movq -0x8(%r13), %rsi
subq %rdi, %rsi
callq 0x21d0
addq $-0x18, %r13
cmpq %r12, %r13
jne 0x377f
jmp 0x37a6
jmp 0x37a3
jmp 0x37a3
movq %rax, %r14
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x37bd
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x37d4
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x37eb
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movl $0x2c0, %esi            # imm = 0x2C0
movq %rbx, %rdi
callq 0x21d0
movq %r14, %rdi
callq 0x2300