#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 uint8_t;
typedef long uint64_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
long compressBound(long);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
long fread(int *, int, long, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(int *);
long get_filesize(int /*<<< orphan*/ *);
int *malloc(long);
int /*<<< orphan*/ printf(char *, ...);
int test(int *, long *, int *, long, int *, long);
int main(int argc, char **argv) {
  int i, j, ret = 0, fin_ret = 0;
  FILE *file = NULL;
  uint64_t compressed_length, file_length;
  uint64_t uncompressed_length, uncompressed_test_stream_length;
  uint8_t *uncompressed_stream = NULL;
  uint8_t *compressed_stream = NULL;
  uint8_t *uncompressed_test_stream = NULL;
  if (argc == 1)
    printf("Error, no input file\n");
  for (i = 1; i < argc; i++) {
    file = NULL;
    uncompressed_stream = NULL;
    compressed_stream = NULL;
    uncompressed_test_stream = NULL;
    file = fopen(argv[i], "r");
    if (file == NULL) {
      printf("Error opening file %s\n", argv[i]);
      return 1;
    } else
      printf("Starting file %s", argv[i]);
    fflush(0);
    file_length = get_filesize(file);
    if (file_length > 512L * 1024L * 1024L) {
      printf("\nFile too large to run on this test,"
             " Max 512MB for 32bit OS, 2GB for 64bit OS.\n");
      printf(" ... Fail\n");
      fclose(file);
      continue;
    }
    compressed_length = compressBound(file_length);
    if (file_length != 0) {
      uncompressed_stream = malloc(file_length);
      uncompressed_test_stream = malloc(file_length);
    }
    compressed_stream = malloc(compressed_length);
    if (uncompressed_stream == NULL && file_length != 0) {
      printf("\nFailed to allocate input memory\n");
      exit(0);
    }
    if (compressed_stream == NULL) {
      printf("\nFailed to allocate output memory\n");
      exit(0);
    }
    if (uncompressed_test_stream == NULL && file_length != 0) {
      printf("\nFailed to allocate decompressed memory\n");
      exit(0);
    }
    uncompressed_length = fread(uncompressed_stream, 1, file_length, file);
    uncompressed_test_stream_length = uncompressed_length;
    ret = test(compressed_stream, &compressed_length, uncompressed_stream,
               uncompressed_length, uncompressed_test_stream,
               uncompressed_test_stream_length);
    if (ret) {
      for (j = 0; j < compressed_length; j++) {
        if ((j & 31) == 0)
          printf("\n");
        else
          printf(" ");
        printf("0x%02x,", compressed_stream[j]);
      }
      printf("\n");
    }
    fflush(0);
    fclose(file);
    if (compressed_stream != NULL)
      free(compressed_stream);
    if (uncompressed_stream != NULL)
      free(uncompressed_stream);
    if (uncompressed_test_stream != NULL)
      free(uncompressed_test_stream);
    if (ret) {
      printf(" ... Fail with exit code %d\n", ret);
      return ret;
    } else
      printf(" ... Pass\n");
    fin_ret |= ret;
  }
  return fin_ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x50(%rbp)
movq   $0x0,-0x58(%rbp)
movq   $0x0,-0x60(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    120c <main+0x5c>
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1504 <main+0x354>
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x50(%rbp)
movq   $0x0,-0x58(%rbp)
movq   $0x0,-0x60(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdc4(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    128c <main+0xdc>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xd9f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    150a <main+0x35a>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xd90(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %edi,%edi
call   1090 <fflush@plt>
mov    -0x28(%rbp),%rdi
call   10c0 <get_filesize@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x20000000,-0x38(%rbp)
20
jle    12f2 <main+0x142>
lea    0xd71(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
jmp    14f6 <main+0x346>
mov    -0x38(%rbp),%rdi
call   1070 <compressBound@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     1324 <main+0x174>
mov    -0x38(%rbp),%rdi
call   1080 <malloc@plt>
mov    %rax,-0x50(%rbp)
mov    -0x38(%rbp),%rdi
call   1080 <malloc@plt>
mov    %rax,-0x60(%rbp)
mov    -0x30(%rbp),%rdi
call   1080 <malloc@plt>
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x50(%rbp)
jne    135c <main+0x1ac>
cmpq   $0x0,-0x38(%rbp)
je     135c <main+0x1ac>
lea    0xd4d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %edi,%edi
call   10b0 <exit@plt>
cmpq   $0x0,-0x58(%rbp)
jne    137c <main+0x1cc>
lea    0xd4f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %edi,%edi
call   10b0 <exit@plt>
cmpq   $0x0,-0x60(%rbp)
jne    13a7 <main+0x1f7>
cmpq   $0x0,-0x38(%rbp)
je     13a7 <main+0x1f7>
lea    0xd47(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %edi,%edi
call   10b0 <exit@plt>
mov    -0x50(%rbp),%rdi
mov    -0x38(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fread@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x50(%rbp),%rdx
mov    -0x40(%rbp),%rcx
mov    -0x60(%rbp),%r8
mov    -0x48(%rbp),%r9
lea    -0x30(%rbp),%rsi
call   10d0 <test@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     146d <main+0x2bd>
movl   $0x0,-0x18(%rbp)
movslq -0x18(%rbp),%rax
cmp    -0x30(%rbp),%rax
jge    145f <main+0x2af>
mov    -0x18(%rbp),%eax
and    $0x1f,%eax
cmp    $0x0,%eax
jne    142a <main+0x27a>
lea    0xc70(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1438 <main+0x288>
lea    0xcd8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x58(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xcc1(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    13fa <main+0x24a>
lea    0xc28(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %edi,%edi
call   1090 <fflush@plt>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
cmpq   $0x0,-0x58(%rbp)
je     1491 <main+0x2e1>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x50(%rbp)
je     14a5 <main+0x2f5>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x60(%rbp)
je     14b9 <main+0x309>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0x1c(%rbp)
je     14df <main+0x32f>
mov    -0x1c(%rbp),%esi
lea    0xc46(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    150a <main+0x35a>
lea    0xc4a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x1c(%rbp),%eax
or     -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1213 <main+0x63>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
cmp    $0x1,%edi
jne    11f6 <main+0x26>
lea    0xf33(%rip),%rdi
call   1050 <puts@plt>
xor    %ebp,%ebp
jmp    1422 <main+0x252>
xor    %ebp,%ebp
cmp    $0x2,%edi
jl     1422 <main+0x252>
mov    %rsi,%rbx
mov    %edi,%r15d
mov    $0x1,%r14d
lea    0xdec(%rip),%r12
mov    %rsi,0x18(%rsp)
mov    %r15,0x10(%rsp)
jmp    1249 <main+0x79>
lea    0xe9d(%rip),%rdi
call   1050 <puts@plt>
lea    0xee0(%rip),%rdi
call   1050 <puts@plt>
mov    %r13,%rdi
call   1070 <fclose@plt>
add    $0x1,%r14
cmp    %r15,%r14
je     11ef <main+0x1f>
mov    (%rbx,%r14,8),%rdi
mov    %r12,%rsi
call   10c0 <fopen@plt>
mov    (%rbx,%r14,8),%rsi
test   %rax,%rax
je     13fd <main+0x22d>
mov    %rax,%r13
lea    0xdad(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    %r13,%rdi
call   10e0 <get_filesize@plt>
cmp    $0x20000001,%rax
jge    1220 <main+0x50>
mov    %rax,%rbp
mov    %rax,%rdi
call   1090 <compressBound@plt>
mov    %rax,%rbx
mov    %rax,(%rsp)
test   %rbp,%rbp
je     12d8 <main+0x108>
mov    %rbp,%rdi
call   10a0 <malloc@plt>
mov    %rax,%r12
mov    %rbp,%rdi
call   10a0 <malloc@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %r12,%rbx
call   10a0 <malloc@plt>
test   %r12,%r12
je     1445 <main+0x275>
mov    %rax,%r12
test   %r12,%r12
jne    12f1 <main+0x121>
jmp    1433 <main+0x263>
mov    %rbx,%rdi
call   10a0 <malloc@plt>
mov    %rax,%r12
xor    %r15d,%r15d
xor    %ebx,%ebx
test   %r12,%r12
je     1433 <main+0x263>
test   %r15,%r15
jne    12ff <main+0x12f>
test   %rbp,%rbp
jne    143c <main+0x26c>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %rbp,%rdx
mov    %r13,%rcx
call   1060 <fread@plt>
mov    %r12,%rdi
mov    %rsp,%rsi
mov    %rbx,%rdx
mov    %rax,%rcx
mov    %r15,%r8
mov    %rax,%r9
call   10f0 <test@plt>
mov    %eax,0xc(%rsp)
test   %eax,%eax
je     13a2 <main+0x1d2>
mov    %rbx,0x20(%rsp)
mov    %r15,0x28(%rsp)
mov    %rbp,0x30(%rsp)
cmpq   $0x0,(%rsp)
mov    $0xa,%r15d
lea    0xcd8(%rip),%rbp
jle    1389 <main+0x1b9>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
test   $0x1f,%bl
mov    $0x20,%edi
cmove  %r15d,%edi
call   1040 <putchar@plt>
mov    (%r12,%rbx,4),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,(%rsp)
jg     1360 <main+0x190>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    0x30(%rsp),%rbp
mov    0x28(%rsp),%r15
mov    0x20(%rsp),%rbx
xor    %edi,%edi
call   10b0 <fflush@plt>
mov    %r13,%rdi
call   1070 <fclose@plt>
mov    %r12,%rdi
call   1030 <free@plt>
test   %rbp,%rbp
je     13c6 <main+0x1f6>
mov    %rbx,%rdi
call   1030 <free@plt>
test   %r15,%r15
lea    0xc30(%rip),%r12
mov    0xc(%rsp),%ebp
je     13de <main+0x20e>
mov    %r15,%rdi
call   1030 <free@plt>
test   %ebp,%ebp
jne    1412 <main+0x242>
lea    0xc66(%rip),%rdi
call   1050 <puts@plt>
mov    0x18(%rsp),%rbx
mov    0x10(%rsp),%r15
jmp    1240 <main+0x70>
lea    0xbfe(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0x1,%ebp
jmp    1422 <main+0x252>
lea    0xc19(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %ebp,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc47(%rip),%rdi
jmp    144c <main+0x27c>
lea    0xc16(%rip),%rdi
jmp    144c <main+0x27c>
lea    0xc57(%rip),%rdi
call   1050 <puts@plt>
xor    %edi,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"Error, no input file\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [23 x i8] c"Error opening file %s\0A\00"
@.str.3 = [17 x i8] c"Starting file %s\00"
@.str.4 = [80 x i8] c"\0AFile too large to run on this test, Max 512MB for 32bit OS, 2GB for 64bit OS.\0A\00"
@.str.5 = [11 x i8] c" ... Fail\0A\00"
@.str.6 = [34 x i8] c"\0AFailed to allocate input memory\0A\00"
@.str.7 = [35 x i8] c"\0AFailed to allocate output memory\0A\00"
@.str.8 = [41 x i8] c"\0AFailed to allocate decompressed memory\0A\00"
@.str.9 = [2 x i8] c"\0A\00"
@.str.10 = [2 x i8] c" \00"
@.str.11 = [8 x i8] c"0x%02x,\00"
@.str.12 = [29 x i8] c" ... Fail with exit code %d\0A\00"
@.str.13 = [11 x i8] c" ... Pass\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 i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
store i32 0, i32* %9
store i32* null, i32** %10
store i32* null, i32** %15
store i32* null, i32** %16
store i32* null, i32** %17
%18 = load i32, i32* %4
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %22
20: ; preds = %2
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %22
22: ; preds = %20, %2
store i32 1, i32* %6
br label %23
23: ; preds = %171, %22
%24 = load i32, i32* %6
%25 = load i32, i32* %4
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %174
27: ; preds = %23
store i32* null, i32** %10
store i32* null, i32** %15
store i32* null, i32** %16
store i32* null, i32** %17
%28 = load i8**, i8*** %5
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
%32 = load i8*, i8** %31
%33 = call i32* @fopen(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %33, i32** %10
%34 = load i32*, i32** %10
%35 = icmp eq i32* %34, null
br i1 %35, label %36, label %43
36: ; preds = %27
%37 = load i8**, i8*** %5
%38 = load i32, i32* %6
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %37, i64 %39
%41 = load i8*, i8** %40
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %41)
store i32 1, i32* %3
br label %176
43: ; preds = %27
%44 = load i8**, i8*** %5
%45 = load i32, i32* %6
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8*, i8** %44, i64 %46
%48 = load i8*, i8** %47
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %48)
br label %50
50: ; preds = %43
%51 = call i32 @fflush(i32 0)
%52 = load i32*, i32** %10
%53 = call i64 @get_filesize(i32* %52)
store i64 %53, i64* %12
%54 = load i64, i64* %12
%55 = icmp sgt i64 %54, 536870912
br i1 %55, label %56, label %61
56: ; preds = %50
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.4, i64 0, i64 0))
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%59 = load i32*, i32** %10
%60 = call i32 @fclose(i32* %59)
br label %171
61: ; preds = %50
%62 = load i64, i64* %12
%63 = call i64 @compressBound(i64 %62)
store i64 %63, i64* %11
%64 = load i64, i64* %12
%65 = icmp ne i64 %64, 0
br i1 %65, label %66, label %71
66: ; preds = %61
%67 = load i64, i64* %12
%68 = call i32* @malloc(i64 %67)
store i32* %68, i32** %15
%69 = load i64, i64* %12
%70 = call i32* @malloc(i64 %69)
store i32* %70, i32** %17
br label %71
71: ; preds = %66, %61
%72 = load i64, i64* %11
%73 = call i32* @malloc(i64 %72)
store i32* %73, i32** %16
%74 = load i32*, i32** %15
%75 = icmp eq i32* %74, null
br i1 %75, label %76, label %82
76: ; preds = %71
%77 = load i64, i64* %12
%78 = icmp ne i64 %77, 0
br i1 %78, label %79, label %82
79: ; preds = %76
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
%81 = call i32 @exit(i32 0)
unreachable
82: ; preds = %76, %71
%83 = load i32*, i32** %16
%84 = icmp eq i32* %83, null
br i1 %84, label %85, label %88
85: ; preds = %82
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0))
%87 = call i32 @exit(i32 0)
unreachable
88: ; preds = %82
%89 = load i32*, i32** %17
%90 = icmp eq i32* %89, null
br i1 %90, label %91, label %97
91: ; preds = %88
%92 = load i64, i64* %12
%93 = icmp ne i64 %92, 0
br i1 %93, label %94, label %97
94: ; preds = %91
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.8, i64 0, i64 0))
%96 = call i32 @exit(i32 0)
unreachable
97: ; preds = %91, %88
%98 = load i32*, i32** %15
%99 = load i64, i64* %12
%100 = load i32*, i32** %10
%101 = call i64 @fread(i32* %98, i32 1, i64 %99, i32* %100)
store i64 %101, i64* %13
%102 = load i64, i64* %13
store i64 %102, i64* %14
%103 = load i32*, i32** %16
%104 = load i32*, i32** %15
%105 = load i64, i64* %13
%106 = load i32*, i32** %17
%107 = load i64, i64* %14
%108 = call i32 @test(i32* %103, i64* %11, i32* %104, i64 %105, i32* %106, i64 %107)
store i32 %108, i32* %8
%109 = load i32, i32* %8
%110 = icmp ne i32 %109, 0
br i1 %110, label %111, label %137
111: ; preds = %97
store i32 0, i32* %7
br label %112
112: ; preds = %132, %111
%113 = load i32, i32* %7
%114 = sext i32 %113 to i64
%115 = load i64, i64* %11
%116 = icmp slt i64 %114, %115
br i1 %116, label %117, label %135
117: ; preds = %112
%118 = load i32, i32* %7
%119 = and i32 %118, 31
%120 = icmp eq i32 %119, 0
br i1 %120, label %121, label %123
121: ; preds = %117
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %125
123: ; preds = %117
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
br label %125
125: ; preds = %123, %121
%126 = load i32*, i32** %16
%127 = load i32, i32* %7
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds i32, i32* %126, i64 %128
%130 = load i32, i32* %129
%131 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0), i32 %130)
br label %132
132: ; preds = %125
%133 = load i32, i32* %7
%134 = add nsw i32 %133, 1
store i32 %134, i32* %7
br label %112
135: ; preds = %112
%136 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %137
137: ; preds = %135, %97
%138 = call i32 @fflush(i32 0)
%139 = load i32*, i32** %10
%140 = call i32 @fclose(i32* %139)
%141 = load i32*, i32** %16
%142 = icmp ne i32* %141, null
br i1 %142, label %143, label %146
143: ; preds = %137
%144 = load i32*, i32** %16
%145 = call i32 @free(i32* %144)
br label %146
146: ; preds = %143, %137
%147 = load i32*, i32** %15
%148 = icmp ne i32* %147, null
br i1 %148, label %149, label %152
149: ; preds = %146
%150 = load i32*, i32** %15
%151 = call i32 @free(i32* %150)
br label %152
152: ; preds = %149, %146
%153 = load i32*, i32** %17
%154 = icmp ne i32* %153, null
br i1 %154, label %155, label %158
155: ; preds = %152
%156 = load i32*, i32** %17
%157 = call i32 @free(i32* %156)
br label %158
158: ; preds = %155, %152
%159 = load i32, i32* %8
%160 = icmp ne i32 %159, 0
br i1 %160, label %161, label %165
161: ; preds = %158
%162 = load i32, i32* %8
%163 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), i32 %162)
%164 = load i32, i32* %8
store i32 %164, i32* %3
br label %176
165: ; preds = %158
%166 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0))
br label %167
167: ; preds = %165
%168 = load i32, i32* %8
%169 = load i32, i32* %9
%170 = or i32 %169, %168
store i32 %170, i32* %9
br label %171
171: ; preds = %167, %56
%172 = load i32, i32* %6
%173 = add nsw i32 %172, 1
store i32 %173, i32* %6
br label %23
174: ; preds = %23
%175 = load i32, i32* %9
store i32 %175, i32* %3
br label %176
176: ; preds = %174, %161, %36
%177 = load i32, i32* %3
ret i32 %177
}

LLVM IR (-O2):
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [23 x i8] c"Error opening file %s\0A\00"
@.str.3 = [17 x i8] c"Starting file %s\00"
@.str.11 = [8 x i8] c"0x%02x,\00"
@.str.12 = [29 x i8] c" ... Fail with exit code %d\0A\00"
@str = [10 x i8] c" ... Pass\00"
@str.14 = [40 x i8] c"\0AFailed to allocate decompressed memory\00"
@str.15 = [34 x i8] c"\0AFailed to allocate output memory\00"
@str.16 = [33 x i8] c"\0AFailed to allocate input memory\00"
@str.17 = [79 x i8] c"\0AFile too large to run on this test, Max 512MB for 32bit OS, 2GB for 64bit OS.\00"
@str.18 = [10 x i8] c" ... Fail\00"
@str.19 = [21 x i8] c"Error, no input file\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
%5 = icmp eq i32 %0, 1
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.19, i64 0, i64 0))
br label %95
8: ; preds = %2
%9 = icmp sgt i32 %0, 1
br i1 %9, label %10, label %95
10: ; preds = %8
%11 = zext i32 %0 to i64
br label %12
12: ; preds = %10, %92
%13 = phi i64 [ 1, %10 ], [ %93, %92 ]
%14 = getelementptr inbounds i8*, i8** %1, i64 %13
%15 = load i8*, i8** %14
%16 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i32* %16, null
%18 = load i8*, i8** %14
br i1 %17, label %19, label %21
19: ; preds = %12
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %18)
br label %95
21: ; preds = %12
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %18)
%23 = call i32 @fflush(i32 0)
%24 = call i64 @get_filesize(i32* %16)
%25 = icmp sgt i64 %24, 536870912
br i1 %25, label %26, label %30
26: ; preds = %21
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([79 x i8], [79 x i8]* @str.17, i64 0, i64 0))
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.18, i64 0, i64 0))
%29 = call i32 @fclose(i32* %16)
br label %92
30: ; preds = %21
%31 = call i64 @compressBound(i64 %24)
store i64 %31, i64* %3
%32 = icmp ne i64 %24, 0
br i1 %32, label %35, label %33
33: ; preds = %30
%34 = call i32* @malloc(i64 %31)
br label %43
35: ; preds = %30
%36 = call i32* @malloc(i64 %24)
%37 = call i32* @malloc(i64 %24)
%38 = call i32* @malloc(i64 %31)
%39 = icmp eq i32* %36, null
br i1 %39, label %40, label %43
40: ; preds = %35
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.16, i64 0, i64 0))
%42 = call i32 @exit(i32 0)
unreachable
43: ; preds = %33, %35
%44 = phi i32* [ %34, %33 ], [ %38, %35 ]
%45 = phi i32* [ null, %33 ], [ %37, %35 ]
%46 = phi i32* [ null, %33 ], [ %36, %35 ]
%47 = icmp eq i32* %44, null
br i1 %47, label %48, label %51
48: ; preds = %43
%49 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.15, i64 0, i64 0))
%50 = call i32 @exit(i32 0)
unreachable
51: ; preds = %43
%52 = icmp eq i32* %45, null
%53 = select i1 %52, i1 %32, i1 false
br i1 %53, label %54, label %57
54: ; preds = %51
%55 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.14, i64 0, i64 0))
%56 = call i32 @exit(i32 0)
unreachable
57: ; preds = %51
%58 = call i64 @fread(i32* %46, i32 1, i64 %24, i32* %16)
%59 = call i32 @test(i32* %44, i64* %3, i32* %46, i64 %58, i32* %45, i64 %58)
%60 = icmp eq i32 %59, 0
br i1 %60, label %78, label %61
61: ; preds = %57
%62 = load i64, i64* %3
%63 = icmp sgt i64 %62, 0
br i1 %63, label %64, label %76
64: ; preds = %61, %64
%65 = phi i64 [ %73, %64 ], [ 0, %61 ]
%66 = and i64 %65, 31
%67 = icmp eq i64 %66, 0
%68 = select i1 %67, i32 10, i32 32
%69 = call i32 @putchar(i32 %68)
%70 = getelementptr inbounds i32, i32* %44, i64 %65
%71 = load i32, i32* %70
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0), i32 %71)
%73 = add nuw nsw i64 %65, 1
%74 = load i64, i64* %3
%75 = icmp sgt i64 %74, %73
br i1 %75, label %64, label %76
76: ; preds = %64, %61
%77 = call i32 @putchar(i32 10)
br label %78
78: ; preds = %76, %57
%79 = call i32 @fflush(i32 0)
%80 = call i32 @fclose(i32* %16)
%81 = call i32 @free(i32* %44)
br i1 %32, label %82, label %84
82: ; preds = %78
%83 = call i32 @free(i32* %46)
br label %84
84: ; preds = %82, %78
br i1 %52, label %87, label %85
85: ; preds = %84
%86 = call i32 @free(i32* %45)
br label %87
87: ; preds = %85, %84
br i1 %60, label %90, label %88
88: ; preds = %87
%89 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), i32 %59)
br label %95
90: ; preds = %87
%91 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
br label %92
92: ; preds = %90, %26
%93 = add nuw nsw i64 %13, 1
%94 = icmp eq i64 %93, %11
br i1 %94, label %95, label %12
95: ; preds = %92, %6, %8, %88, %19
%96 = phi i32 [ 1, %19 ], [ %59, %88 ], [ 0, %8 ], [ 0, %6 ], [ 0, %92 ]
ret i32 %96
}