#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 */

/* Variables and functions */
int EOF;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int, int);
int getchar();
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scancmp(unsigned char *, unsigned char *, int);
int /*<<< orphan*/ scanf(char *, char *, int *, int *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  char type[4];
  int width, height, bytecount, bitcount, bit, prevbit, repeat, rle, linelen,
      prevlen;
  unsigned char scanline[256], prevline[256];
  scanf("%s\n%d %d\n", type, &width, &height);
  fprintf(stderr, "%s -> %d, %d\n", type, width, height);
  prevlen = 0;
  repeat = 1;
  while (height--) {
    linelen = 0;
    rle = 0;
    prevbit = 0;
    for (bitcount = 0; bitcount < width; bitcount++) {
      while ((bit = getchar()) != '0' && bit != '1')
        if (bit == EOF)
          break;
      if (bit == prevbit) {
        rle++;
      } else {
        if (rle)
          scanline[linelen++] = (prevbit == '0' ? 128 : 0) + rle;
        prevbit = bit;
        rle = 1;
      }
    }
    if (rle)
      scanline[linelen++] = (prevbit == '0' ? 128 : 0) + rle;
    if (linelen == prevlen && scancmp(scanline, prevline, linelen) == 0)
      repeat++;
    else {
      if (prevlen) {
        printf("\t!BYTE\t0,%d\t; Scanline repeat count\n", repeat);
        printf("\t!BYTE\t");
        for (bytecount = 0; bytecount < prevlen - 1; bytecount++)
          printf("%s%d,", prevline[bytecount] & 0x80 ? "128+" : "",
                 prevline[bytecount] & 0x7F);
        printf("%s%d\n", prevline[prevlen - 1] & 0x80 ? "128+" : "",
               prevline[prevlen - 1] & 0x7F);
      }
      for (bytecount = 0; bytecount < linelen; bytecount++)
        prevline[bytecount] = scanline[bytecount];
      prevlen = linelen;
      repeat = 1;
    }
  }
  if (linelen) {
    printf("\t!BYTE\t0,%d\t; Scanline repeat count\n", repeat);
    printf("\t!BYTE\t");
    for (bytecount = 0; bytecount < linelen - 1; bytecount++)
      printf("%s%d,", scanline[bytecount] & 0x80 ? "128+" : "",
             scanline[bytecount] & 0x7F);
    printf("%s%d\n", scanline[linelen - 1] & 0x80 ? "128+" : "",
           scanline[linelen - 1] & 0x7F);
  }
  printf("\t!BYTE	0,0\t; End of compressed map\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x250,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x14(%rbp),%rsi
lea    0xe8c(%rip),%rdi
lea    -0x18(%rbp),%rdx
lea    -0x1c(%rbp),%rcx
call   1060 <scanf@plt>
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
lea    -0x14(%rbp),%rdx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
lea    0xe6e(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x0,-0x3c(%rbp)
movl   $0x1,-0x30(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x1c(%rbp)
cmp    $0x0,%eax
je     144b <main+0x2fb>
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    12b6 <main+0x166>
jmp    11f0 <main+0xa0>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0x28(%rbp)
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x241(%rbp)
je     121a <main+0xca>
cmpl   $0x31,-0x28(%rbp)
setne  %al
mov    %al,-0x241(%rbp)
mov    -0x241(%rbp),%al
test   $0x1,%al
jne    122d <main+0xdd>
jmp    1249 <main+0xf9>
mov    -0x28(%rbp),%eax
mov    0x2db1(%rip),%rcx
cmp    (%rcx),%eax
jne    1244 <main+0xf4>
jmp    1249 <main+0xf9>
jmp    11f0 <main+0xa0>
mov    -0x28(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jne    1263 <main+0x113>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12a3 <main+0x153>
cmpl   $0x0,-0x34(%rbp)
je     1296 <main+0x146>
mov    -0x2c(%rbp),%edx
xor    %eax,%eax
mov    $0x80,%ecx
cmp    $0x30,%edx
cmove  %ecx,%eax
add    -0x34(%rbp),%eax
mov    %al,%cl
mov    -0x38(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x38(%rbp)
cltq
mov    %cl,-0x140(%rbp,%rax,1)
mov    -0x28(%rbp),%eax
mov    %eax,-0x2c(%rbp)
movl   $0x1,-0x34(%rbp)
jmp    12a8 <main+0x158>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11df <main+0x8f>
cmpl   $0x0,-0x34(%rbp)
je     12e9 <main+0x199>
mov    -0x2c(%rbp),%edx
xor    %eax,%eax
mov    $0x80,%ecx
cmp    $0x30,%edx
cmove  %ecx,%eax
add    -0x34(%rbp),%eax
mov    %al,%cl
mov    -0x38(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x38(%rbp)
cltq
mov    %cl,-0x140(%rbp,%rax,1)
mov    -0x38(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jne    1323 <main+0x1d3>
lea    -0x140(%rbp),%rdi
lea    -0x240(%rbp),%rsi
mov    -0x38(%rbp),%edx
call   1070 <scancmp@plt>
cmp    $0x0,%rax
jne    1323 <main+0x1d3>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1446 <main+0x2f6>
cmpl   $0x0,-0x3c(%rbp)
je     1402 <main+0x2b2>
mov    -0x30(%rbp),%esi
lea    0xce1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xcf8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    13b6 <main+0x266>
movslq -0x20(%rbp),%rax
movzbl -0x240(%rbp,%rax,1),%ecx
ff
and    $0x80,%ecx
lea    0xcc7(%rip),%rsi
lea    0xcc7(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
movslq -0x20(%rbp),%rax
movzbl -0x240(%rbp,%rax,1),%edx
ff
and    $0x7f,%edx
lea    0xca4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1353 <main+0x203>
mov    -0x3c(%rbp),%eax
sub    $0x1,%eax
cltq
movzbl -0x240(%rbp,%rax,1),%ecx
ff
and    $0x80,%ecx
lea    0xc71(%rip),%rsi
lea    0xc71(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
mov    -0x3c(%rbp),%eax
sub    $0x1,%eax
cltq
movzbl -0x240(%rbp,%rax,1),%edx
ff
and    $0x7f,%edx
lea    0xc55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    1439 <main+0x2e9>
movslq -0x20(%rbp),%rax
mov    -0x140(%rbp,%rax,1),%cl
movslq -0x20(%rbp),%rax
mov    %cl,-0x240(%rbp,%rax,1)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1409 <main+0x2b9>
mov    -0x38(%rbp),%eax
mov    %eax,-0x3c(%rbp)
movl   $0x1,-0x30(%rbp)
jmp    11af <main+0x5f>
cmpl   $0x0,-0x38(%rbp)
je     152a <main+0x3da>
mov    -0x30(%rbp),%esi
lea    0xbb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xbd0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x38(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    14de <main+0x38e>
movslq -0x20(%rbp),%rax
movzbl -0x140(%rbp,%rax,1),%ecx
ff
and    $0x80,%ecx
lea    0xb9f(%rip),%rsi
lea    0xb9f(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
movslq -0x20(%rbp),%rax
movzbl -0x140(%rbp,%rax,1),%edx
ff
and    $0x7f,%edx
lea    0xb7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    147b <main+0x32b>
mov    -0x38(%rbp),%eax
sub    $0x1,%eax
cltq
movzbl -0x140(%rbp,%rax,1),%ecx
ff
and    $0x80,%ecx
lea    0xb49(%rip),%rsi
lea    0xb49(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
mov    -0x38(%rbp),%eax
sub    $0x1,%eax
cltq
movzbl -0x140(%rbp,%rax,1),%edx
ff
and    $0x7f,%edx
lea    0xb2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xb25(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x250,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x228,%rsp
lea    0xe78(%rip),%rdi
lea    0x1c(%rsp),%rbx
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %rbx,%rsi
call   1080 <scanf@plt>
mov    0x2e32(%rip),%rax
mov    (%rax),%edi
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%r8d
lea    0xe52(%rip),%rsi
mov    %rbx,%rdx
call   1060 <fprintf@plt>
subl   $0x1,0x8(%rsp)
jae    11d1 <main+0x61>
mov    $0x1,%ebx
jmp    13b1 <main+0x241>
mov    $0x1,%ebx
mov    0x2e0b(%rip),%r14
lea    0xe67(%rip),%r15
lea    0xe5a(%rip),%r13
xor    %r12d,%r12d
jmp    11fe <main+0x8e>
mov    %ebp,%r12d
subl   $0x1,0x8(%rsp)
jb     13a9 <main+0x239>
cmpl   $0x0,0xc(%rsp)
mov    $0x0,%ebp
jle    12ae <main+0x13e>
mov    %ebx,0x4(%rsp)
xor    %ebp,%ebp
xor    %ebx,%ebx
xor    %r15d,%r15d
xor    %r13d,%r13d
jmp    1230 <main+0xc0>
add    $0x1,%ebx
add    $0x1,%r13d
cmp    0xc(%rsp),%r13d
jge    1280 <main+0x110>
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ecx
and    $0xfffffffe,%ecx
cmp    $0x30,%ecx
je     1246 <main+0xd6>
cmp    (%r14),%eax
jne    1230 <main+0xc0>
cmp    %r15d,%eax
je     121e <main+0xae>
test   %ebx,%ebx
je     1267 <main+0xf7>
xor    %ecx,%ecx
cmp    $0x30,%r15d
sete   %cl
shl    $0x7,%ecx
add    %ebx,%ecx
movslq %ebp,%rdx
add    $0x1,%ebp
mov    %cl,0x20(%rsp,%rdx,1)
mov    %eax,%r15d
mov    $0x1,%ebx
jmp    1221 <main+0xb1>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
test   %ebx,%ebx
je     129c <main+0x12c>
xor    %eax,%eax
cmp    $0x30,%r15d
sete   %al
shl    $0x7,%eax
add    %ebx,%eax
movslq %ebp,%rcx
add    $0x1,%ebp
mov    %al,0x20(%rsp,%rcx,1)
lea    0xda8(%rip),%r15
lea    0xd9b(%rip),%r13
mov    0x4(%rsp),%ebx
cmp    %r12d,%ebp
jne    12d1 <main+0x161>
lea    0x20(%rsp),%rdi
lea    0x120(%rsp),%rsi
mov    %r12d,%edx
call   1090 <scancmp@plt>
test   %rax,%rax
je     139b <main+0x22b>
test   %r12d,%r12d
je     1375 <main+0x205>
mov    %rbp,0x10(%rsp)
lea    0xd32(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd47(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    -0x1(%r12),%eax
mov    %eax,0x4(%rsp)
cmp    $0x2,%r12d
lea    0xd33(%rip),%r12
jl     1348 <main+0x1d8>
mov    0x4(%rsp),%ebp
xor    %ebx,%ebx
nopl   0x0(%rax)
movzbl 0x120(%rsp,%rbx,1),%edx
test   $0x80,%dl
mov    %r15,%rsi
cmove  %r12,%rsi
and    $0x7f,%edx
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1320 <main+0x1b0>
movslq 0x4(%rsp),%rax
movzbl 0x120(%rsp,%rax,1),%edx
test   $0x80,%dl
mov    %r15,%rsi
cmove  %r12,%rsi
and    $0x7f,%edx
lea    0xce7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%rbp
mov    $0x1,%ebx
test   %ebp,%ebp
jle    11f0 <main+0x80>
mov    %ebp,%edx
lea    0x120(%rsp),%rdi
lea    0x20(%rsp),%rsi
call   1070 <memcpy@plt>
jmp    11f0 <main+0x80>
add    $0x1,%ebx
subl   $0x1,0x8(%rsp)
jae    11fe <main+0x8e>
test   %ebp,%ebp
je     1453 <main+0x2e3>
lea    0xc60(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc75(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    -0x1(%rbp),%r14d
cmp    $0x2,%ebp
jl     1425 <main+0x2b5>
mov    %r14d,%ebp
lea    0xc62(%rip),%r15
lea    0xc62(%rip),%r12
lea    0xc55(%rip),%r13
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl 0x20(%rsp,%rbx,1),%edx
test   $0x80,%dl
mov    %r12,%rsi
cmove  %r15,%rsi
and    $0x7f,%edx
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1400 <main+0x290>
movslq %r14d,%rax
movzbl 0x20(%rsp,%rax,1),%edx
test   $0x80,%dl
lea    0xc0d(%rip),%rax
lea    0xc0d(%rip),%rsi
cmove  %rax,%rsi
and    $0x7f,%edx
lea    0xc04(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xbfc(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x228,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%s\0A%d %d\0A\00"
@stderr = global i32 0
@.str.1 = [14 x i8] c"%s -> %d, %d\0A\00"
@EOF = global i32 0
@.str.2 = [37 x i8] c"\09!BYTE\090,%d\09; Scanline repeat count\0A\00"
@.str.3 = [8 x i8] c"\09!BYTE\09\00"
@.str.4 = [6 x i8] c"%s%d,\00"
@.str.5 = [5 x i8] c"128+\00"
@.str.6 = [1 x i8] zeroinitializer
@.str.7 = [6 x i8] c"%s%d\0A\00"
@.str.8 = [36 x i8] c"\09!BYTE\090,0\09; End of compressed map\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4 x i8]
%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 i32
%17 = alloca [256 x i8]
%18 = alloca [256 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%19 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 0
%20 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %19, i32* %7, i32* %8)
%21 = load i32, i32* @stderr
%22 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 0
%23 = load i32, i32* %7
%24 = load i32, i32* %8
%25 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %22, i32 %23, i32 %24)
store i32 0, i32* %16
store i32 1, i32* %13
br label %26
26: ; preds = %175, %2
%27 = load i32, i32* %8
%28 = add nsw i32 %27, -1
store i32 %28, i32* %8
%29 = icmp ne i32 %27, 0
br i1 %29, label %30, label %176
30: ; preds = %26
store i32 0, i32* %15
store i32 0, i32* %14
store i32 0, i32* %12
store i32 0, i32* %10
br label %31
31: ; preds = %75, %30
%32 = load i32, i32* %10
%33 = load i32, i32* %7
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %78
35: ; preds = %31
br label %36
36: ; preds = %49, %35
%37 = call i32 (...) @getchar()
store i32 %37, i32* %11
%38 = icmp ne i32 %37, 48
br i1 %38, label %39, label %42
39: ; preds = %36
%40 = load i32, i32* %11
%41 = icmp ne i32 %40, 49
br label %42
42: ; preds = %39, %36
%43 = phi i1 [ false, %36 ], [ %41, %39 ]
br i1 %43, label %44, label %50
44: ; preds = %42
%45 = load i32, i32* %11
%46 = load i32, i32* @EOF
%47 = icmp eq i32 %45, %46
br i1 %47, label %48, label %49
48: ; preds = %44
br label %50
49: ; preds = %44
br label %36
50: ; preds = %48, %42
%51 = load i32, i32* %11
%52 = load i32, i32* %12
%53 = icmp eq i32 %51, %52
br i1 %53, label %54, label %57
54: ; preds = %50
%55 = load i32, i32* %14
%56 = add nsw i32 %55, 1
store i32 %56, i32* %14
br label %74
57: ; preds = %50
%58 = load i32, i32* %14
%59 = icmp ne i32 %58, 0
br i1 %59, label %60, label %72
60: ; preds = %57
%61 = load i32, i32* %12
%62 = icmp eq i32 %61, 48
%63 = zext i1 %62 to i64
%64 = select i1 %62, i32 128, i32 0
%65 = load i32, i32* %14
%66 = add nsw i32 %64, %65
%67 = trunc i32 %66 to i8
%68 = load i32, i32* %15
%69 = add nsw i32 %68, 1
store i32 %69, i32* %15
%70 = sext i32 %68 to i64
%71 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 %70
store i8 %67, i8* %71
br label %72
72: ; preds = %60, %57
%73 = load i32, i32* %11
store i32 %73, i32* %12
store i32 1, i32* %14
br label %74
74: ; preds = %72, %54
br label %75
75: ; preds = %74
%76 = load i32, i32* %10
%77 = add nsw i32 %76, 1
store i32 %77, i32* %10
br label %31
78: ; preds = %31
%79 = load i32, i32* %14
%80 = icmp ne i32 %79, 0
br i1 %80, label %81, label %93
81: ; preds = %78
%82 = load i32, i32* %12
%83 = icmp eq i32 %82, 48
%84 = zext i1 %83 to i64
%85 = select i1 %83, i32 128, i32 0
%86 = load i32, i32* %14
%87 = add nsw i32 %85, %86
%88 = trunc i32 %87 to i8
%89 = load i32, i32* %15
%90 = add nsw i32 %89, 1
store i32 %90, i32* %15
%91 = sext i32 %89 to i64
%92 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 %91
store i8 %88, i8* %92
br label %93
93: ; preds = %81, %78
%94 = load i32, i32* %15
%95 = load i32, i32* %16
%96 = icmp eq i32 %94, %95
br i1 %96, label %97, label %106
97: ; preds = %93
%98 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%99 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%100 = load i32, i32* %15
%101 = call i64 @scancmp(i8* %98, i8* %99, i32 %100)
%102 = icmp eq i64 %101, 0
br i1 %102, label %103, label %106
103: ; preds = %97
%104 = load i32, i32* %13
%105 = add nsw i32 %104, 1
store i32 %105, i32* %13
br label %175
106: ; preds = %97, %93
%107 = load i32, i32* %16
%108 = icmp ne i32 %107, 0
br i1 %108, label %109, label %157
109: ; preds = %106
%110 = load i32, i32* %13
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %110)
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %9
br label %113
113: ; preds = %135, %109
%114 = load i32, i32* %9
%115 = load i32, i32* %16
%116 = sub nsw i32 %115, 1
%117 = icmp slt i32 %114, %116
br i1 %117, label %118, label %138
118: ; preds = %113
%119 = load i32, i32* %9
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 %120
%122 = load i8, i8* %121
%123 = zext i8 %122 to i32
%124 = and i32 %123, 128
%125 = icmp ne i32 %124, 0
%126 = zext i1 %125 to i64
%127 = select i1 %125, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0)
%128 = load i32, i32* %9
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 %129
%131 = load i8, i8* %130
%132 = zext i8 %131 to i32
%133 = and i32 %132, 127
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %127, i32 %133)
br label %135
135: ; preds = %118
%136 = load i32, i32* %9
%137 = add nsw i32 %136, 1
store i32 %137, i32* %9
br label %113
138: ; preds = %113
%139 = load i32, i32* %16
%140 = sub nsw i32 %139, 1
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 %141
%143 = load i8, i8* %142
%144 = zext i8 %143 to i32
%145 = and i32 %144, 128
%146 = icmp ne i32 %145, 0
%147 = zext i1 %146 to i64
%148 = select i1 %146, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0)
%149 = load i32, i32* %16
%150 = sub nsw i32 %149, 1
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 %151
%153 = load i8, i8* %152
%154 = zext i8 %153 to i32
%155 = and i32 %154, 127
%156 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %148, i32 %155)
br label %157
157: ; preds = %138, %106
store i32 0, i32* %9
br label %158
158: ; preds = %170, %157
%159 = load i32, i32* %9
%160 = load i32, i32* %15
%161 = icmp slt i32 %159, %160
br i1 %161, label %162, label %173
162: ; preds = %158
%163 = load i32, i32* %9
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 %164
%166 = load i8, i8* %165
%167 = load i32, i32* %9
%168 = sext i32 %167 to i64
%169 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 %168
store i8 %166, i8* %169
br label %170
170: ; preds = %162
%171 = load i32, i32* %9
%172 = add nsw i32 %171, 1
store i32 %172, i32* %9
br label %158
173: ; preds = %158
%174 = load i32, i32* %15
store i32 %174, i32* %16
store i32 1, i32* %13
br label %175
175: ; preds = %173, %103
br label %26
176: ; preds = %26
%177 = load i32, i32* %15
%178 = icmp ne i32 %177, 0
br i1 %178, label %179, label %227
179: ; preds = %176
%180 = load i32, i32* %13
%181 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %180)
%182 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %9
br label %183
183: ; preds = %205, %179
%184 = load i32, i32* %9
%185 = load i32, i32* %15
%186 = sub nsw i32 %185, 1
%187 = icmp slt i32 %184, %186
br i1 %187, label %188, label %208
188: ; preds = %183
%189 = load i32, i32* %9
%190 = sext i32 %189 to i64
%191 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 %190
%192 = load i8, i8* %191
%193 = zext i8 %192 to i32
%194 = and i32 %193, 128
%195 = icmp ne i32 %194, 0
%196 = zext i1 %195 to i64
%197 = select i1 %195, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0)
%198 = load i32, i32* %9
%199 = sext i32 %198 to i64
%200 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 %199
%201 = load i8, i8* %200
%202 = zext i8 %201 to i32
%203 = and i32 %202, 127
%204 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %197, i32 %203)
br label %205
205: ; preds = %188
%206 = load i32, i32* %9
%207 = add nsw i32 %206, 1
store i32 %207, i32* %9
br label %183
208: ; preds = %183
%209 = load i32, i32* %15
%210 = sub nsw i32 %209, 1
%211 = sext i32 %210 to i64
%212 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 %211
%213 = load i8, i8* %212
%214 = zext i8 %213 to i32
%215 = and i32 %214, 128
%216 = icmp ne i32 %215, 0
%217 = zext i1 %216 to i64
%218 = select i1 %216, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0)
%219 = load i32, i32* %15
%220 = sub nsw i32 %219, 1
%221 = sext i32 %220 to i64
%222 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 %221
%223 = load i8, i8* %222
%224 = zext i8 %223 to i32
%225 = and i32 %224, 127
%226 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %218, i32 %225)
br label %227
227: ; preds = %208, %176
%228 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"%s\0A%d %d\0A\00"
@stderr = global i32 0
@.str.1 = [14 x i8] c"%s -> %d, %d\0A\00"
@EOF = global i32 0
@.str.2 = [37 x i8] c"\09!BYTE\090,%d\09; Scanline repeat count\0A\00"
@.str.3 = [8 x i8] c"\09!BYTE\09\00"
@.str.4 = [6 x i8] c"%s%d,\00"
@.str.5 = [5 x i8] c"128+\00"
@.str.6 = [1 x i8] zeroinitializer
@.str.7 = [6 x i8] c"%s%d\0A\00"
@str = [35 x i8] c"\09!BYTE\090,0\09; End of compressed map\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [4 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca [256 x i8]
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%8 = alloca [256 x i8]
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%11 = bitcast i32* %4 to i8*
%12 = bitcast i32* %5 to i8*
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%15 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %10, i32* %4, i32* %5)
%16 = load i32, i32* @stderr
%17 = load i32, i32* %4
%18 = load i32, i32* %5
%19 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %10, i32 %17, i32 %18)
%20 = load i32, i32* %5
%21 = add nsw i32 %20, -1
store i32 %21, i32* %5
%22 = icmp eq i32 %20, 0
br i1 %22, label %122, label %23
23: ; preds = %2, %114
%24 = phi i32 [ %116, %114 ], [ 0, %2 ]
%25 = phi i32 [ %115, %114 ], [ 1, %2 ]
%26 = load i32, i32* %4
%27 = icmp sgt i32 %26, 0
br i1 %27, label %28, label %71
28: ; preds = %23, %54
%29 = phi i32 [ %57, %54 ], [ 0, %23 ]
%30 = phi i32 [ %56, %54 ], [ 0, %23 ]
%31 = phi i32 [ %55, %54 ], [ 0, %23 ]
%32 = phi i32 [ %58, %54 ], [ 0, %23 ]
br label %33
33: ; preds = %28, %33
%34 = call i32 (...) @getchar()
%35 = and i32 %34, -2
%36 = icmp eq i32 %35, 48
%37 = load i32, i32* @EOF
%38 = icmp eq i32 %34, %37
%39 = select i1 %36, i1 true, i1 %38
br i1 %39, label %40, label %33
40: ; preds = %33
%41 = icmp eq i32 %34, %31
br i1 %41, label %42, label %44
42: ; preds = %40
%43 = add nsw i32 %30, 1
br label %54
44: ; preds = %40
%45 = icmp eq i32 %30, 0
br i1 %45, label %54, label %46
46: ; preds = %44
%47 = icmp eq i32 %31, 48
%48 = select i1 %47, i32 128, i32 0
%49 = add nsw i32 %48, %30
%50 = trunc i32 %49 to i8
%51 = add nsw i32 %29, 1
%52 = sext i32 %29 to i64
%53 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %52
store i8 %50, i8* %53
br label %54
54: ; preds = %44, %46, %42
%55 = phi i32 [ %31, %42 ], [ %34, %46 ], [ %34, %44 ]
%56 = phi i32 [ %43, %42 ], [ 1, %46 ], [ 1, %44 ]
%57 = phi i32 [ %29, %42 ], [ %51, %46 ], [ %29, %44 ]
%58 = add nuw nsw i32 %32, 1
%59 = load i32, i32* %4
%60 = icmp slt i32 %58, %59
br i1 %60, label %28, label %61
61: ; preds = %54
%62 = icmp eq i32 %56, 0
br i1 %62, label %71, label %63
63: ; preds = %61
%64 = icmp eq i32 %55, 48
%65 = select i1 %64, i32 128, i32 0
%66 = add nsw i32 %65, %56
%67 = trunc i32 %66 to i8
%68 = add nsw i32 %57, 1
%69 = sext i32 %57 to i64
%70 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %69
store i8 %67, i8* %70
br label %71
71: ; preds = %23, %63, %61
%72 = phi i32 [ %68, %63 ], [ %57, %61 ], [ 0, %23 ]
%73 = icmp eq i32 %72, %24
br i1 %73, label %74, label %79
74: ; preds = %71
%75 = call i64 @scancmp(i8* %13, i8* %14, i32 %24)
%76 = icmp eq i64 %75, 0
br i1 %76, label %77, label %79
77: ; preds = %74
%78 = add nsw i32 %25, 1
br label %114
79: ; preds = %74, %71
%80 = icmp eq i32 %24, 0
br i1 %80, label %110, label %81
81: ; preds = %79
%82 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %25)
%83 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%84 = add i32 %24, -1
%85 = icmp sgt i32 %24, 1
br i1 %85, label %86, label %100
86: ; preds = %81
%87 = zext i32 %84 to i64
br label %88
88: ; preds = %86, %88
%89 = phi i64 [ 0, %86 ], [ %98, %88 ]
%90 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 %89
%91 = load i8, i8* %90
%92 = zext i8 %91 to i32
%93 = and i32 %92, 128
%94 = icmp eq i32 %93, 0
%95 = select i1 %94, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0)
%96 = and i32 %92, 127
%97 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %95, i32 %96)
%98 = add nuw nsw i64 %89, 1
%99 = icmp eq i64 %98, %87
br i1 %99, label %100, label %88
100: ; preds = %88, %81
%101 = sext i32 %84 to i64
%102 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 %101
%103 = load i8, i8* %102
%104 = zext i8 %103 to i32
%105 = and i32 %104, 128
%106 = icmp eq i32 %105, 0
%107 = select i1 %106, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0)
%108 = and i32 %104, 127
%109 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %107, i32 %108)
br label %110
110: ; preds = %100, %79
%111 = icmp sgt i32 %72, 0
br i1 %111, label %112, label %114
112: ; preds = %110
%113 = zext i32 %72 to i64
br label %114
114: ; preds = %112, %110, %77
%115 = phi i32 [ %78, %77 ], [ 1, %110 ], [ 1, %112 ]
%116 = phi i32 [ %24, %77 ], [ %72, %110 ], [ %72, %112 ]
%117 = load i32, i32* %5
%118 = add nsw i32 %117, -1
store i32 %118, i32* %5
%119 = icmp eq i32 %117, 0
br i1 %119, label %120, label %23
120: ; preds = %114
%121 = icmp eq i32 %72, 0
br i1 %121, label %153, label %122
122: ; preds = %2, %120
%123 = phi i32 [ %72, %120 ], [ undef, %2 ]
%124 = phi i32 [ %115, %120 ], [ 1, %2 ]
%125 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %124)
%126 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%127 = add i32 %123, -1
%128 = icmp sgt i32 %123, 1
br i1 %128, label %129, label %143
129: ; preds = %122
%130 = zext i32 %127 to i64
br label %131
131: ; preds = %129, %131
%132 = phi i64 [ 0, %129 ], [ %141, %131 ]
%133 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %132
%134 = load i8, i8* %133
%135 = zext i8 %134 to i32
%136 = and i32 %135, 128
%137 = icmp eq i32 %136, 0
%138 = select i1 %137, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0)
%139 = and i32 %135, 127
%140 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %138, i32 %139)
%141 = add nuw nsw i64 %132, 1
%142 = icmp eq i64 %141, %130
br i1 %142, label %143, label %131
143: ; preds = %131, %122
%144 = sext i32 %127 to i64
%145 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %144
%146 = load i8, i8* %145
%147 = zext i8 %146 to i32
%148 = and i32 %147, 128
%149 = icmp eq i32 %148, 0
%150 = select i1 %149, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0)
%151 = and i32 %147, 127
%152 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* %150, i32 %151)
br label %153
153: ; preds = %143, %120
%154 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
ret i32 0
}