#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int bin(int, int, int, int, int, int, int, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ printf(char *);
int main(void) {
  int r0, r1, r2, g0, g1, g2, b0, b1;
  int R, G, B, r, g, b;
  char tr, tg, tb;
  FILE *f;
  f = fopen("256col.html", "w");
  if (f == NULL) {
    printf("No file!\n");
    return 1;
  }
  fprintf(f, "<html>\n\t<head>\n");
  fprintf(f, "\t\t<title>minimOS palette</title>\n");
  fprintf(f, "\t</head>\n\t<body>\n");
  fprintf(f, "\t\t<table border='0'>\n");
  for (r1 = 0; r1 < 2; r1++) {
    for (g0 = 0; g0 < 2; g0++) {
      for (r0 = 0; r0 < 2; r0++) {
        for (b0 = 0; b0 < 2; b0++) {
          fprintf(f, "\t\t\t<tr>\n");
          for (g2 = 0; g2 < 2; g2++) {
            for (r2 = 0; r2 < 2; r2++) {
              for (g1 = 0; g1 < 2; g1++) {
                for (b1 = 0; b1 < 2; b1++) {
                  R = bin(r2, r1, r0, r2, r1, r0, r2, r1);
                  G = bin(g2, g1, g0, g2, g1, g0, g2, g1);
                  B = bin(b1, b0, b1, b0, b1, b0, b1, b0);
                  r = bin(0, 0, 0, 0, 0, r2, r1, r0);
                  g = bin(0, 0, 0, 0, 0, g2, g1, g0);
                  b = bin(0, 0, 0, 0, 0, 0, b1, b0);
                  tr = 48 + r;
                  tg = 48 + g;
                  tb = 48 + b;
                  fprintf(f, "\t\t\t\t<td style='color:");
                  if (tg > '3') {
                    fprintf(f, "black");
                  } else {
                    fprintf(f, "white");
                  }
                  fprintf(f, ";background-color:rgb(%d,%d,%d);'>%c%c%c<br />",
                          R, G, B, tr, tg, tb);
                  fprintf(f,
                          "<span "
                          "style='font-size:0.7em;background-color:rgb(%d,%d,%"
                          "d);'>%c%c%c</span></td>\n",
                          r * 255 / 7, g * 255 / 7, b * 255 / 3, tr, tg, tb);
                }
              }
            }
          }
          fprintf(f, "\t\t\t</tr>\n");
        }
      }
    }
  }
  fprintf(f, "\t\t</table>\n\t</body>\n</html>");
  fclose(f);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    0xe9f(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    1199 <main+0x49>
lea    0xe86(%rip),%rdi
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1530 <main+0x3e0>
mov    -0x48(%rbp),%rdi
lea    0xe74(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x48(%rbp),%rdi
lea    0xe72(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x48(%rbp),%rdi
lea    0xe82(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x48(%rbp),%rdi
lea    0xe82(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    150e <main+0x3be>
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jge    14fb <main+0x3ab>
movl   $0x0,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    14e8 <main+0x398>
movl   $0x0,-0x20(%rbp)
cmpl   $0x2,-0x20(%rbp)
jge    14d5 <main+0x385>
mov    -0x48(%rbp),%rdi
lea    0xe42(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x2,-0x1c(%rbp)
jge    14b5 <main+0x365>
movl   $0x0,-0x10(%rbp)
cmpl   $0x2,-0x10(%rbp)
jge    14a2 <main+0x352>
movl   $0x0,-0x18(%rbp)
cmpl   $0x2,-0x18(%rbp)
jge    148f <main+0x33f>
movl   $0x0,-0x24(%rbp)
cmpl   $0x2,-0x24(%rbp)
jge    147c <main+0x32c>
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%r8d
mov    -0x8(%rbp),%r9d
mov    -0x10(%rbp),%r10d
mov    -0xc(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1040 <bin@plt>
mov    %eax,-0x28(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x14(%rbp),%r9d
mov    -0x1c(%rbp),%r10d
mov    -0x18(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1040 <bin@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    -0x24(%rbp),%r8d
mov    -0x20(%rbp),%r9d
mov    -0x24(%rbp),%r10d
mov    -0x20(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1040 <bin@plt>
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%r9d
mov    -0xc(%rbp),%r10d
mov    -0x8(%rbp),%eax
xor    %r8d,%r8d
mov    %r8d,%edi
mov    %r8d,%esi
mov    %r8d,%edx
mov    %r8d,%ecx
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1040 <bin@plt>
mov    %eax,-0x34(%rbp)
mov    -0x1c(%rbp),%r9d
mov    -0x18(%rbp),%r10d
mov    -0x14(%rbp),%eax
xor    %r8d,%r8d
mov    %r8d,%edi
mov    %r8d,%esi
mov    %r8d,%edx
mov    %r8d,%ecx
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1040 <bin@plt>
mov    %eax,-0x38(%rbp)
mov    -0x24(%rbp),%r10d
mov    -0x20(%rbp),%eax
xor    %r9d,%r9d
mov    %r9d,%edi
mov    %r9d,%esi
mov    %r9d,%edx
mov    %r9d,%ecx
mov    %r9d,%r8d
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1040 <bin@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x34(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x3d(%rbp)
mov    -0x38(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x3e(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x3f(%rbp)
mov    -0x48(%rbp),%rdi
lea    0xcdc(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movsbl -0x3e(%rbp),%eax
cmp    $0x33,%eax
jle    13ca <main+0x27a>
mov    -0x48(%rbp),%rdi
lea    0xcd3(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    13dc <main+0x28c>
mov    -0x48(%rbp),%rdi
lea    0xcc2(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x48(%rbp),%rdi
mov    -0x28(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    -0x30(%rbp),%r8d
movsbl -0x3d(%rbp),%r9d
movsbl -0x3e(%rbp),%r10d
movsbl -0x3f(%rbp),%eax
lea    0xc9e(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x48(%rbp),%rdi
imul   $0xff,-0x34(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4c(%rbp)
imul   $0xff,-0x38(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
imul   $0xff,-0x3c(%rbp),%eax
mov    $0x3,%esi
cltd
idiv   %esi
mov    -0x4c(%rbp),%edx
mov    %eax,%r8d
movsbl -0x3d(%rbp),%r9d
movsbl -0x3e(%rbp),%r10d
movsbl -0x3f(%rbp),%eax
lea    0xc6d(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1271 <main+0x121>
jmp    1481 <main+0x331>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1260 <main+0x110>
jmp    1494 <main+0x344>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    124f <main+0xff>
jmp    14a7 <main+0x357>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    123e <main+0xee>
mov    -0x48(%rbp),%rdi
lea    0xc5e(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    121b <main+0xcb>
jmp    14da <main+0x38a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    120a <main+0xba>
jmp    14ed <main+0x39d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11f9 <main+0xa9>
jmp    1500 <main+0x3b0>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11e8 <main+0x98>
mov    -0x48(%rbp),%rdi
lea    0xc0f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x48(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
lea    0xe8b(%rip),%rdi
lea    0xe90(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     1561 <main+0x401>
mov    %rax,%rbx
lea    0xe7a(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1080 <fwrite@plt>
lea    0xe71(%rip),%rdi
mov    $0x21,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1080 <fwrite@plt>
lea    0xe7a(%rip),%rdi
mov    $0x11,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1080 <fwrite@plt>
lea    0xe73(%rip),%rdi
mov    $0x15,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1080 <fwrite@plt>
xor    %r15d,%r15d
mov    $0x1,%al
mov    %rbx,0x30(%rsp)
nopl   0x0(%rax,%rax,1)
mov    %eax,0x4(%rsp)
mov    $0x1,%al
xor    %ecx,%ecx
mov    %r15,0x50(%rsp)
nopl   (%rax)
mov    %rcx,0x38(%rsp)
mov    %eax,0x8(%rsp)
xor    %r12d,%r12d
mov    $0x1,%al
xchg   %ax,%ax
mov    %eax,0xc(%rsp)
mov    $0x1,%al
xor    %ecx,%ecx
mov    %r12,0x48(%rsp)
nopl   (%rax)
mov    %rcx,0x58(%rsp)
mov    %eax,0x10(%rsp)
mov    $0x8,%esi
mov    $0x1,%edx
lea    0xe1e(%rip),%rdi
mov    %rbx,%rcx
call   1080 <fwrite@plt>
xor    %ebp,%ebp
mov    $0x1,%al
cs nopw 0x0(%rax,%rax,1)
mov    %eax,0x14(%rsp)
mov    $0x1,%al
xor    %ecx,%ecx
mov    %rbp,0x60(%rsp)
nopl   (%rax)
mov    %rcx,0x68(%rsp)
mov    %eax,0x18(%rsp)
xor    %ecx,%ecx
mov    $0x1,%al
nopl   (%rax)
mov    %rcx,0x40(%rsp)
mov    %eax,0x1c(%rsp)
mov    $0x1,%al
xor    %r14d,%r14d
xchg   %ax,%ax
mov    %eax,0x2c(%rsp)
mov    %r12,%rbx
mov    %r15,%r12
mov    0x68(%rsp),%r15
mov    %r15d,%edi
mov    %r12d,%esi
mov    %ebx,%edx
mov    %r15d,%ecx
mov    %r12d,%r8d
mov    %ebx,%r9d
push   %r12
push   %r15
call   1050 <bin@plt>
add    $0x10,%rsp
mov    %eax,0x28(%rsp)
mov    %ebp,%edi
mov    0x40(%rsp),%rsi
mov    0x38(%rsp),%rdx
mov    %ebp,%ecx
mov    %esi,%r8d
mov    %edx,%r9d
push   %rsi
push   %rbp
call   1050 <bin@plt>
add    $0x10,%rsp
mov    %eax,0x24(%rsp)
mov    %r14d,%edi
mov    0x58(%rsp),%r13
mov    %r13d,%esi
mov    %r14d,%edx
mov    %r13d,%ecx
mov    %r14d,%r8d
mov    %r13d,%r9d
push   %r13
push   %r14
call   1050 <bin@plt>
add    $0x10,%rsp
mov    %eax,0x20(%rsp)
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %r15d,%r9d
push   %rbx
push   %r12
call   1050 <bin@plt>
add    $0x10,%rsp
mov    %eax,%r12d
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %ebp,%r9d
push   0x38(%rsp)
push   0x48(%rsp)
call   1050 <bin@plt>
add    $0x10,%rsp
mov    %eax,%r15d
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   %r13
push   %r14
call   1050 <bin@plt>
add    $0x10,%rsp
mov    %eax,%ebp
mov    %rbp,0x70(%rsp)
mov    $0x15,%esi
mov    $0x1,%edx
lea    0xcf3(%rip),%rdi
mov    0x30(%rsp),%r14
mov    %r14,%rcx
call   1080 <fwrite@plt>
mov    %r15d,%eax
shl    $0x18,%eax
add    $0x30000000,%eax
mov    %eax,%ebx
sar    $0x18,%ebx
cmp    $0x33000001,%eax
lea    0xce6(%rip),%rdi
lea    0xcd9(%rip),%rax
cmovge %rax,%rdi
mov    $0x5,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
lea    0x30(%r12),%eax
movsbl %al,%r9d
lea    0x30(%rbp),%eax
movsbl %al,%r13d
mov    %r14,%rdi
lea    0xcb5(%rip),%rsi
mov    0x28(%rsp),%edx
mov    0x24(%rsp),%ecx
mov    0x20(%rsp),%r8d
mov    %r9d,%ebp
xor    %eax,%eax
push   %r13
push   %rbx
call   1060 <fprintf@plt>
add    $0x10,%rsp
mov    %r12d,%eax
shl    $0x8,%eax
sub    %r12d,%eax
mov    0x48(%rsp),%r12
lea    0xcb1(%rip),%rsi
movslq %eax,%rdx
imul   $0xffffffff92492493,%rdx,%rax
shr    $0x20,%rax
add    %eax,%edx
mov    %edx,%eax
shr    $0x1f,%eax
sar    $0x2,%edx
add    %eax,%edx
mov    %r15d,%eax
shl    $0x8,%eax
sub    %r15d,%eax
mov    0x50(%rsp),%r15
movslq %eax,%rcx
imul   $0xffffffff92492493,%rcx,%rax
shr    $0x20,%rax
add    %eax,%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
sar    $0x2,%ecx
add    %eax,%ecx
imul   $0x55,0x70(%rsp),%r8d
mov    %r14,%rdi
mov    %ebp,%r9d
xor    %eax,%eax
push   %r13
push   %rbx
mov    0x70(%rsp),%rbp
call   1060 <fprintf@plt>
add    $0x10,%rsp
mov    $0x1,%r14d
testb  $0x1,0x2c(%rsp)
mov    $0x0,%eax
jne    1290 <main+0x130>
mov    $0x1,%ecx
testb  $0x1,0x1c(%rsp)
mov    $0x0,%eax
jne    1280 <main+0x120>
mov    $0x1,%ecx
testb  $0x1,0x18(%rsp)
mov    $0x0,%eax
jne    1270 <main+0x110>
mov    $0x1,%ebp
testb  $0x1,0x14(%rsp)
mov    $0x0,%eax
jne    1260 <main+0x100>
mov    $0x9,%esi
mov    $0x1,%edx
lea    0xc3c(%rip),%rdi
mov    0x30(%rsp),%rbx
mov    %rbx,%rcx
call   1080 <fwrite@plt>
mov    $0x1,%ecx
testb  $0x1,0x10(%rsp)
mov    $0x0,%eax
jne    1230 <main+0xd0>
mov    $0x1,%r12d
testb  $0x1,0xc(%rsp)
mov    $0x0,%eax
jne    1220 <main+0xc0>
mov    $0x1,%ecx
testb  $0x1,0x8(%rsp)
mov    $0x0,%eax
jne    1210 <main+0xb0>
mov    $0x1,%r15d
xor    %r14d,%r14d
testb  $0x1,0x4(%rsp)
mov    $0x0,%eax
jne    1200 <main+0xa0>
lea    0xbd9(%rip),%rdi
mov    $0x1b,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1080 <fwrite@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
jmp    1573 <main+0x413>
lea    0xbd2(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"256col.html\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [10 x i8] c"No file!\0A\00"
@.str.3 = [16 x i8] c"<html>\0A\09<head>\0A\00"
@.str.4 = [34 x i8] c"\09\09<title>minimOS palette</title>\0A\00"
@.str.5 = [18 x i8] c"\09</head>\0A\09<body>\0A\00"
@.str.6 = [22 x i8] c"\09\09<table border='0'>\0A\00"
@.str.7 = [9 x i8] c"\09\09\09<tr>\0A\00"
@.str.8 = [22 x i8] c"\09\09\09\09<td style='color:\00"
@.str.9 = [6 x i8] c"black\00"
@.str.10 = [6 x i8] c"white\00"
@.str.11 = [47 x i8] c";background-color:rgb(%d,%d,%d);'>%c%c%c<br />\00"
@.str.12 = [82 x i8] c"<span style='font-size:0.7em;background-color:rgb(%d,%d,%d);'>%c%c%c</span></td>\0A\00"
@.str.13 = [10 x i8] c"\09\09\09</tr>\0A\00"
@.str.14 = [28 x i8] c"\09\09</table>\0A\09</body>\0A</html>\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i8
%17 = alloca i8
%18 = alloca i8
%19 = alloca i32*
store i32 0, i32* %1
%20 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %20, i32** %19
%21 = load i32*, i32** %19
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %25
23: ; preds = %0
%24 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %193
25: ; preds = %0
%26 = load i32*, i32** %19
%27 = call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%28 = load i32*, i32** %19
%29 = call i32 (i32*, i8*, ...) @fprintf(i32* %28, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
%30 = load i32*, i32** %19
%31 = call i32 (i32*, i8*, ...) @fprintf(i32* %30, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%32 = load i32*, i32** %19
%33 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %3
br label %34
34: ; preds = %185, %25
%35 = load i32, i32* %3
%36 = icmp slt i32 %35, 2
br i1 %36, label %37, label %188
37: ; preds = %34
store i32 0, i32* %5
br label %38
38: ; preds = %181, %37
%39 = load i32, i32* %5
%40 = icmp slt i32 %39, 2
br i1 %40, label %41, label %184
41: ; preds = %38
store i32 0, i32* %2
br label %42
42: ; preds = %177, %41
%43 = load i32, i32* %2
%44 = icmp slt i32 %43, 2
br i1 %44, label %45, label %180
45: ; preds = %42
store i32 0, i32* %8
br label %46
46: ; preds = %173, %45
%47 = load i32, i32* %8
%48 = icmp slt i32 %47, 2
br i1 %48, label %49, label %176
49: ; preds = %46
%50 = load i32*, i32** %19
%51 = call i32 (i32*, i8*, ...) @fprintf(i32* %50, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %7
br label %52
52: ; preds = %167, %49
%53 = load i32, i32* %7
%54 = icmp slt i32 %53, 2
br i1 %54, label %55, label %170
55: ; preds = %52
store i32 0, i32* %4
br label %56
56: ; preds = %163, %55
%57 = load i32, i32* %4
%58 = icmp slt i32 %57, 2
br i1 %58, label %59, label %166
59: ; preds = %56
store i32 0, i32* %6
br label %60
60: ; preds = %159, %59
%61 = load i32, i32* %6
%62 = icmp slt i32 %61, 2
br i1 %62, label %63, label %162
63: ; preds = %60
store i32 0, i32* %9
br label %64
64: ; preds = %155, %63
%65 = load i32, i32* %9
%66 = icmp slt i32 %65, 2
br i1 %66, label %67, label %158
67: ; preds = %64
%68 = load i32, i32* %4
%69 = load i32, i32* %3
%70 = load i32, i32* %2
%71 = load i32, i32* %4
%72 = load i32, i32* %3
%73 = load i32, i32* %2
%74 = load i32, i32* %4
%75 = load i32, i32* %3
%76 = call i32 @bin(i32 %68, i32 %69, i32 %70, i32 %71, i32 %72, i32 %73, i32 %74, i32 %75)
store i32 %76, i32* %10
%77 = load i32, i32* %7
%78 = load i32, i32* %6
%79 = load i32, i32* %5
%80 = load i32, i32* %7
%81 = load i32, i32* %6
%82 = load i32, i32* %5
%83 = load i32, i32* %7
%84 = load i32, i32* %6
%85 = call i32 @bin(i32 %77, i32 %78, i32 %79, i32 %80, i32 %81, i32 %82, i32 %83, i32 %84)
store i32 %85, i32* %11
%86 = load i32, i32* %9
%87 = load i32, i32* %8
%88 = load i32, i32* %9
%89 = load i32, i32* %8
%90 = load i32, i32* %9
%91 = load i32, i32* %8
%92 = load i32, i32* %9
%93 = load i32, i32* %8
%94 = call i32 @bin(i32 %86, i32 %87, i32 %88, i32 %89, i32 %90, i32 %91, i32 %92, i32 %93)
store i32 %94, i32* %12
%95 = load i32, i32* %4
%96 = load i32, i32* %3
%97 = load i32, i32* %2
%98 = call i32 @bin(i32 0, i32 0, i32 0, i32 0, i32 0, i32 %95, i32 %96, i32 %97)
store i32 %98, i32* %13
%99 = load i32, i32* %7
%100 = load i32, i32* %6
%101 = load i32, i32* %5
%102 = call i32 @bin(i32 0, i32 0, i32 0, i32 0, i32 0, i32 %99, i32 %100, i32 %101)
store i32 %102, i32* %14
%103 = load i32, i32* %9
%104 = load i32, i32* %8
%105 = call i32 @bin(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 %103, i32 %104)
store i32 %105, i32* %15
%106 = load i32, i32* %13
%107 = add nsw i32 48, %106
%108 = trunc i32 %107 to i8
store i8 %108, i8* %16
%109 = load i32, i32* %14
%110 = add nsw i32 48, %109
%111 = trunc i32 %110 to i8
store i8 %111, i8* %17
%112 = load i32, i32* %15
%113 = add nsw i32 48, %112
%114 = trunc i32 %113 to i8
store i8 %114, i8* %18
%115 = load i32*, i32** %19
%116 = call i32 (i32*, i8*, ...) @fprintf(i32* %115, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0))
%117 = load i8, i8* %17
%118 = sext i8 %117 to i32
%119 = icmp sgt i32 %118, 51
br i1 %119, label %120, label %123
120: ; preds = %67
%121 = load i32*, i32** %19
%122 = call i32 (i32*, i8*, ...) @fprintf(i32* %121, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
br label %126
123: ; preds = %67
%124 = load i32*, i32** %19
%125 = call i32 (i32*, i8*, ...) @fprintf(i32* %124, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0))
br label %126
126: ; preds = %123, %120
%127 = load i32*, i32** %19
%128 = load i32, i32* %10
%129 = load i32, i32* %11
%130 = load i32, i32* %12
%131 = load i8, i8* %16
%132 = sext i8 %131 to i32
%133 = load i8, i8* %17
%134 = sext i8 %133 to i32
%135 = load i8, i8* %18
%136 = sext i8 %135 to i32
%137 = call i32 (i32*, i8*, ...) @fprintf(i32* %127, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.11, i64 0, i64 0), i32 %128, i32 %129, i32 %130, i32 %132, i32 %134, i32 %136)
%138 = load i32*, i32** %19
%139 = load i32, i32* %13
%140 = mul nsw i32 %139, 255
%141 = sdiv i32 %140, 7
%142 = load i32, i32* %14
%143 = mul nsw i32 %142, 255
%144 = sdiv i32 %143, 7
%145 = load i32, i32* %15
%146 = mul nsw i32 %145, 255
%147 = sdiv i32 %146, 3
%148 = load i8, i8* %16
%149 = sext i8 %148 to i32
%150 = load i8, i8* %17
%151 = sext i8 %150 to i32
%152 = load i8, i8* %18
%153 = sext i8 %152 to i32
%154 = call i32 (i32*, i8*, ...) @fprintf(i32* %138, i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.12, i64 0, i64 0), i32 %141, i32 %144, i32 %147, i32 %149, i32 %151, i32 %153)
br label %155
155: ; preds = %126
%156 = load i32, i32* %9
%157 = add nsw i32 %156, 1
store i32 %157, i32* %9
br label %64
158: ; preds = %64
br label %159
159: ; preds = %158
%160 = load i32, i32* %6
%161 = add nsw i32 %160, 1
store i32 %161, i32* %6
br label %60
162: ; preds = %60
br label %163
163: ; preds = %162
%164 = load i32, i32* %4
%165 = add nsw i32 %164, 1
store i32 %165, i32* %4
br label %56
166: ; preds = %56
br label %167
167: ; preds = %166
%168 = load i32, i32* %7
%169 = add nsw i32 %168, 1
store i32 %169, i32* %7
br label %52
170: ; preds = %52
%171 = load i32*, i32** %19
%172 = call i32 (i32*, i8*, ...) @fprintf(i32* %171, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0))
br label %173
173: ; preds = %170
%174 = load i32, i32* %8
%175 = add nsw i32 %174, 1
store i32 %175, i32* %8
br label %46
176: ; preds = %46
br label %177
177: ; preds = %176
%178 = load i32, i32* %2
%179 = add nsw i32 %178, 1
store i32 %179, i32* %2
br label %42
180: ; preds = %42
br label %181
181: ; preds = %180
%182 = load i32, i32* %5
%183 = add nsw i32 %182, 1
store i32 %183, i32* %5
br label %38
184: ; preds = %38
br label %185
185: ; preds = %184
%186 = load i32, i32* %3
%187 = add nsw i32 %186, 1
store i32 %187, i32* %3
br label %34
188: ; preds = %34
%189 = load i32*, i32** %19
%190 = call i32 (i32*, i8*, ...) @fprintf(i32* %189, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.14, i64 0, i64 0))
%191 = load i32*, i32** %19
%192 = call i32 @fclose(i32* %191)
store i32 0, i32* %1
br label %193
193: ; preds = %188, %23
%194 = load i32, i32* %1
ret i32 %194
}

LLVM IR (-O2):
@.str = [12 x i8] c"256col.html\00"
@.str.1 = [2 x i8] c"w\00"
@.str.3 = [16 x i8] c"<html>\0A\09<head>\0A\00"
@.str.4 = [34 x i8] c"\09\09<title>minimOS palette</title>\0A\00"
@.str.5 = [18 x i8] c"\09</head>\0A\09<body>\0A\00"
@.str.6 = [22 x i8] c"\09\09<table border='0'>\0A\00"
@.str.7 = [9 x i8] c"\09\09\09<tr>\0A\00"
@.str.8 = [22 x i8] c"\09\09\09\09<td style='color:\00"
@.str.9 = [6 x i8] c"black\00"
@.str.10 = [6 x i8] c"white\00"
@.str.11 = [47 x i8] c";background-color:rgb(%d,%d,%d);'>%c%c%c<br />\00"
@.str.12 = [82 x i8] c"<span style='font-size:0.7em;background-color:rgb(%d,%d,%d);'>%c%c%c</span></td>\0A\00"
@.str.13 = [10 x i8] c"\09\09\09</tr>\0A\00"
@.str.14 = [28 x i8] c"\09\09</table>\0A\09</body>\0A</html>\00"
@str = [9 x i8] c"No file!\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
br label %72
5: ; preds = %0
%6 = tail call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i64 15, i64 1, i32* %1)
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i64 33, i64 1, i32* %1)
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i64 17, i64 1, i32* %1)
%9 = tail call i64 @fwrite(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i64 21, i64 1, i32* %1)
br label %10
10: ; preds = %5, %68
%11 = phi i1 [ true, %5 ], [ false, %68 ]
%12 = phi i32 [ 0, %5 ], [ 1, %68 ]
br label %13
13: ; preds = %10, %67
%14 = phi i1 [ true, %10 ], [ false, %67 ]
%15 = phi i32 [ 0, %10 ], [ 1, %67 ]
br label %16
16: ; preds = %13, %66
%17 = phi i1 [ true, %13 ], [ false, %66 ]
%18 = phi i32 [ 0, %13 ], [ 1, %66 ]
br label %19
19: ; preds = %16, %64
%20 = phi i1 [ true, %16 ], [ false, %64 ]
%21 = phi i32 [ 0, %16 ], [ 1, %64 ]
%22 = tail call i64 @fwrite(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i64 8, i64 1, i32* %1)
br label %23
23: ; preds = %19, %63
%24 = phi i1 [ true, %19 ], [ false, %63 ]
%25 = phi i32 [ 0, %19 ], [ 1, %63 ]
br label %26
26: ; preds = %23, %62
%27 = phi i1 [ true, %23 ], [ false, %62 ]
%28 = phi i32 [ 0, %23 ], [ 1, %62 ]
br label %29
29: ; preds = %26, %61
%30 = phi i1 [ true, %26 ], [ false, %61 ]
%31 = phi i32 [ 0, %26 ], [ 1, %61 ]
br label %32
32: ; preds = %29, %32
%33 = phi i1 [ true, %29 ], [ false, %32 ]
%34 = phi i32 [ 0, %29 ], [ 1, %32 ]
%35 = tail call i32 @bin(i32 %28, i32 %12, i32 %18, i32 %28, i32 %12, i32 %18, i32 %28, i32 %12)
%36 = tail call i32 @bin(i32 %25, i32 %31, i32 %15, i32 %25, i32 %31, i32 %15, i32 %25, i32 %31)
%37 = tail call i32 @bin(i32 %34, i32 %21, i32 %34, i32 %21, i32 %34, i32 %21, i32 %34, i32 %21)
%38 = tail call i32 @bin(i32 0, i32 0, i32 0, i32 0, i32 0, i32 %28, i32 %12, i32 %18)
%39 = tail call i32 @bin(i32 0, i32 0, i32 0, i32 0, i32 0, i32 %25, i32 %31, i32 %15)
%40 = tail call i32 @bin(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 %34, i32 %21)
%41 = tail call i64 @fwrite(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), i64 21, i64 1, i32* %1)
%42 = shl i32 %39, 24
%43 = add i32 %42, 805306368
%44 = ashr exact i32 %43, 24
%45 = icmp sgt i32 %43, 855638016
%46 = select i1 %45, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0)
%47 = tail call i64 @fwrite(i8* %46, i64 5, i64 1, i32* %1)
%48 = shl i32 %38, 24
%49 = add i32 %48, 805306368
%50 = ashr exact i32 %49, 24
%51 = shl i32 %40, 24
%52 = add i32 %51, 805306368
%53 = ashr exact i32 %52, 24
%54 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.11, i64 0, i64 0), i32 %35, i32 %36, i32 %37, i32 %50, i32 %44, i32 %53)
%55 = mul nsw i32 %38, 255
%56 = sdiv i32 %55, 7
%57 = mul nsw i32 %39, 255
%58 = sdiv i32 %57, 7
%59 = mul nsw i32 %40, 85
%60 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.12, i64 0, i64 0), i32 %56, i32 %58, i32 %59, i32 %50, i32 %44, i32 %53)
br i1 %33, label %32, label %61
61: ; preds = %32
br i1 %30, label %29, label %62
62: ; preds = %61
br i1 %27, label %26, label %63
63: ; preds = %62
br i1 %24, label %23, label %64
64: ; preds = %63
%65 = tail call i64 @fwrite(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0), i64 9, i64 1, i32* %1)
br i1 %20, label %19, label %66
66: ; preds = %64
br i1 %17, label %16, label %67
67: ; preds = %66
br i1 %14, label %13, label %68
68: ; preds = %67
br i1 %11, label %10, label %69
69: ; preds = %68
%70 = tail call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.14, i64 0, i64 0), i64 27, i64 1, i32* %1)
%71 = tail call i32 @fclose(i32* %1)
br label %72
72: ; preds = %69, %3
%73 = phi i32 [ 1, %3 ], [ 0, %69 ]
ret i32 %73
}