// File: /workspace/github_cpp_makefile_star2_O3/cjsmeele[P]stipje/./stipje.hh
// Function: std::ostream& stipje::image_format::console256_squared::format<ImageProxy<stipje::pixel_format::rgba>, std::ostream>(std::ostream&, ImageProxy<stipje::pixel_format::rgba> const&)
static S &format(S &s, const Img &img) {
            for (int i = 0;; ++i) {
                if (i && i % img.width() == 0) {
                    s << "\x1b[0m\n";
                    i += img.width(); // Skip even rows.
                    if (i >= img.width() * img.height())
                        break;
                }

                auto tp = Img::PixelFormat::unformat(img.pixels()[i]);
                auto bp = i + img.width() >= img.width() * img.height()
                    ? 0x0000000 // Special case for uneven-height images.
                    : Img::PixelFormat::unformat(img.pixels()[i + img.width()]);

                auto [tr,tg,tb,ta] = ptorgba(tp);
                auto [br,bg,bb,ba] = ptorgba(bp);

                if (ta < 128 && ba < 128) {
                    s << "\x1b[0m "; // Transparency case.
                } else if (ta < 128) {
                    s << "\x1b[0m\x1b[38;2;" << br << ";" << bg << ";" << bb;
                    s << "m▄"; // Transparent top half case.
                } else if (ba < 128) {
                    s << "\x1b[0m\x1b[38;2;" << tr << ";" << tg << ";" << tb;
                    s << "m▀"; // Transparent bottom half case.
                } else {
                    s << "\x1b[38;2;" << tr << ";" << tg << ";" << tb;
                    s <<     ";48;2;" << br << ";" << bg << ";" << bb;
                    s << "m▀"; // Full opacity case.
                }
            }
            s << "\x1b[0m";
            return s;
        }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %rbp
xorl %r12d, %r12d
movl $0xff, %r15d
movq %rsi, (%rsp)
movl 0x8(%rbx), %ecx
testl %r12d, %r12d
je 0x1293
movl %r12d, %eax
cltd
idivl %ecx
testl %edx, %edx
jne 0x1296
movl $0x5, %edx
movq %rbp, %rdi
leaq 0x7350(%rip), %rsi      # 0x85c8
callq 0x1060
movl 0x8(%rbx), %ecx
addl %ecx, %r12d
movl 0xc(%rbx), %eax
imull %ecx, %eax
cmpl %eax, %r12d
jl 0x1296
jmp 0x150a
xorl %r12d, %r12d
movq (%rbx), %rdx
leal (%rcx,%r12), %esi
imull 0xc(%rbx), %ecx
xorl %eax, %eax
cmpl %ecx, %esi
jge 0x12af
movslq %esi, %rax
movl (%rdx,%rax,4), %eax
bswapl %eax
movslq %r12d, %rcx
movl (%rdx,%rcx,4), %ecx
bswapl %ecx
movl %eax, %edx
orb %cl, %dl
js 0x12d6
movl $0x5, %edx
movq %rbp, %rdi
leaq 0x7302(%rip), %rsi      # 0x85ce
callq 0x1060
jmp 0x1502
movl %eax, %r14d
shrl $0x18, %r14d
movl %eax, %ebx
shrl $0x10, %ebx
andl %r15d, %ebx
movl %eax, %r13d
shrl $0x8, %r13d
andl %r15d, %r13d
testb %cl, %cl
js 0x137b
movl $0xb, %edx
movq %rbp, %rdi
leaq 0x72ce(%rip), %rsi      # 0x85d4
callq 0x1060
movl %r14d, %esi
movq %rbp, %rdi
callq 0x1030
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x72b6(%rip), %r14      # 0x85de
movq %r14, %rsi
callq 0x1060
movl %ebx, %esi
movq %r15, %rdi
callq 0x1030
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1060
movl %r13d, %esi
movq %r15, %rdi
movl $0xff, %r15d
callq 0x1030
movl $0x4, %edx
movq %rbp, %rdi
leaq 0x7273(%rip), %rsi      # 0x85e0
callq 0x1060
movq (%rsp), %rbx
jmp 0x1502
movl %ecx, %edx
shrl $0x18, %edx
movl %ecx, %esi
shrl $0x10, %esi
andl %r15d, %esi
shrl $0x8, %ecx
andl %r15d, %ecx
movl %edx, %r15d
movl %esi, %edx
movq %rdx, 0x8(%rsp)
movl %ecx, %ecx
movq %rcx, 0x10(%rsp)
testb %al, %al
js 0x141c
movl $0xb, %edx
movq %rbp, %rbx
movq %rbp, %rdi
leaq 0x721f(%rip), %rsi      # 0x85d4
callq 0x1060
movq %rbp, %rdi
movq %r15, %rsi
callq 0x1030
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
leaq 0x7207(%rip), %r14      # 0x85de
movq %r14, %rsi
callq 0x1060
movq %rbp, %rdi
movq %rbx, %rbp
movq 0x8(%rsp), %rsi
callq 0x1030
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1060
movq %r15, %rdi
movq 0x10(%rsp), %rsi
callq 0x1030
movl $0x4, %edx
movq %rbx, %rdi
jmp 0x14ec
movl $0x7, %edx
movq %rbp, %rdi
leaq 0x71ad(%rip), %rsi      # 0x85d8
callq 0x1060
movq %rbp, %rdi
movq %r15, %rsi
callq 0x1030
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x7191(%rip), %rsi      # 0x85de
callq 0x1060
movq %r15, %rdi
movq 0x8(%rsp), %rsi
callq 0x1030
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x716d(%rip), %rsi      # 0x85de
callq 0x1060
movq %r15, %rdi
movq 0x10(%rsp), %rsi
callq 0x1030
movl $0x6, %edx
movq %rbp, %rdi
leaq 0x7158(%rip), %rsi      # 0x85ea
callq 0x1060
movl %r14d, %esi
movq %rbp, %rdi
callq 0x1030
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x712a(%rip), %r14      # 0x85de
movq %r14, %rsi
callq 0x1060
movl %ebx, %esi
movq %r15, %rdi
callq 0x1030
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1060
movl %r13d, %esi
movq %r15, %rdi
callq 0x1030
movl $0x4, %edx
movq %rbp, %rdi
leaq 0x70f2(%rip), %rsi      # 0x85e5
callq 0x1060
movq (%rsp), %rbx
movl $0xff, %r15d
incl %r12d
jmp 0x1257
leaq 0x70e0(%rip), %rsi      # 0x85f1
movl $0x4, %edx
movq %rbp, %rdi
callq 0x1060
movq %rbp, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq