// File: /workspace/github_cpp_makefile_star2_O2/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 $0x198, %rsp            # imm = 0x198
movq %rdi, %rbx
leaq 0xe8(%rsp), %r14
movq %rsi, (%r14)
movq (%rdx), %rax
movq %rax, 0x8(%r14)
movq (%rcx), %rax
movq %rax, 0x2c(%r14)
leaq 0x58(%rsp), %rdi
pushq $0x8
popq %rsi
leaq 0x88(%rsp), %rcx
movq %r14, %rdx
callq 0x3a7c
leaq 0x40(%rsp), %rdi
pushq $0x1a
popq %rsi
leaq 0x88(%rsp), %rcx
movq %r14, %rdx
callq 0x3a7c
leaq 0x28(%rsp), %rdi
pushq $0x1a
popq %rsi
leaq 0xe8(%rsp), %rdx
leaq 0x88(%rsp), %rcx
callq 0x3a7c
leaq 0x10(%rsp), %rdi
pushq $0xa
popq %rsi
leaq 0xe8(%rsp), %rdx
leaq 0x88(%rsp), %rcx
callq 0x3a7c
pushq $0x8
popq %rsi
leaq 0xe8(%rsp), %rdx
movq %rbx, %rdi
callq 0x3ad2
leaq 0x18(%rbx), %r14
pushq $0x8
popq %rsi
leaq 0xe8(%rsp), %rdx
movq %r14, %rdi
callq 0x3ad2
leaq 0x58(%rsp), %rdi
pushq $0x1
popq %r15
movl %r15d, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x2e26
pushq $0x2
popq %r12
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
xorl %ecx, %ecx
callq 0x2e26
pushq $0x3
popq %rbp
movq %r14, %rdi
movl %ebp, %esi
movl %r12d, %edx
movl %r15d, %ecx
callq 0x2e26
leaq 0x40(%rsp), %rdi
pushq $0x4
popq %rsi
pushq $0x41
popq %rcx
movl %ebp, %edx
callq 0x2e26
leaq 0x28(%rsp), %rdi
pushq $0x5
popq %rsi
pushq $0x61
popq %rcx
movl %ebp, %edx
callq 0x2e26
leaq 0x10(%rsp), %rdi
pushq $0x6
popq %rsi
pushq $0x30
popq %rcx
movl %ebp, %edx
callq 0x2e26
movq (%rbx), %r12
movq 0x8(%rbx), %rbp
pushq $0xb
popq %r13
leaq 0x88(%rsp), %r15
cmpq %rbp, %r12
je 0x3191
movq %r13, %rcx
movq %r15, %rdi
movq %r12, %rsi
rep  movsq (%rsi), %es:(%rdi)
movl $0x2, 0xa8(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x3a52
addq $0x58, %r12
jmp 0x3164
movq 0x58(%rsp), %rsi
pushq $0xb
popq %rcx
leaq 0x140(%rsp), %rax
movq %rax, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq $0x3, 0x20(%rax)
movl $0x20, 0x28(%rax)
leaq 0x40(%rsp), %rsi
movq %r15, %rdi
callq 0x39a2
leaq 0xa0(%rsp), %r15
leaq 0x28(%rsp), %rsi
movq %r15, %rdi
callq 0x39a2
leaq 0xb8(%rsp), %r15
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
callq 0x39a2
leaq 0xd0(%rsp), %r15
pushq $0x1
popq %rsi
leaq 0x140(%rsp), %rdx
leaq 0xf(%rsp), %rcx
movq %r15, %rdi
callq 0x3a7c
leaq 0x70(%rsp), %rdi
leaq 0x88(%rsp), %rsi
pushq $0x4
popq %rdx
leaq 0xe(%rsp), %rcx
callq 0x3b0e
leaq 0x70(%rsp), %rsi
movq %rbx, %rdi
callq 0x2e94
leaq 0x70(%rsp), %rdi
callq 0x3bca
pushq $0x48
popq %r15
leaq (%rsp,%r15), %rdi
addq $0x88, %rdi
callq 0x3ca0
addq $-0x18, %r15
cmpq $-0x18, %r15
jne 0x3242
leaq 0x1f1d(%rip), %rsi      # 0x5180
movq %rbx, %rdi
callq 0x2fa5
leaq 0x1f20(%rip), %rsi      # 0x5192
movq %r14, %rdi
callq 0x2fa5
addq $0x30, %rbx
leaq 0x1f1f(%rip), %rsi      # 0x51a4
movq %rbx, %rdi
callq 0x2fa5
leaq 0x10(%rsp), %rdi
callq 0x3ca0
leaq 0x28(%rsp), %rdi
callq 0x3ca0
leaq 0x40(%rsp), %rdi
callq 0x3ca0
leaq 0x58(%rsp), %rdi
callq 0x3ca0
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x3bca
jmp 0x32d9
movq %rax, %rbx
pushq $0x48
popq %r14
leaq (%rsp,%r14), %rdi
addq $0x88, %rdi
callq 0x3ca0
addq $-0x18, %r14
cmpq $-0x18, %r14
jne 0x32dd
movb $0x1, %al
jmp 0x3315
jmp 0x3310
movq %rax, %rbx
jmp 0x3347
movq %rax, %rbx
jmp 0x3351
movq %rax, %rbx
jmp 0x335b
jmp 0x333a
jmp 0x333a
movq %rax, %rbx
xorl %eax, %eax
leaq 0x88(%rsp), %r14
cmpq %r15, %r14
sete %cl
orb %al, %cl
jne 0x333d
addq $-0x18, %r15
movq %r15, %rdi
callq 0x3ca0
cmpq %r14, %r15
jne 0x3327
jmp 0x333d
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x3ca0
leaq 0x28(%rsp), %rdi
callq 0x3ca0
leaq 0x40(%rsp), %rdi
callq 0x3ca0
leaq 0x58(%rsp), %rdi
callq 0x3ca0
movq %rbx, %rdi
callq 0x22b0