#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*/ line;
typedef int /*<<< orphan*/ fname;
typedef int /*<<< orphan*/ cmd;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
unsigned char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int /*<<< orphan*/ sscanf(char *, char *, int *, int *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int main(int argc, char *argv[]) {
  FILE *fi, *fo;
  int half, x, y, yy, b, c, bits, tot;
  char line[1024], fname[1024], cmd[1024];
  unsigned char data[256 * 32];
  int png_w, png_h, chopping, out_h, font_rows;
  if (argc != 4) {
    fprintf(stderr, "Usage: %s input.png {1|2} output.fnt\n", argv[0]);
    exit(1);
  }
  half = atoi(argv[2]);
  snprintf(cmd, sizeof(cmd), "/usr/bin/pngtopnm %s", argv[1]);
  fi = popen(cmd, "r");
  if (fi == NULL) {
    fprintf(stderr, "can't open input\n");
    exit(1);
  }
  strncpy(fname, argv[3], sizeof(fname));
  fo = fopen(fname, "w");
  if (fo == NULL) {
    perror(fname);
    pclose(fi);
    exit(1);
  }
  fgets(line, sizeof(line), fi);
  if (strcmp(line, "P5\n") != 0) {
    fprintf(stderr, "Not a P5\n");
    exit(1);
  }
  fgets(line, sizeof(line), fi);
  if (strcmp(line, "160 48\n") != 0 && strcmp(line, "256 32\n") != 0) {
    fprintf(stderr, "Not 160x48 or 256x32\n");
    exit(1);
  }
  sscanf(line, "%d %d", &png_w, &png_h);
  if (png_w == 160 && png_h == 48) {
    chopping = 1;
    out_h = png_h / 2;
    font_rows = 3;
    printf("Chopping half #%d of %s\n", half, argv[1]);
  } else {
    chopping = 0;
    font_rows = 4;
    out_h = png_h;
  }
  fgets(line, sizeof(line), fi);
  if (strcmp(line, "255\n") != 0) {
    fprintf(stderr, "Not 8-bit\n");
    exit(1);
  }
  if (chopping) {
    if (half == 2) {
      for (y = 0; y < (png_h / 2); y++) {
        for (x = 0; x < png_w; x++) {
          fgetc(fi);
        }
      }
      printf("Skipped for %d rows of %d columns (%d bytes)\n", png_h / 2, png_w,
             (png_h / 2) * png_w);
    }
  }
  for (y = 0; y < out_h; y++) {
    for (x = 0; x < png_w; x++) {
      data[y * png_w + x] = fgetc(fi);
    }
  }
  printf("Collected %d rows of %d columns (%d bytes)\n", out_h, png_w,
         out_h * png_w);
  printf("Processing %d rows of %d characters (x8 = %d bytes)\n", font_rows,
         png_w / 8, font_rows * png_w);
  for (y = 0; y < font_rows; y++) {
    for (x = 0; x < (png_w / 8); x++) {
      for (yy = 0; yy < 8; yy++) {
        bits = 256;
        tot = 0;
        for (b = 0; b < 8; b++) {
          bits = bits / 2;
          c = data[(y * 8 + yy) * png_w + (x * 8) + b];
          if (c == 255) {
            tot = tot + bits;
          }
        }
        fputc(tot, fo);
      }
    }
  }
  if (chopping) {
    for (c = 480; c < 512; c++) {
      fputc(0, fo);
    }
  }
  pclose(fi);
  fclose(fo);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2c60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     124b <main+0x4b>
mov    0x2db6(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdc6(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1110 <atoi@plt>
mov    %eax,-0x24(%rbp)
lea    -0xc40(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
mov    $0x400,%esi
lea    0xdb0(%rip),%rdx
call   1070 <snprintf@plt>
lea    -0xc40(%rbp),%rdi
lea    0xdb2(%rip),%rsi
call   10e0 <popen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    12be <main+0xbe>
mov    0x2d3c(%rip),%rax
mov    (%rax),%edi
lea    0xd90(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
lea    -0x840(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
mov    $0x400,%edx
call   1030 <strncpy@plt>
lea    -0x840(%rbp),%rdi
lea    0xd6a(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1318 <main+0x118>
lea    -0x840(%rbp),%rdi
call   1100 <perror@plt>
mov    -0x18(%rbp),%rdi
call   1060 <pclose@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
lea    -0x440(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x400,%esi
call   10a0 <fgets@plt>
lea    -0x440(%rbp),%rdi
lea    0xd1c(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
je     136b <main+0x16b>
mov    0x2c8f(%rip),%rax
mov    (%rax),%edi
lea    0xcf7(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
lea    -0x440(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x400,%esi
call   10a0 <fgets@plt>
lea    -0x440(%rbp),%rdi
lea    0xccd(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
je     13db <main+0x1db>
lea    -0x440(%rbp),%rdi
lea    0xcb8(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
je     13db <main+0x1db>
mov    0x2c1f(%rip),%rax
mov    (%rax),%edi
lea    0xca1(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
lea    -0x440(%rbp),%rdi
lea    0xc98(%rip),%rsi
lea    -0x2c44(%rbp),%rdx
lea    -0x2c48(%rbp),%rcx
call   10d0 <sscanf@plt>
cmpl   $0xa0,-0x2c44(%rbp)
jne    145f <main+0x25f>
cmpl   $0x30,-0x2c48(%rbp)
jne    145f <main+0x25f>
movl   $0x1,-0x2c4c(%rbp)
mov    -0x2c48(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x2c50(%rbp)
movl   $0x3,-0x2c54(%rbp)
mov    -0x24(%rbp),%esi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xc34(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    147f <main+0x27f>
movl   $0x0,-0x2c4c(%rbp)
movl   $0x4,-0x2c54(%rbp)
mov    -0x2c48(%rbp),%eax
mov    %eax,-0x2c50(%rbp)
lea    -0x440(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x400,%esi
call   10a0 <fgets@plt>
lea    -0x440(%rbp),%rdi
lea    0xbfe(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
je     14d2 <main+0x2d2>
mov    0x2b28(%rip),%rax
mov    (%rax),%edi
lea    0xbe4(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
cmpl   $0x0,-0x2c4c(%rbp)
je     15a3 <main+0x3a3>
cmpl   $0x2,-0x24(%rbp)
jne    159e <main+0x39e>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x2c58(%rbp)
mov    -0x2c48(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x2c58(%rbp),%eax
cmp    %ecx,%eax
jge    1557 <main+0x357>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x2c44(%rbp),%eax
jge    1544 <main+0x344>
mov    -0x18(%rbp),%rdi
call   1080 <fgetc@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    151e <main+0x31e>
jmp    1549 <main+0x349>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    14f0 <main+0x2f0>
mov    -0x2c48(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x2c44(%rbp),%eax
mov    %eax,-0x2c5c(%rbp)
mov    -0x2c48(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0x2c5c(%rbp),%edx
mov    %eax,%ecx
imul   -0x2c44(%rbp),%ecx
lea    0xb19(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    15a3 <main+0x3a3>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x2c50(%rbp),%eax
jge    1611 <main+0x411>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x2c44(%rbp),%eax
jge    15fe <main+0x3fe>
mov    -0x18(%rbp),%rdi
call   1080 <fgetc@plt>
mov    %al,%cl
mov    -0x2c(%rbp),%eax
imul   -0x2c44(%rbp),%eax
add    -0x28(%rbp),%eax
cltq
mov    %cl,-0x2c40(%rbp,%rax,1)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    15c0 <main+0x3c0>
jmp    1603 <main+0x403>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    15aa <main+0x3aa>
mov    -0x2c50(%rbp),%esi
mov    -0x2c44(%rbp),%edx
mov    -0x2c50(%rbp),%ecx
imul   -0x2c44(%rbp),%ecx
lea    0xaad(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x2c54(%rbp),%esi
mov    -0x2c44(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
mov    -0x2c54(%rbp),%ecx
imul   -0x2c44(%rbp),%ecx
lea    0xaa8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x2c54(%rbp),%eax
jge    177c <main+0x57c>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x2c60(%rbp)
mov    -0x2c44(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x2c60(%rbp),%eax
cmp    %ecx,%eax
jge    1769 <main+0x569>
movl   $0x0,-0x30(%rbp)
cmpl   $0x8,-0x30(%rbp)
jge    1756 <main+0x556>
movl   $0x100,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x8,-0x34(%rbp)
jge    173c <main+0x53c>
mov    -0x3c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x3c(%rbp)
mov    -0x2c(%rbp),%eax
shl    $0x3,%eax
add    -0x30(%rbp),%eax
imul   -0x2c44(%rbp),%eax
mov    -0x28(%rbp),%ecx
shl    $0x3,%ecx
add    %ecx,%eax
add    -0x34(%rbp),%eax
cltq
movzbl -0x2c40(%rbp,%rax,1),%eax
ff
mov    %eax,-0x38(%rbp)
cmpl   $0xff,-0x38(%rbp)
jne    1729 <main+0x529>
mov    -0x40(%rbp),%eax
add    -0x3c(%rbp),%eax
mov    %eax,-0x40(%rbp)
jmp    172e <main+0x52e>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    16d3 <main+0x4d3>
mov    -0x40(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1090 <fputc@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    16b4 <main+0x4b4>
jmp    175b <main+0x55b>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1686 <main+0x486>
jmp    176e <main+0x56e>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1670 <main+0x470>
cmpl   $0x0,-0x2c4c(%rbp)
je     17bb <main+0x5bb>
movl   $0x1e0,-0x38(%rbp)
cmpl   $0x200,-0x38(%rbp)
jge    17b6 <main+0x5b6>
mov    -0x20(%rbp),%rsi
xor    %edi,%edi
call   1090 <fputc@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1790 <main+0x590>
jmp    17bb <main+0x5bb>
mov    -0x18(%rbp),%rdi
call   1060 <pclose@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x2c60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2c58,%rsp
mov    %rsi,%rbp
cmp    $0x4,%edi
jne    17ca <main+0x5ca>
mov    0x10(%rbp),%rdi
call   1110 <atoi@plt>
mov    %eax,%r13d
mov    0x8(%rbp),%rcx
lea    0xdf2(%rip),%rdx
lea    0x2850(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1070 <snprintf@plt>
lea    0xdeb(%rip),%rsi
mov    %rbx,%rdi
call   10e0 <popen@plt>
test   %rax,%rax
je     17ef <main+0x5ef>
mov    %rax,%r14
mov    0x18(%rbp),%rsi
lea    0x450(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x400,%edx
call   1030 <strncpy@plt>
lea    0xdcb(%rip),%rsi
mov    %rbx,%rdi
call   10f0 <fopen@plt>
mov    %rax,0x10(%rsp)
test   %rax,%rax
je     1801 <main+0x601>
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r14,%rdx
call   10a0 <fgets@plt>
lea    0xda1(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <strcmp@plt>
test   %rax,%rax
jne    1820 <main+0x620>
mov    %rbp,%rbx
lea    0x50(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x400,%esi
mov    %r14,%rdx
call   10a0 <fgets@plt>
lea    0xd75(%rip),%rsi
mov    %rbp,%rdi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     130d <main+0x10d>
lea    0xd69(%rip),%rsi
lea    0x50(%rsp),%rdi
call   10b0 <strcmp@plt>
test   %rax,%rax
jne    1844 <main+0x644>
lea    0xd6d(%rip),%rsi
lea    0x50(%rsp),%rdi
mov    %rsp,%rdx
lea    0xc(%rsp),%rcx
call   10d0 <sscanf@plt>
mov    $0xa0,%eax
xor    (%rsp),%eax
mov    0xc(%rsp),%r12d
mov    %r12d,%ecx
xor    $0x30,%ecx
or     %eax,%ecx
sete   %r15b
movl   $0x4,0x8(%rsp)
jne    136c <main+0x16c>
mov    0x8(%rbx),%rdx
lea    0xd33(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x3,0x8(%rsp)
mov    $0x18,%r12d
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r14,%rdx
call   10a0 <fgets@plt>
lea    0xd18(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <strcmp@plt>
test   %rax,%rax
jne    1832 <main+0x632>
cmp    $0x2,%r13d
sete   %al
and    %r15b,%al
cmp    $0x1,%al
jne    1417 <main+0x217>
mov    0xc(%rsp),%eax
cmp    $0x1,%eax
jle    13f8 <main+0x1f8>
xor    %ebx,%ebx
mov    (%rsp),%edx
jmp    13d0 <main+0x1d0>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
mov    %eax,%esi
shr    $0x1f,%esi
add    %eax,%esi
sar    %esi
cmp    %esi,%ebx
jge    1404 <main+0x204>
test   %edx,%edx
jle    13c0 <main+0x1c0>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1080 <fgetc@plt>
add    $0x1,%ebp
mov    (%rsp),%edx
cmp    %edx,%ebp
jl     13e0 <main+0x1e0>
mov    0xc(%rsp),%eax
jmp    13c0 <main+0x1c0>
mov    %eax,%esi
shr    $0x1f,%esi
add    %eax,%esi
sar    %esi
mov    (%rsp),%edx
mov    %edx,%ecx
imul   %esi,%ecx
lea    0xca0(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%edx
test   %r12d,%r12d
jle    146b <main+0x26b>
xor    %ebx,%ebx
jmp    1438 <main+0x238>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%ebx
cmp    %r12d,%ebx
je     146b <main+0x26b>
test   %edx,%edx
jle    1430 <main+0x230>
xor    %ebp,%ebp
xchg   %ax,%ax
mov    %r14,%rdi
call   1080 <fgetc@plt>
mov    (%rsp),%edx
mov    %ebx,%ecx
imul   %edx,%ecx
movslq %ecx,%rcx
add    %rsp,%rcx
add    $0x850,%rcx
mov    %al,0x0(%rbp,%rcx,1)
add    $0x1,%rbp
cmp    %edx,%ebp
jl     1440 <main+0x240>
jmp    1430 <main+0x230>
mov    %r15b,0x7(%rsp)
mov    %r14,0x28(%rsp)
mov    %edx,%ecx
imul   %r12d,%ecx
lea    0xc5c(%rip),%rdi
xor    %eax,%eax
mov    %rax,0x18(%rsp)
mov    %r12d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%ecx
lea    0x7(%rcx),%edx
test   %ecx,%ecx
cmovns %ecx,%edx
sar    $0x3,%edx
mov    0x8(%rsp),%esi
imul   %esi,%ecx
lea    0xc5b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%ecx
xor    %edx,%edx
jmp    14de <main+0x2de>
nopl   (%rax)
mov    0x24(%rsp),%edx
add    $0x1,%edx
mov    0x18(%rsp),%rax
add    $0x8,%eax
mov    %rax,0x18(%rsp)
cmp    0x8(%rsp),%edx
je     1652 <main+0x452>
mov    %edx,0x24(%rsp)
cmp    $0x8,%ecx
jl     14c0 <main+0x2c0>
xor    %edx,%edx
jmp    150e <main+0x30e>
nopl   0x0(%rax,%rax,1)
mov    0x30(%rsp),%rdx
add    $0x1,%rdx
mov    (%rsp),%ecx
lea    0x7(%rcx),%eax
test   %ecx,%ecx
cmovns %ecx,%eax
sar    $0x3,%eax
cltq
cmp    %rax,%rdx
jge    14c0 <main+0x2c0>
lea    0x0(,%rdx,8),%eax
mov    %rax,0x48(%rsp)
lea    0x1(,%rdx,8),%eax
mov    %rax,0x40(%rsp)
lea    0x2(,%rdx,8),%eax
mov    %rax,0x38(%rsp)
lea    0x3(,%rdx,8),%r13d
lea    0x4(,%rdx,8),%ebx
lea    0x5(,%rdx,8),%ebp
lea    0x6(,%rdx,8),%r15d
mov    %rdx,0x30(%rsp)
lea    0x7(,%rdx,8),%r14d
xor    %r12d,%r12d
mov    0x18(%rsp),%rax
add    %r12d,%eax
imul   %ecx,%eax
mov    0x48(%rsp),%rcx
add    %eax,%ecx
movslq %ecx,%rcx
xor    %edx,%edx
cmpb   $0xff,0x850(%rsp,%rcx,1)
ff
sete   %dl
shl    $0x7,%edx
mov    0x40(%rsp),%rcx
add    %eax,%ecx
movslq %ecx,%rcx
xor    %esi,%esi
cmpb   $0xff,0x850(%rsp,%rcx,1)
ff
sete   %sil
shl    $0x6,%esi
or     %edx,%esi
mov    0x38(%rsp),%rcx
add    %eax,%ecx
movslq %ecx,%rcx
xor    %edx,%edx
cmpb   $0xff,0x850(%rsp,%rcx,1)
ff
sete   %dl
shl    $0x5,%edx
or     %esi,%edx
lea    (%rax,%r13,1),%ecx
movslq %ecx,%rcx
xor    %esi,%esi
cmpb   $0xff,0x850(%rsp,%rcx,1)
ff
sete   %sil
shl    $0x4,%esi
or     %edx,%esi
lea    (%rbx,%rax,1),%ecx
movslq %ecx,%rcx
xor    %edx,%edx
cmpb   $0xff,0x850(%rsp,%rcx,1)
ff
sete   %dl
lea    (%rsi,%rdx,8),%ecx
lea    (%rax,%rbp,1),%edx
movslq %edx,%rdx
xor    %esi,%esi
cmpb   $0xff,0x850(%rsp,%rdx,1)
ff
sete   %sil
lea    (%rcx,%rsi,4),%ecx
lea    (%r15,%rax,1),%edx
movslq %edx,%rdx
xor    %esi,%esi
cmpb   $0xff,0x850(%rsp,%rdx,1)
ff
sete   %sil
lea    (%rcx,%rsi,2),%ecx
add    %r14d,%eax
cltq
xor    %edi,%edi
cmpb   $0xff,0x850(%rsp,%rax,1)
ff
sete   %dil
add    %ecx,%edi
mov    0x10(%rsp),%rsi
call   1090 <fputc@plt>
cmp    $0x7,%r12d
je     14f0 <main+0x2f0>
mov    (%rsp),%ecx
add    $0x1,%r12d
jmp    1560 <main+0x360>
cmpb   $0x0,0x7(%rsp)
je     17a2 <main+0x5a2>
xor    %edi,%edi
mov    0x10(%rsp),%rbx
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
mov    0x28(%rsp),%rdi
call   1060 <pclose@plt>
mov    0x10(%rsp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x2c58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x280f(%rip),%rax
mov    (%rax),%edi
mov    0x0(%rbp),%rdx
lea    0x822(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    0x27ea(%rip),%rax
mov    (%rax),%edi
lea    0x83e(%rip),%rsi
jmp    1854 <main+0x654>
lea    0x450(%rsp),%rdi
call   1100 <perror@plt>
mov    %r14,%rdi
call   1060 <pclose@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    0x27b9(%rip),%rax
mov    (%rax),%edi
lea    0x821(%rip),%rsi
jmp    1854 <main+0x654>
mov    0x27a7(%rip),%rax
mov    (%rax),%edi
lea    0x863(%rip),%rsi
jmp    1854 <main+0x654>
mov    0x2795(%rip),%rax
mov    (%rax),%edi
lea    0x817(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [38 x i8] c"Usage: %s input.png {1|2} output.fnt\0A\00"
@.str.1 = [21 x i8] c"/usr/bin/pngtopnm %s\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [18 x i8] c"can't open input\0A\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [4 x i8] c"P5\0A\00"
@.str.6 = [10 x i8] c"Not a P5\0A\00"
@.str.7 = [8 x i8] c"160 48\0A\00"
@.str.8 = [8 x i8] c"256 32\0A\00"
@.str.9 = [22 x i8] c"Not 160x48 or 256x32\0A\00"
@.str.10 = [6 x i8] c"%d %d\00"
@.str.11 = [25 x i8] c"Chopping half #%d of %s\0A\00"
@.str.12 = [5 x i8] c"255\0A\00"
@.str.13 = [11 x i8] c"Not 8-bit\0A\00"
@.str.14 = [46 x i8] c"Skipped for %d rows of %d columns (%d bytes)\0A\00"
@.str.15 = [44 x i8] c"Collected %d rows of %d columns (%d bytes)\0A\00"
@.str.16 = [53 x i8] c"Processing %d rows of %d characters (x8 = %d bytes)\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%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 [1024 x i8]
%17 = alloca [1024 x i8]
%18 = alloca [1024 x i8]
%19 = alloca [8192 x i8]
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%25 = load i32, i32* %4
%26 = icmp ne i32 %25, 4
br i1 %26, label %27, label %34
27: ; preds = %2
%28 = load i32, i32* @stderr
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 0
%31 = load i8*, i8** %30
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %31)
%33 = call i32 @exit(i32 1)
unreachable
34: ; preds = %2
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 2
%37 = load i8*, i8** %36
%38 = call i32 @atoi(i8* %37)
store i32 %38, i32* %8
%39 = getelementptr inbounds [1024 x i8], [1024 x i8]* %18, i64 0, i64 0
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 1
%42 = load i8*, i8** %41
%43 = call i32 @snprintf(i8* %39, i32 1024, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %42)
%44 = getelementptr inbounds [1024 x i8], [1024 x i8]* %18, i64 0, i64 0
%45 = call i32* @popen(i8* %44, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %45, i32** %6
%46 = load i32*, i32** %6
%47 = icmp eq i32* %46, null
br i1 %47, label %48, label %52
48: ; preds = %34
%49 = load i32, i32* @stderr
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%51 = call i32 @exit(i32 1)
unreachable
52: ; preds = %34
%53 = getelementptr inbounds [1024 x i8], [1024 x i8]* %17, i64 0, i64 0
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 3
%56 = load i8*, i8** %55
%57 = call i32 @strncpy(i8* %53, i8* %56, i32 1024)
%58 = getelementptr inbounds [1024 x i8], [1024 x i8]* %17, i64 0, i64 0
%59 = call i32* @fopen(i8* %58, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %59, i32** %7
%60 = load i32*, i32** %7
%61 = icmp eq i32* %60, null
br i1 %61, label %62, label %68
62: ; preds = %52
%63 = getelementptr inbounds [1024 x i8], [1024 x i8]* %17, i64 0, i64 0
%64 = call i32 @perror(i8* %63)
%65 = load i32*, i32** %6
%66 = call i32 @pclose(i32* %65)
%67 = call i32 @exit(i32 1)
unreachable
68: ; preds = %52
%69 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%70 = load i32*, i32** %6
%71 = call i32 @fgets(i8* %69, i32 1024, i32* %70)
%72 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%73 = call i64 @strcmp(i8* %72, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%74 = icmp ne i64 %73, 0
br i1 %74, label %75, label %79
75: ; preds = %68
%76 = load i32, i32* @stderr
%77 = call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%78 = call i32 @exit(i32 1)
unreachable
79: ; preds = %68
%80 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%81 = load i32*, i32** %6
%82 = call i32 @fgets(i8* %80, i32 1024, i32* %81)
%83 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%84 = call i64 @strcmp(i8* %83, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%85 = icmp ne i64 %84, 0
br i1 %85, label %86, label %94
86: ; preds = %79
%87 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%88 = call i64 @strcmp(i8* %87, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
%89 = icmp ne i64 %88, 0
br i1 %89, label %90, label %94
90: ; preds = %86
%91 = load i32, i32* @stderr
%92 = call i32 (i32, i8*, ...) @fprintf(i32 %91, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
%93 = call i32 @exit(i32 1)
unreachable
94: ; preds = %86, %79
%95 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%96 = call i32 @sscanf(i8* %95, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32* %20, i32* %21)
%97 = load i32, i32* %20
%98 = icmp eq i32 %97, 160
br i1 %98, label %99, label %110
99: ; preds = %94
%100 = load i32, i32* %21
%101 = icmp eq i32 %100, 48
br i1 %101, label %102, label %110
102: ; preds = %99
store i32 1, i32* %22
%103 = load i32, i32* %21
%104 = sdiv i32 %103, 2
store i32 %104, i32* %23
store i32 3, i32* %24
%105 = load i32, i32* %8
%106 = load i8**, i8*** %5
%107 = getelementptr inbounds i8*, i8** %106, i64 1
%108 = load i8*, i8** %107
%109 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0), i32 %105, i8* %108)
br label %112
110: ; preds = %99, %94
store i32 0, i32* %22
store i32 4, i32* %24
%111 = load i32, i32* %21
store i32 %111, i32* %23
br label %112
112: ; preds = %110, %102
%113 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%114 = load i32*, i32** %6
%115 = call i32 @fgets(i8* %113, i32 1024, i32* %114)
%116 = getelementptr inbounds [1024 x i8], [1024 x i8]* %16, i64 0, i64 0
%117 = call i64 @strcmp(i8* %116, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
%118 = icmp ne i64 %117, 0
br i1 %118, label %119, label %123
119: ; preds = %112
%120 = load i32, i32* @stderr
%121 = call i32 (i32, i8*, ...) @fprintf(i32 %120, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0))
%122 = call i32 @exit(i32 1)
unreachable
123: ; preds = %112
%124 = load i32, i32* %22
%125 = icmp ne i32 %124, 0
br i1 %125, label %126, label %160
126: ; preds = %123
%127 = load i32, i32* %8
%128 = icmp eq i32 %127, 2
br i1 %128, label %129, label %159
129: ; preds = %126
store i32 0, i32* %10
br label %130
130: ; preds = %147, %129
%131 = load i32, i32* %10
%132 = load i32, i32* %21
%133 = sdiv i32 %132, 2
%134 = icmp slt i32 %131, %133
br i1 %134, label %135, label %150
135: ; preds = %130
store i32 0, i32* %9
br label %136
136: ; preds = %143, %135
%137 = load i32, i32* %9
%138 = load i32, i32* %20
%139 = icmp slt i32 %137, %138
br i1 %139, label %140, label %146
140: ; preds = %136
%141 = load i32*, i32** %6
%142 = call zeroext i8 @fgetc(i32* %141)
br label %143
143: ; preds = %140
%144 = load i32, i32* %9
%145 = add nsw i32 %144, 1
store i32 %145, i32* %9
br label %136
146: ; preds = %136
br label %147
147: ; preds = %146
%148 = load i32, i32* %10
%149 = add nsw i32 %148, 1
store i32 %149, i32* %10
br label %130
150: ; preds = %130
%151 = load i32, i32* %21
%152 = sdiv i32 %151, 2
%153 = load i32, i32* %20
%154 = load i32, i32* %21
%155 = sdiv i32 %154, 2
%156 = load i32, i32* %20
%157 = mul nsw i32 %155, %156
%158 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.14, i64 0, i64 0), i32 %152, i32 %153, i32 %157)
br label %159
159: ; preds = %150, %126
br label %160
160: ; preds = %159, %123
store i32 0, i32* %10
br label %161
161: ; preds = %184, %160
%162 = load i32, i32* %10
%163 = load i32, i32* %23
%164 = icmp slt i32 %162, %163
br i1 %164, label %165, label %187
165: ; preds = %161
store i32 0, i32* %9
br label %166
166: ; preds = %180, %165
%167 = load i32, i32* %9
%168 = load i32, i32* %20
%169 = icmp slt i32 %167, %168
br i1 %169, label %170, label %183
170: ; preds = %166
%171 = load i32*, i32** %6
%172 = call zeroext i8 @fgetc(i32* %171)
%173 = load i32, i32* %10
%174 = load i32, i32* %20
%175 = mul nsw i32 %173, %174
%176 = load i32, i32* %9
%177 = add nsw i32 %175, %176
%178 = sext i32 %177 to i64
%179 = getelementptr inbounds [8192 x i8], [8192 x i8]* %19, i64 0, i64 %178
store i8 %172, i8* %179
br label %180
180: ; preds = %170
%181 = load i32, i32* %9
%182 = add nsw i32 %181, 1
store i32 %182, i32* %9
br label %166
183: ; preds = %166
br label %184
184: ; preds = %183
%185 = load i32, i32* %10
%186 = add nsw i32 %185, 1
store i32 %186, i32* %10
br label %161
187: ; preds = %161
%188 = load i32, i32* %23
%189 = load i32, i32* %20
%190 = load i32, i32* %23
%191 = load i32, i32* %20
%192 = mul nsw i32 %190, %191
%193 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.15, i64 0, i64 0), i32 %188, i32 %189, i32 %192)
%194 = load i32, i32* %24
%195 = load i32, i32* %20
%196 = sdiv i32 %195, 8
%197 = load i32, i32* %24
%198 = load i32, i32* %20
%199 = mul nsw i32 %197, %198
%200 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.16, i64 0, i64 0), i32 %194, i32 %196, i32 %199)
store i32 0, i32* %10
br label %201
201: ; preds = %259, %187
%202 = load i32, i32* %10
%203 = load i32, i32* %24
%204 = icmp slt i32 %202, %203
br i1 %204, label %205, label %262
205: ; preds = %201
store i32 0, i32* %9
br label %206
206: ; preds = %255, %205
%207 = load i32, i32* %9
%208 = load i32, i32* %20
%209 = sdiv i32 %208, 8
%210 = icmp slt i32 %207, %209
br i1 %210, label %211, label %258
211: ; preds = %206
store i32 0, i32* %11
br label %212
212: ; preds = %251, %211
%213 = load i32, i32* %11
%214 = icmp slt i32 %213, 8
br i1 %214, label %215, label %254
215: ; preds = %212
store i32 256, i32* %14
store i32 0, i32* %15
store i32 0, i32* %12
br label %216
216: ; preds = %244, %215
%217 = load i32, i32* %12
%218 = icmp slt i32 %217, 8
br i1 %218, label %219, label %247
219: ; preds = %216
%220 = load i32, i32* %14
%221 = sdiv i32 %220, 2
store i32 %221, i32* %14
%222 = load i32, i32* %10
%223 = mul nsw i32 %222, 8
%224 = load i32, i32* %11
%225 = add nsw i32 %223, %224
%226 = load i32, i32* %20
%227 = mul nsw i32 %225, %226
%228 = load i32, i32* %9
%229 = mul nsw i32 %228, 8
%230 = add nsw i32 %227, %229
%231 = load i32, i32* %12
%232 = add nsw i32 %230, %231
%233 = sext i32 %232 to i64
%234 = getelementptr inbounds [8192 x i8], [8192 x i8]* %19, i64 0, i64 %233
%235 = load i8, i8* %234
%236 = zext i8 %235 to i32
store i32 %236, i32* %13
%237 = load i32, i32* %13
%238 = icmp eq i32 %237, 255
br i1 %238, label %239, label %243
239: ; preds = %219
%240 = load i32, i32* %15
%241 = load i32, i32* %14
%242 = add nsw i32 %240, %241
store i32 %242, i32* %15
br label %243
243: ; preds = %239, %219
br label %244
244: ; preds = %243
%245 = load i32, i32* %12
%246 = add nsw i32 %245, 1
store i32 %246, i32* %12
br label %216
247: ; preds = %216
%248 = load i32, i32* %15
%249 = load i32*, i32** %7
%250 = call i32 @fputc(i32 %248, i32* %249)
br label %251
251: ; preds = %247
%252 = load i32, i32* %11
%253 = add nsw i32 %252, 1
store i32 %253, i32* %11
br label %212
254: ; preds = %212
br label %255
255: ; preds = %254
%256 = load i32, i32* %9
%257 = add nsw i32 %256, 1
store i32 %257, i32* %9
br label %206
258: ; preds = %206
br label %259
259: ; preds = %258
%260 = load i32, i32* %10
%261 = add nsw i32 %260, 1
store i32 %261, i32* %10
br label %201
262: ; preds = %201
%263 = load i32, i32* %22
%264 = icmp ne i32 %263, 0
br i1 %264, label %265, label %276
265: ; preds = %262
store i32 480, i32* %13
br label %266
266: ; preds = %272, %265
%267 = load i32, i32* %13
%268 = icmp slt i32 %267, 512
br i1 %268, label %269, label %275
269: ; preds = %266
%270 = load i32*, i32** %7
%271 = call i32 @fputc(i32 0, i32* %270)
br label %272
272: ; preds = %269
%273 = load i32, i32* %13
%274 = add nsw i32 %273, 1
store i32 %274, i32* %13
br label %266
275: ; preds = %266
br label %276
276: ; preds = %275, %262
%277 = load i32*, i32** %6
%278 = call i32 @pclose(i32* %277)
%279 = load i32*, i32** %7
%280 = call i32 @fclose(i32* %279)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [38 x i8] c"Usage: %s input.png {1|2} output.fnt\0A\00"
@.str.1 = [21 x i8] c"/usr/bin/pngtopnm %s\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [18 x i8] c"can't open input\0A\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [4 x i8] c"P5\0A\00"
@.str.6 = [10 x i8] c"Not a P5\0A\00"
@.str.7 = [8 x i8] c"160 48\0A\00"
@.str.8 = [8 x i8] c"256 32\0A\00"
@.str.9 = [22 x i8] c"Not 160x48 or 256x32\0A\00"
@.str.10 = [6 x i8] c"%d %d\00"
@.str.11 = [25 x i8] c"Chopping half #%d of %s\0A\00"
@.str.12 = [5 x i8] c"255\0A\00"
@.str.13 = [11 x i8] c"Not 8-bit\0A\00"
@.str.14 = [46 x i8] c"Skipped for %d rows of %d columns (%d bytes)\0A\00"
@.str.15 = [44 x i8] c"Collected %d rows of %d columns (%d bytes)\0A\00"
@.str.16 = [53 x i8] c"Processing %d rows of %d characters (x8 = %d bytes)\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = alloca [1024 x i8]
%6 = alloca [8192 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 0
%13 = bitcast i32* %7 to i8*
%14 = bitcast i32* %8 to i8*
%15 = icmp eq i32 %0, 4
br i1 %15, label %21, label %16
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = load i8*, i8** %1
%19 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = tail call i32 @exit(i32 1)
unreachable
21: ; preds = %2
%22 = getelementptr inbounds i8*, i8** %1, i64 2
%23 = load i8*, i8** %22
%24 = tail call i32 @atoi(i8* %23)
%25 = getelementptr inbounds i8*, i8** %1, i64 1
%26 = load i8*, i8** %25
%27 = call i32 @snprintf(i8* %11, i32 1024, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %26)
%28 = call i32* @popen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %34
30: ; preds = %21
%31 = load i32, i32* @stderr
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%33 = call i32 @exit(i32 1)
unreachable
34: ; preds = %21
%35 = getelementptr inbounds i8*, i8** %1, i64 3
%36 = load i8*, i8** %35
%37 = call i32 @strncpy(i8* %10, i8* %36, i32 1024)
%38 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%39 = icmp eq i32* %38, null
br i1 %39, label %40, label %44
40: ; preds = %34
%41 = call i32 @perror(i8* %10)
%42 = call i32 @pclose(i32* %28)
%43 = call i32 @exit(i32 1)
unreachable
44: ; preds = %34
%45 = call i32 @fgets(i8* %9, i32 1024, i32* %28)
%46 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%47 = icmp eq i64 %46, 0
br i1 %47, label %52, label %48
48: ; preds = %44
%49 = load i32, i32* @stderr
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%51 = call i32 @exit(i32 1)
unreachable
52: ; preds = %44
%53 = call i32 @fgets(i8* %9, i32 1024, i32* %28)
%54 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%55 = icmp eq i64 %54, 0
br i1 %55, label %63, label %56
56: ; preds = %52
%57 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
%58 = icmp eq i64 %57, 0
br i1 %58, label %63, label %59
59: ; preds = %56
%60 = load i32, i32* @stderr
%61 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
%62 = call i32 @exit(i32 1)
unreachable
63: ; preds = %56, %52
%64 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32* %7, i32* %8)
%65 = load i32, i32* %7
%66 = icmp eq i32 %65, 160
%67 = load i32, i32* %8
%68 = icmp eq i32 %67, 48
%69 = select i1 %66, i1 %68, i1 false
br i1 %69, label %70, label %73
70: ; preds = %63
%71 = load i8*, i8** %25
%72 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0), i32 %24, i8* %71)
br label %73
73: ; preds = %63, %70
%74 = phi i32 [ 24, %70 ], [ %67, %63 ]
%75 = phi i32 [ 3, %70 ], [ 4, %63 ]
%76 = call i32 @fgets(i8* %9, i32 1024, i32* %28)
%77 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
%78 = icmp eq i64 %77, 0
br i1 %78, label %83, label %79
79: ; preds = %73
%80 = load i32, i32* @stderr
%81 = call i32 (i32, i8*, ...) @fprintf(i32 %80, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0))
%82 = call i32 @exit(i32 1)
unreachable
83: ; preds = %73
%84 = icmp eq i32 %24, 2
%85 = select i1 %69, i1 %84, i1 false
br i1 %85, label %86, label %118
86: ; preds = %83
%87 = load i32, i32* %8
%88 = icmp sgt i32 %87, 1
br i1 %88, label %92, label %89
89: ; preds = %86
%90 = sdiv i32 %87, 2
%91 = load i32, i32* %7
br label %113
92: ; preds = %86
%93 = load i32, i32* %7
br label %94
94: ; preds = %92, %107
%95 = phi i32 [ %108, %107 ], [ %87, %92 ]
%96 = phi i32 [ %109, %107 ], [ %93, %92 ]
%97 = phi i32 [ %110, %107 ], [ 0, %92 ]
%98 = icmp sgt i32 %96, 0
br i1 %98, label %99, label %107
99: ; preds = %94, %99
%100 = phi i32 [ %102, %99 ], [ 0, %94 ]
%101 = call zeroext i8 @fgetc(i32* %28)
%102 = add nuw nsw i32 %100, 1
%103 = load i32, i32* %7
%104 = icmp slt i32 %102, %103
br i1 %104, label %99, label %105
105: ; preds = %99
%106 = load i32, i32* %8
br label %107
107: ; preds = %105, %94
%108 = phi i32 [ %106, %105 ], [ %95, %94 ]
%109 = phi i32 [ %103, %105 ], [ %96, %94 ]
%110 = add nuw nsw i32 %97, 1
%111 = sdiv i32 %108, 2
%112 = icmp slt i32 %110, %111
br i1 %112, label %94, label %113
113: ; preds = %107, %89
%114 = phi i32 [ %91, %89 ], [ %109, %107 ]
%115 = phi i32 [ %90, %89 ], [ %111, %107 ]
%116 = mul nsw i32 %114, %115
%117 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.14, i64 0, i64 0), i32 %115, i32 %114, i32 %116)
br label %118
118: ; preds = %113, %83
%119 = icmp sgt i32 %74, 0
%120 = load i32, i32* %7
br i1 %119, label %121, label %139
121: ; preds = %118, %135
%122 = phi i32 [ %136, %135 ], [ %120, %118 ]
%123 = phi i32 [ %137, %135 ], [ 0, %118 ]
%124 = icmp sgt i32 %122, 0
br i1 %124, label %125, label %135
125: ; preds = %121, %125
%126 = phi i32 [ %133, %125 ], [ 0, %121 ]
%127 = call zeroext i8 @fgetc(i32* %28)
%128 = load i32, i32* %7
%129 = mul nsw i32 %128, %123
%130 = add nsw i32 %129, %126
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 %131
store i8 %127, i8* %132
%133 = add nuw nsw i32 %126, 1
%134 = icmp slt i32 %133, %128
br i1 %134, label %125, label %135
135: ; preds = %125, %121
%136 = phi i32 [ %122, %121 ], [ %128, %125 ]
%137 = add nuw nsw i32 %123, 1
%138 = icmp eq i32 %137, %74
br i1 %138, label %139, label %121
139: ; preds = %135, %118
%140 = phi i32 [ %120, %118 ], [ %136, %135 ]
%141 = mul nsw i32 %140, %74
%142 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.15, i64 0, i64 0), i32 %74, i32 %140, i32 %141)
%143 = load i32, i32* %7
%144 = sdiv i32 %143, 8
%145 = mul nsw i32 %143, %75
%146 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.16, i64 0, i64 0), i32 %75, i32 %144, i32 %145)
%147 = load i32, i32* %7
br label %148
148: ; preds = %139, %244
%149 = phi i32 [ %147, %139 ], [ %245, %244 ]
%150 = phi i32 [ 0, %139 ], [ %246, %244 ]
%151 = icmp sgt i32 %149, 7
br i1 %151, label %152, label %244
152: ; preds = %148
%153 = shl nsw i32 %150, 3
br label %154
154: ; preds = %152, %238
%155 = phi i32 [ %149, %152 ], [ %240, %238 ]
%156 = phi i64 [ 0, %152 ], [ %239, %238 ]
%157 = shl nsw i64 %156, 3
%158 = trunc i64 %157 to i32
%159 = trunc i64 %157 to i32
%160 = or i32 %159, 1
%161 = trunc i64 %157 to i32
%162 = or i32 %161, 2
%163 = trunc i64 %157 to i32
%164 = or i32 %163, 3
%165 = trunc i64 %157 to i32
%166 = or i32 %165, 4
%167 = trunc i64 %157 to i32
%168 = or i32 %167, 5
%169 = trunc i64 %157 to i32
%170 = or i32 %169, 6
%171 = trunc i64 %157 to i32
%172 = or i32 %171, 7
br label %173
173: ; preds = %236, %154
%174 = phi i32 [ %155, %154 ], [ %237, %236 ]
%175 = phi i32 [ 0, %154 ], [ %234, %236 ]
%176 = add nuw nsw i32 %175, %153
%177 = mul nsw i32 %174, %176
%178 = add i32 %177, %158
%179 = sext i32 %178 to i64
%180 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 %179
%181 = load i8, i8* %180
%182 = icmp eq i8 %181, -1
%183 = select i1 %182, i32 128, i32 0
%184 = add i32 %160, %177
%185 = sext i32 %184 to i64
%186 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 %185
%187 = load i8, i8* %186
%188 = icmp eq i8 %187, -1
%189 = select i1 %188, i32 64, i32 0
%190 = or i32 %189, %183
%191 = add i32 %162, %177
%192 = sext i32 %191 to i64
%193 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 %192
%194 = load i8, i8* %193
%195 = icmp eq i8 %194, -1
%196 = select i1 %195, i32 32, i32 0
%197 = or i32 %196, %190
%198 = add i32 %164, %177
%199 = sext i32 %198 to i64
%200 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 %199
%201 = load i8, i8* %200
%202 = icmp eq i8 %201, -1
%203 = select i1 %202, i32 16, i32 0
%204 = or i32 %203, %197
%205 = add i32 %166, %177
%206 = sext i32 %205 to i64
%207 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 %206
%208 = load i8, i8* %207
%209 = icmp eq i8 %208, -1
%210 = select i1 %209, i32 8, i32 0
%211 = or i32 %210, %204
%212 = add i32 %168, %177
%213 = sext i32 %212 to i64
%214 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 %213
%215 = load i8, i8* %214
%216 = icmp eq i8 %215, -1
%217 = select i1 %216, i32 4, i32 0
%218 = or i32 %217, %211
%219 = add i32 %170, %177
%220 = sext i32 %219 to i64
%221 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 %220
%222 = load i8, i8* %221
%223 = icmp eq i8 %222, -1
%224 = select i1 %223, i32 2, i32 0
%225 = or i32 %224, %218
%226 = add i32 %172, %177
%227 = sext i32 %226 to i64
%228 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 %227
%229 = load i8, i8* %228
%230 = icmp eq i8 %229, -1
%231 = zext i1 %230 to i32
%232 = add nsw i32 %225, %231
%233 = call i32 @fputc(i32 %232, i32* %38)
%234 = add nuw nsw i32 %175, 1
%235 = icmp eq i32 %234, 8
br i1 %235, label %238, label %236
236: ; preds = %173
%237 = load i32, i32* %7
br label %173
238: ; preds = %173
%239 = add nuw nsw i64 %156, 1
%240 = load i32, i32* %7
%241 = sdiv i32 %240, 8
%242 = sext i32 %241 to i64
%243 = icmp slt i64 %239, %242
br i1 %243, label %154, label %244
244: ; preds = %238, %148
%245 = phi i32 [ %149, %148 ], [ %240, %238 ]
%246 = add nuw i32 %150, 1
%247 = icmp eq i32 %246, %75
br i1 %247, label %248, label %148
248: ; preds = %244
br i1 %69, label %249, label %282
249: ; preds = %248
%250 = call i32 @fputc(i32 0, i32* %38)
%251 = call i32 @fputc(i32 0, i32* %38)
%252 = call i32 @fputc(i32 0, i32* %38)
%253 = call i32 @fputc(i32 0, i32* %38)
%254 = call i32 @fputc(i32 0, i32* %38)
%255 = call i32 @fputc(i32 0, i32* %38)
%256 = call i32 @fputc(i32 0, i32* %38)
%257 = call i32 @fputc(i32 0, i32* %38)
%258 = call i32 @fputc(i32 0, i32* %38)
%259 = call i32 @fputc(i32 0, i32* %38)
%260 = call i32 @fputc(i32 0, i32* %38)
%261 = call i32 @fputc(i32 0, i32* %38)
%262 = call i32 @fputc(i32 0, i32* %38)
%263 = call i32 @fputc(i32 0, i32* %38)
%264 = call i32 @fputc(i32 0, i32* %38)
%265 = call i32 @fputc(i32 0, i32* %38)
%266 = call i32 @fputc(i32 0, i32* %38)
%267 = call i32 @fputc(i32 0, i32* %38)
%268 = call i32 @fputc(i32 0, i32* %38)
%269 = call i32 @fputc(i32 0, i32* %38)
%270 = call i32 @fputc(i32 0, i32* %38)
%271 = call i32 @fputc(i32 0, i32* %38)
%272 = call i32 @fputc(i32 0, i32* %38)
%273 = call i32 @fputc(i32 0, i32* %38)
%274 = call i32 @fputc(i32 0, i32* %38)
%275 = call i32 @fputc(i32 0, i32* %38)
%276 = call i32 @fputc(i32 0, i32* %38)
%277 = call i32 @fputc(i32 0, i32* %38)
%278 = call i32 @fputc(i32 0, i32* %38)
%279 = call i32 @fputc(i32 0, i32* %38)
%280 = call i32 @fputc(i32 0, i32* %38)
%281 = call i32 @fputc(i32 0, i32* %38)
br label %282
282: ; preds = %249, %248
%283 = call i32 @pclose(i32* %28)
%284 = call i32 @fclose(i32* %38)
ret i32 0
}