// File: /workspace/github_cpp_makefile_star2_O1/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 $0x1b8, %rsp            # imm = 0x1B8
movq %rdi, %r14
leaq 0x160(%rsp), %r12
movq %rsi, (%r12)
movq (%rdx), %rax
movq %rax, 0x8(%r12)
movq (%rcx), %rax
movq %rax, 0x2c(%r12)
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%rsp)
movq $0x0, 0x80(%rsp)
movl $0x2c0, %edi            # imm = 0x2C0
callq 0x21c0
movq %rax, %r15
movq %rax, 0x70(%rsp)
movq %rax, 0x78(%rsp)
addq $0x2c0, %rax            # imm = 0x2C0
movq %rax, 0x90(%rsp)
movq %rax, 0x80(%rsp)
xorl %eax, %eax
leaq (%r15,%rax), %rdi
movl $0xb, %ecx
movq %r12, %rsi
rep  movsq (%rsi), %es:(%rdi)
addq $0x58, %rax
cmpq $0x2c0, %rax            # imm = 0x2C0
jne 0x332b
movq %r15, %rcx
addq %rax, %rcx
movq %rcx, 0x78(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
movl $0x8f0, %edi            # imm = 0x8F0
callq 0x21c0
movq %rax, 0x50(%rsp)
movq %rax, 0x58(%rsp)
leaq 0x8f0(%rax), %rcx
movq %rcx, 0x60(%rsp)
xorl %r8d, %r8d
leaq 0x160(%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 0x338d
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)
movq %rax, 0x38(%rsp)
leaq 0x8f0(%rax), %rcx
movq %rcx, 0x40(%rsp)
xorl %r8d, %r8d
leaq 0x160(%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 0x33ed
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)
movq %rax, 0x18(%rsp)
leaq 0x370(%rax), %rcx
movq %rcx, 0x20(%rsp)
xorl %r8d, %r8d
leaq 0x160(%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 0x344d
addq %r8, %rax
movq %rax, 0x18(%rsp)
leaq 0x160(%rsp), %rdx
movl $0x8, %esi
movq %r14, %rdi
callq 0x4298
leaq 0x18(%r14), %r12
leaq 0x160(%rsp), %rdx
movl $0x8, %esi
movq %r12, %rdi
callq 0x4298
leaq 0x70(%rsp), %rdi
movl $0x1, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3057
movq %r14, %rdi
movl $0x2, %esi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x3057
movq %r12, %rdi
movl $0x3, %esi
movl $0x2, %edx
movl $0x1, %ecx
callq 0x3057
leaq 0x50(%rsp), %rdi
movl $0x4, %esi
movl $0x3, %edx
movl $0x41, %ecx
callq 0x3057
leaq 0x30(%rsp), %rdi
movl $0x5, %esi
movl $0x3, %edx
movl $0x61, %ecx
callq 0x3057
leaq 0x10(%rsp), %rdi
movl $0x6, %esi
movl $0x3, %edx
movl $0x30, %ecx
callq 0x3057
movq (%r14), %r13
movq 0x8(%r14), %rbx
cmpq %rbx, %r13
je 0x3588
leaq 0x100(%rsp), %rbp
movl $0xb, %ecx
movq %rbp, %rdi
movq %r13, %rsi
rep  movsq (%rsi), %es:(%rdi)
movl $0x2, 0x120(%rsp)
movq 0x20(%r14), %rsi
cmpq 0x28(%r14), %rsi
je 0x3574
movl $0xb, %ecx
movq %rsi, %rdi
movq %rbp, %rsi
rep  movsq (%rsi), %es:(%rdi)
addq $0x58, 0x20(%r14)
jmp 0x357f
movq %r12, %rdi
movq %rbp, %rdx
callq 0x46ba
addq $0x58, %r13
cmpq %rbx, %r13
jne 0x353c
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movaps %xmm0, 0xe0(%rsp)
movaps %xmm1, 0xf0(%rsp)
movups 0x2c(%r15), %xmm0
movups 0x3c(%r15), %xmm1
movups 0x48(%r15), %xmm2
movaps %xmm0, 0xb0(%rsp)
movaps %xmm1, 0xc0(%rsp)
movups %xmm2, 0xcc(%rsp)
leaq 0x100(%rsp), %r15
leaq 0x50(%rsp), %rsi
movq %r15, %rdi
callq 0x41a6
leaq 0x118(%rsp), %r15
leaq 0x30(%rsp), %rsi
movq %r15, %rdi
callq 0x41a6
leaq 0x130(%rsp), %r15
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
callq 0x41a6
leaq 0x148(%rsp), %r15
xorps %xmm0, %xmm0
movups %xmm0, (%r15)
movq $0x0, 0x10(%r15)
movl $0x58, %edi
callq 0x21c0
leaq 0x100(%rsp), %rsi
movq %rax, 0x48(%rsi)
movq %rax, 0x50(%rsi)
movq %rax, %rcx
addq $0x58, %rcx
movq %rcx, 0x58(%rsi)
movaps 0xe0(%rsp), %xmm0
movaps 0xf0(%rsp), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
movq $0x3, 0x20(%rax)
movl $0x20, 0x28(%rax)
movups 0xcc(%rsp), %xmm0
movups %xmm0, 0x48(%rax)
movaps 0xb0(%rsp), %xmm0
movaps 0xc0(%rsp), %xmm1
movups %xmm1, 0x3c(%rax)
movups %xmm0, 0x2c(%rax)
movq %rcx, 0x50(%rsi)
leaq 0x98(%rsp), %rdi
leaq 0xf(%rsp), %rcx
movl $0x4, %edx
callq 0x42dc
leaq 0x98(%rsp), %rsi
movq %r14, %rdi
callq 0x30d5
leaq 0x98(%rsp), %rdi
callq 0x43ba
movl $0x60, %ebx
movq 0xe8(%rsp,%rbx), %rdi
testq %rdi, %rdi
je 0x36e7
movq 0xf8(%rsp,%rbx), %rsi
subq %rdi, %rsi
callq 0x21d0
addq $-0x18, %rbx
jne 0x36ca
leaq 0x1a89(%rip), %rsi      # 0x517d
movq %r14, %rdi
callq 0x322b
leaq 0x1a8c(%rip), %rsi      # 0x518f
movq %r12, %rdi
callq 0x322b
addq $0x30, %r14
leaq 0x1a8b(%rip), %rsi      # 0x51a1
movq %r14, %rdi
callq 0x322b
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x3735
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x374c
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x3763
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x377d
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x43ba
jmp 0x37a4
movq %rax, %rbx
movl $0x60, %r14d
movq 0xe8(%rsp,%r14), %rdi
testq %rdi, %rdi
je 0x37c7
movq 0xf8(%rsp,%r14), %rsi
subq %rdi, %rsi
callq 0x21d0
addq $-0x18, %r14
jne 0x37aa
movb $0x1, %al
jmp 0x37ee
jmp 0x37e9
movq %rax, %rbx
jmp 0x383a
movq %rax, %rbx
jmp 0x3851
movq %rax, %rbx
jmp 0x3868
jmp 0x3820
jmp 0x3820
movq %rax, %rbx
xorl %eax, %eax
leaq 0x100(%rsp), %r14
cmpq %r15, %r14
sete %cl
orb %al, %cl
jne 0x3823
movq -0x18(%r15), %rdi
testq %rdi, %rdi
je 0x3815
movq -0x8(%r15), %rsi
subq %rdi, %rsi
callq 0x21d0
addq $-0x18, %r15
cmpq %r14, %r15
jne 0x3800
jmp 0x3823
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x383a
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x3851
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x3868
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x3882
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x21d0
movq %rbx, %rdi
callq 0x2300