#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 EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int lzss_encode(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int lzss_encode_better(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                       int /*<<< orphan*/ *, char, int, int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int rle_one(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  FILE *output, *header, *ansi;
  int ch, byte_count = 0, orig_byte_count = 0;
  if (argc < 2) {
    printf("\nUseage:\n\t%s ansi_file\n\n", argv[0]);
    return 3;
  }
  ansi = fopen(argv[1], "r");
  if (ansi == NULL) {
    printf("Could not open \"%s\"\n", argv[1]);
    return 2;
  }
  output = fopen("logo.inc", "w");
  if (output == NULL) {
    printf("Could not open \"logo.inc\"\n");
    return 1;
  }
  byte_count = rle_one(ansi, output);
  printf("Size of RLE version: %i\n", byte_count);
  fclose(output);
  output = fopen("logo.lzss", "w");
  if (output == NULL) {
    printf("Could not open \"logo.lzss\"\n");
    return 1;
  }
  rewind(ansi);
  byte_count = lzss_encode(ansi, output);
  printf("Size of LZSS version: %i\n", byte_count);
  fclose(output);
  output = fopen("logo.lzss_new", "w");
  if (output == NULL) {
    printf("Could not open \"logo.lzss_new\"\n");
    return 1;
  }
  header = fopen("logo.include", "w");
  if (header == NULL) {
    printf("Could not open \"header\"\n");
    return 1;
  }
  rewind(ansi);
  byte_count = lzss_encode_better(ansi, header, output, '\0', 1024, 2, 0);
  printf("Size of LZSS-NEW version: %i\n", byte_count);
  fclose(output);
  fclose(header);
  output = fopen("logo.lzss_new.parisc", "w");
  if (output == NULL) {
    printf("Could not open \"logo.lzss_new.parisc\"\n");
    return 1;
  }
  header = fopen("logo.include.parisc", "w");
  if (header == NULL) {
    printf("Could not open \"header\"\n");
    return 1;
  }
  rewind(ansi);
  lzss_encode_better(ansi, header, output, '\0', 1024, 2, 1);
  fclose(output);
  fclose(header);
  output = fopen("logo.lzss_new.h", "w");
  if (output == NULL) {
    printf("Could not open \"logo.lzss_new.h\"\n");
    return 1;
  }
  rewind(ansi);
  lzss_encode_better(ansi, output, output, '\0', 1024, 2, 3);
  fclose(output);
  rewind(ansi);
  while ((ch = fgetc(ansi)) != EOF) {
    orig_byte_count++;
  }
  fclose(ansi);
  printf("Size of original version: %i\n", orig_byte_count);
  if (orig_byte_count < byte_count) {
    printf("!!! e-mail vince and tell him to add a no-compress mode\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11cf <main+0x4f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x3,-0x4(%rbp)
jmp    1550 <main+0x3d0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe3b(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1214 <main+0x94>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    1550 <main+0x3d0>
lea    0xe15(%rip),%rdi
lea    0xe97(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1250 <main+0xd0>
lea    0xdfc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1550 <main+0x3d0>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1080 <rle_one@plt>
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%esi
lea    0xdea(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xdec(%rip),%rdi
lea    0xe31(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    12b6 <main+0x136>
lea    0xdd4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1550 <main+0x3d0>
mov    -0x28(%rbp),%rdi
call   1050 <rewind@plt>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10a0 <lzss_encode@plt>
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%esi
lea    0xdba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xdbd(%rip),%rdi
lea    0xdc2(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1325 <main+0x1a5>
lea    0xda9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1550 <main+0x3d0>
lea    0xdaf(%rip),%rdi
lea    0xd86(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1361 <main+0x1e1>
lea    0xd9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1550 <main+0x3d0>
mov    -0x28(%rbp),%rdi
call   1050 <rewind@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
xor    %ecx,%ecx
mov    $0x400,%r8d
mov    $0x2,%r9d
movl   $0x0,(%rsp)
call   1060 <lzss_encode_better@plt>
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%esi
lea    0xd64(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xd62(%rip),%rdi
lea    0xcf5(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    13f2 <main+0x272>
lea    0xd55(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1550 <main+0x3d0>
lea    0xd62(%rip),%rdi
lea    0xcb9(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    142e <main+0x2ae>
lea    0xccd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1550 <main+0x3d0>
mov    -0x28(%rbp),%rdi
call   1050 <rewind@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
xor    %ecx,%ecx
mov    $0x400,%r8d
mov    $0x2,%r9d
movl   $0x1,(%rsp)
call   1060 <lzss_encode_better@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xcf9(%rip),%rdi
lea    0xc3c(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    14ab <main+0x32b>
lea    0xce7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1550 <main+0x3d0>
mov    -0x28(%rbp),%rdi
call   1050 <rewind@plt>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x18(%rbp),%rdx
xor    %ecx,%ecx
mov    $0x400,%r8d
mov    $0x2,%r9d
movl   $0x3,(%rsp)
call   1060 <lzss_encode_better@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x28(%rbp),%rdi
call   1050 <rewind@plt>
mov    -0x28(%rbp),%rdi
call   1070 <fgetc@plt>
mov    %eax,-0x2c(%rbp)
mov    0x2ae9(%rip),%rcx
cmp    (%rcx),%eax
je     1515 <main+0x395>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    14ec <main+0x36c>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x34(%rbp),%esi
lea    0xc79(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x34(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    1549 <main+0x3c9>
lea    0xc7d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbp
cmp    $0x1,%edi
jg     11bb <main+0x2b>
mov    0x0(%rbp),%rsi
lea    0xe56(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x3,%ebx
jmp    1464 <main+0x2d4>
mov    0x8(%rbp),%rdi
lea    0xe53(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     140d <main+0x27d>
mov    %rax,%rbx
lea    0xe52(%rip),%rdi
lea    0xe9d(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1426 <main+0x296>
mov    %rax,%rbp
mov    %rbx,%rdi
mov    %rax,%rsi
call   1090 <rle_one@plt>
lea    0xe31(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbp,%rdi
call   1040 <fclose@plt>
lea    0xe32(%rip),%rdi
lea    0xe5b(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     142f <main+0x29f>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1060 <rewind@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10b0 <lzss_encode@plt>
lea    0xe0a(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbp,%rdi
call   1040 <fclose@plt>
lea    0xe0c(%rip),%rdi
lea    0xe11(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1438 <main+0x2a8>
mov    %rax,%rbp
lea    0xdfb(%rip),%rdi
lea    0xdf2(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1441 <main+0x2b1>
mov    %rax,%r15
mov    %rbx,%rdi
call   1060 <rewind@plt>
movl   $0x0,(%rsp)
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
xor    %ecx,%ecx
mov    $0x400,%r8d
mov    $0x2,%r9d
call   1070 <lzss_encode_better@plt>
mov    %eax,%r14d
lea    0xdbb(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbp,%rdi
call   1040 <fclose@plt>
mov    %r15,%rdi
call   1040 <fclose@plt>
lea    0xdb9(%rip),%rdi
lea    0xd85(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     144a <main+0x2ba>
mov    %rax,%rbp
lea    0xdaf(%rip),%rdi
lea    0xd66(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1441 <main+0x2b1>
mov    %rax,%r15
mov    %rbx,%rdi
call   1060 <rewind@plt>
movl   $0x1,(%rsp)
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
xor    %ecx,%ecx
mov    $0x400,%r8d
mov    $0x2,%r9d
call   1070 <lzss_encode_better@plt>
mov    %rbp,%rdi
call   1040 <fclose@plt>
mov    %r15,%rdi
call   1040 <fclose@plt>
lea    0xd69(%rip),%rdi
lea    0xd0c(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1453 <main+0x2c3>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1060 <rewind@plt>
movl   $0x3,(%rsp)
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %rbp,%rdx
xor    %ecx,%ecx
mov    $0x400,%r8d
mov    $0x2,%r9d
call   1070 <lzss_encode_better@plt>
mov    %rbp,%rdi
call   1040 <fclose@plt>
mov    %rbx,%rdi
call   1060 <rewind@plt>
mov    $0xffffffff,%ebp
mov    0x2c1a(%rip),%r15
xchg   %ax,%ax
mov    %rbx,%rdi
call   1080 <fgetc@plt>
add    $0x1,%ebp
cmp    (%r15),%eax
jne    13d0 <main+0x240>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xcf9(%rip),%rdi
xor    %ebx,%ebx
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %r14d,%ebp
jge    1464 <main+0x2d4>
lea    0xd00(%rip),%rdi
call   1030 <puts@plt>
jmp    1464 <main+0x2d4>
mov    0x8(%rbp),%rsi
lea    0xc03(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x2,%ebx
jmp    1464 <main+0x2d4>
lea    0xdaa(%rip),%rdi
jmp    145a <main+0x2ca>
lea    0xd86(%rip),%rdi
jmp    145a <main+0x2ca>
lea    0xd5e(%rip),%rdi
jmp    145a <main+0x2ca>
lea    0xd3d(%rip),%rdi
jmp    145a <main+0x2ca>
lea    0xd0e(%rip),%rdi
jmp    145a <main+0x2ca>
lea    0xce4(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"\0AUseage:\0A\09%s ansi_file\0A\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [21 x i8] c"Could not open \22%s\22\0A\00"
@.str.3 = [9 x i8] c"logo.inc\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [27 x i8] c"Could not open \22logo.inc\22\0A\00"
@.str.6 = [25 x i8] c"Size of RLE version: %i\0A\00"
@.str.7 = [10 x i8] c"logo.lzss\00"
@.str.8 = [28 x i8] c"Could not open \22logo.lzss\22\0A\00"
@.str.9 = [26 x i8] c"Size of LZSS version: %i\0A\00"
@.str.10 = [14 x i8] c"logo.lzss_new\00"
@.str.11 = [32 x i8] c"Could not open \22logo.lzss_new\22\0A\00"
@.str.12 = [13 x i8] c"logo.include\00"
@.str.13 = [25 x i8] c"Could not open \22header\22\0A\00"
@.str.14 = [30 x i8] c"Size of LZSS-NEW version: %i\0A\00"
@.str.15 = [21 x i8] c"logo.lzss_new.parisc\00"
@.str.16 = [39 x i8] c"Could not open \22logo.lzss_new.parisc\22\0A\00"
@.str.17 = [20 x i8] c"logo.include.parisc\00"
@.str.18 = [16 x i8] c"logo.lzss_new.h\00"
@.str.19 = [34 x i8] c"Could not open \22logo.lzss_new.h\22\0A\00"
@EOF = global i32 0
@.str.20 = [30 x i8] c"Size of original version: %i\0A\00"
@.str.21 = [57 x i8] c"!!! e-mail vince and tell him to add a no-compress mode\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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %10
store i32 0, i32* %11
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 2
br i1 %13, label %14, label %19
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %17)
store i32 3, i32* %3
br label %141
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32* @fopen(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %23, i32** %8
%24 = load i32*, i32** %8
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %31
26: ; preds = %19
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %29)
store i32 2, i32* %3
br label %141
31: ; preds = %19
%32 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %32, i32** %6
%33 = load i32*, i32** %6
%34 = icmp eq i32* %33, null
br i1 %34, label %35, label %37
35: ; preds = %31
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %3
br label %141
37: ; preds = %31
%38 = load i32*, i32** %8
%39 = load i32*, i32** %6
%40 = call i32 @rle_one(i32* %38, i32* %39)
store i32 %40, i32* %10
%41 = load i32, i32* %10
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i32 %41)
%43 = load i32*, i32** %6
%44 = call i32 @fclose(i32* %43)
%45 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, 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 %50
48: ; preds = %37
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %3
br label %141
50: ; preds = %37
%51 = load i32*, i32** %8
%52 = call i32 @rewind(i32* %51)
%53 = load i32*, i32** %8
%54 = load i32*, i32** %6
%55 = call i32 @lzss_encode(i32* %53, i32* %54)
store i32 %55, i32* %10
%56 = load i32, i32* %10
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i32 %56)
%58 = load i32*, i32** %6
%59 = call i32 @fclose(i32* %58)
%60 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %60, i32** %6
%61 = load i32*, i32** %6
%62 = icmp eq i32* %61, null
br i1 %62, label %63, label %65
63: ; preds = %50
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.11, i64 0, i64 0))
store i32 1, i32* %3
br label %141
65: ; preds = %50
%66 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %66, i32** %7
%67 = load i32*, i32** %7
%68 = icmp eq i32* %67, null
br i1 %68, label %69, label %71
69: ; preds = %65
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.13, i64 0, i64 0))
store i32 1, i32* %3
br label %141
71: ; preds = %65
%72 = load i32*, i32** %8
%73 = call i32 @rewind(i32* %72)
%74 = load i32*, i32** %8
%75 = load i32*, i32** %7
%76 = load i32*, i32** %6
%77 = call i32 @lzss_encode_better(i32* %74, i32* %75, i32* %76, i8 signext 0, i32 1024, i32 2, i32 0)
store i32 %77, i32* %10
%78 = load i32, i32* %10
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.14, i64 0, i64 0), i32 %78)
%80 = load i32*, i32** %6
%81 = call i32 @fclose(i32* %80)
%82 = load i32*, i32** %7
%83 = call i32 @fclose(i32* %82)
%84 = call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %84, i32** %6
%85 = load i32*, i32** %6
%86 = icmp eq i32* %85, null
br i1 %86, label %87, label %89
87: ; preds = %71
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.16, i64 0, i64 0))
store i32 1, i32* %3
br label %141
89: ; preds = %71
%90 = call i32* @fopen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %90, i32** %7
%91 = load i32*, i32** %7
%92 = icmp eq i32* %91, null
br i1 %92, label %93, label %95
93: ; preds = %89
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.13, i64 0, i64 0))
store i32 1, i32* %3
br label %141
95: ; preds = %89
%96 = load i32*, i32** %8
%97 = call i32 @rewind(i32* %96)
%98 = load i32*, i32** %8
%99 = load i32*, i32** %7
%100 = load i32*, i32** %6
%101 = call i32 @lzss_encode_better(i32* %98, i32* %99, i32* %100, i8 signext 0, i32 1024, i32 2, i32 1)
%102 = load i32*, i32** %6
%103 = call i32 @fclose(i32* %102)
%104 = load i32*, i32** %7
%105 = call i32 @fclose(i32* %104)
%106 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %106, i32** %6
%107 = load i32*, i32** %6
%108 = icmp eq i32* %107, null
br i1 %108, label %109, label %111
109: ; preds = %95
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.19, i64 0, i64 0))
store i32 1, i32* %3
br label %141
111: ; preds = %95
%112 = load i32*, i32** %8
%113 = call i32 @rewind(i32* %112)
%114 = load i32*, i32** %8
%115 = load i32*, i32** %6
%116 = load i32*, i32** %6
%117 = call i32 @lzss_encode_better(i32* %114, i32* %115, i32* %116, i8 signext 0, i32 1024, i32 2, i32 3)
%118 = load i32*, i32** %6
%119 = call i32 @fclose(i32* %118)
%120 = load i32*, i32** %8
%121 = call i32 @rewind(i32* %120)
br label %122
122: ; preds = %127, %111
%123 = load i32*, i32** %8
%124 = call i32 @fgetc(i32* %123)
store i32 %124, i32* %9
%125 = load i32, i32* @EOF
%126 = icmp ne i32 %124, %125
br i1 %126, label %127, label %130
127: ; preds = %122
%128 = load i32, i32* %11
%129 = add nsw i32 %128, 1
store i32 %129, i32* %11
br label %122
130: ; preds = %122
%131 = load i32*, i32** %8
%132 = call i32 @fclose(i32* %131)
%133 = load i32, i32* %11
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.20, i64 0, i64 0), i32 %133)
%135 = load i32, i32* %11
%136 = load i32, i32* %10
%137 = icmp slt i32 %135, %136
br i1 %137, label %138, label %140
138: ; preds = %130
%139 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.21, i64 0, i64 0))
br label %140
140: ; preds = %138, %130
store i32 0, i32* %3
br label %141
141: ; preds = %140, %109, %93, %87, %69, %63, %48, %35, %26, %14
%142 = load i32, i32* %3
ret i32 %142
}

LLVM IR (-O2):
@.str = [25 x i8] c"\0AUseage:\0A\09%s ansi_file\0A\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [21 x i8] c"Could not open \22%s\22\0A\00"
@.str.3 = [9 x i8] c"logo.inc\00"
@.str.4 = [2 x i8] c"w\00"
@.str.6 = [25 x i8] c"Size of RLE version: %i\0A\00"
@.str.7 = [10 x i8] c"logo.lzss\00"
@.str.9 = [26 x i8] c"Size of LZSS version: %i\0A\00"
@.str.10 = [14 x i8] c"logo.lzss_new\00"
@.str.12 = [13 x i8] c"logo.include\00"
@.str.14 = [30 x i8] c"Size of LZSS-NEW version: %i\0A\00"
@.str.15 = [21 x i8] c"logo.lzss_new.parisc\00"
@.str.17 = [20 x i8] c"logo.include.parisc\00"
@.str.18 = [16 x i8] c"logo.lzss_new.h\00"
@EOF = global i32 0
@.str.20 = [30 x i8] c"Size of original version: %i\0A\00"
@str = [56 x i8] c"!!! e-mail vince and tell him to add a no-compress mode\00"
@str.22 = [33 x i8] c"Could not open \22logo.lzss_new.h\22\00"
@str.24 = [38 x i8] c"Could not open \22logo.lzss_new.parisc\22\00"
@str.25 = [24 x i8] c"Could not open \22header\22\00"
@str.26 = [31 x i8] c"Could not open \22logo.lzss_new\22\00"
@str.27 = [27 x i8] c"Could not open \22logo.lzss\22\00"
@str.28 = [26 x i8] c"Could not open \22logo.inc\22\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %83
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32* @fopen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = load i8*, i8** %8
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %13)
br label %83
15: ; preds = %7
%16 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.28, i64 0, i64 0))
br label %83
20: ; preds = %15
%21 = tail call i32 @rle_one(i32* %10, i32* %16)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i32 %21)
%23 = tail call i32 @fclose(i32* %16)
%24 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %28
26: ; preds = %20
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.27, i64 0, i64 0))
br label %83
28: ; preds = %20
%29 = tail call i32 @rewind(i32* %10)
%30 = tail call i32 @lzss_encode(i32* %10, i32* %24)
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i32 %30)
%32 = tail call i32 @fclose(i32* %24)
%33 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%34 = icmp eq i32* %33, null
br i1 %34, label %35, label %37
35: ; preds = %28
%36 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.26, i64 0, i64 0))
br label %83
37: ; preds = %28
%38 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), 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 %42
40: ; preds = %37
%41 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.25, i64 0, i64 0))
br label %83
42: ; preds = %37
%43 = tail call i32 @rewind(i32* %10)
%44 = tail call i32 @lzss_encode_better(i32* %10, i32* %38, i32* %33, i8 signext 0, i32 1024, i32 2, i32 0)
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.14, i64 0, i64 0), i32 %44)
%46 = tail call i32 @fclose(i32* %33)
%47 = tail call i32 @fclose(i32* %38)
%48 = tail call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%49 = icmp eq i32* %48, null
br i1 %49, label %50, label %52
50: ; preds = %42
%51 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.24, i64 0, i64 0))
br label %83
52: ; preds = %42
%53 = tail call i32* @fopen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%54 = icmp eq i32* %53, null
br i1 %54, label %55, label %57
55: ; preds = %52
%56 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.25, i64 0, i64 0))
br label %83
57: ; preds = %52
%58 = tail call i32 @rewind(i32* %10)
%59 = tail call i32 @lzss_encode_better(i32* %10, i32* %53, i32* %48, i8 signext 0, i32 1024, i32 2, i32 1)
%60 = tail call i32 @fclose(i32* %48)
%61 = tail call i32 @fclose(i32* %53)
%62 = tail call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%63 = icmp eq i32* %62, null
br i1 %63, label %64, label %66
64: ; preds = %57
%65 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.22, i64 0, i64 0))
br label %83
66: ; preds = %57
%67 = tail call i32 @rewind(i32* %10)
%68 = tail call i32 @lzss_encode_better(i32* %10, i32* %62, i32* %62, i8 signext 0, i32 1024, i32 2, i32 3)
%69 = tail call i32 @fclose(i32* %62)
%70 = tail call i32 @rewind(i32* %10)
br label %71
71: ; preds = %71, %66
%72 = phi i32 [ 0, %66 ], [ %76, %71 ]
%73 = tail call i32 @fgetc(i32* %10)
%74 = load i32, i32* @EOF
%75 = icmp eq i32 %73, %74
%76 = add nuw nsw i32 %72, 1
br i1 %75, label %77, label %71
77: ; preds = %71
%78 = tail call i32 @fclose(i32* %10)
%79 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.20, i64 0, i64 0), i32 %72)
%80 = icmp slt i32 %72, %44
br i1 %80, label %81, label %83
81: ; preds = %77
%82 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str, i64 0, i64 0))
br label %83
83: ; preds = %77, %81, %64, %55, %50, %40, %35, %26, %18, %12, %4
%84 = phi i32 [ 3, %4 ], [ 2, %12 ], [ 1, %18 ], [ 1, %26 ], [ 1, %35 ], [ 1, %40 ], [ 1, %50 ], [ 1, %55 ], [ 1, %64 ], [ 0, %81 ], [ 0, %77 ]
ret i32 %84
}