#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 /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
unsigned long ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  FILE *infp;
  int i, gpflags, tmp[4];
  unsigned long bytes;
  if (argc < 2) {
    fprintf(stderr, "specify filename!\n");
    return -1;
  }
  infp = fopen(argv[1], "rb");
  if (!infp) {
    fprintf(stderr, "Could not open file %s for reading\n", argv[1]);
    return 20;
  }
  fseek(infp, 0, SEEK_END);
  bytes = ftell(infp);
  fseek(infp, 0, SEEK_SET);
  tmp[0] = fgetc(infp);
  if (tmp[0] == -1) {
    fprintf(stderr, "error reading data from file\n");
    return 0;
  }
  tmp[1] = fgetc(infp);
  if (tmp[0] != 0x1f || tmp[1] != 0x8b) {
    fprintf(stderr, "Magic number mismatch 0x%02x%02x\n", tmp[0], tmp[1]);
    return 20;
  }
  tmp[0] = fgetc(infp);
  if (tmp[0] != 8) {
    fprintf(stderr, "Unknown compression method: 0x%02x\n", tmp[0]);
    return 20;
  }
  gpflags = fgetc(infp);
  if ((gpflags & ~0x1f)) {
    fprintf(stderr, "Unknown flags set!\n");
  }
  fgetc(infp);
  fgetc(infp);
  fgetc(infp);
  fgetc(infp);
  fgetc(infp);
  fgetc(infp);
  if ((gpflags & 4)) {
    tmp[0] = fgetc(infp);
    tmp[1] = fgetc(infp);
    i = tmp[0] + 256 * tmp[1];
    while (i--) {
      fgetc(infp);
    }
  }
  if ((gpflags & 8)) {
    while ((fgetc(infp)) > 0) {
    }
  }
  if ((gpflags & 16)) {
    while ((fgetc(infp)) > 0) {
    }
  }
  if ((gpflags & 2)) {
    fgetc(infp);
    fgetc(infp);
  }
  bytes = bytes - ftell(infp) - 8;
  if (bytes > 32767) {
    fprintf(stderr, "Warning:  Resulting file will be too large\n");
  }
  while (bytes--)
    fputc(fgetc(infp), stdout);
  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)
cmpl   $0x2,-0x8(%rbp)
jge    11a3 <main+0x43>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
lea    0xe70(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14b7 <main+0x357>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe61(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11f1 <main+0x91>
mov    0x2e0b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe38(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x14,-0x4(%rbp)
jmp    14b7 <main+0x357>
mov    -0x18(%rbp),%rdi
mov    0x2dec(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1070 <fseek@plt>
mov    -0x18(%rbp),%rdi
call   1060 <ftell@plt>
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2db3(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1070 <fseek@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0xffffffff,-0x30(%rbp)
jne    125f <main+0xff>
mov    0x2d95(%rip),%rax
mov    (%rax),%edi
lea    0xdee(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14b7 <main+0x357>
mov    -0x18(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x1f,-0x30(%rbp)
jne    1282 <main+0x122>
cmpl   $0x8b,-0x2c(%rbp)
je     12ab <main+0x14b>
mov    0x2d4f(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%edx
mov    -0x2c(%rbp),%ecx
lea    0xdc0(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x14,-0x4(%rbp)
jmp    14b7 <main+0x357>
mov    -0x18(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x8,-0x30(%rbp)
je     12e7 <main+0x187>
mov    0x2d10(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%edx
lea    0xda6(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x14,-0x4(%rbp)
jmp    14b7 <main+0x357>
mov    -0x18(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
and    $0xffffffe0,%eax
cmp    $0x0,%eax
je     1319 <main+0x1b9>
mov    0x2ccf(%rip),%rax
mov    (%rax),%edi
lea    0xd8c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fgetc@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fgetc@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fgetc@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fgetc@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fgetc@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fgetc@plt>
mov    -0x20(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     13ab <main+0x24b>
mov    -0x18(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x30(%rbp),%eax
mov    -0x2c(%rbp),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x1c(%rbp)
cmp    $0x0,%eax
je     13a6 <main+0x246>
mov    -0x18(%rbp),%rdi
call   1030 <fgetc@plt>
jmp    1384 <main+0x224>
jmp    13ab <main+0x24b>
mov    -0x20(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     13db <main+0x27b>
jmp    13bf <main+0x25f>
mov    -0x18(%rbp),%rdi
call   1030 <fgetc@plt>
cmp    $0x0,%eax
jle    13d6 <main+0x276>
jmp    13bf <main+0x25f>
jmp    13db <main+0x27b>
mov    -0x20(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     140b <main+0x2ab>
jmp    13ef <main+0x28f>
mov    -0x18(%rbp),%rdi
call   1030 <fgetc@plt>
cmp    $0x0,%eax
jle    1406 <main+0x2a6>
jmp    13ef <main+0x28f>
jmp    140b <main+0x2ab>
mov    -0x20(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     142c <main+0x2cc>
mov    -0x18(%rbp),%rdi
call   1030 <fgetc@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fgetc@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <ftell@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
sub    %rcx,%rax
sub    $0x8,%rax
mov    %rax,-0x38(%rbp)
cmpq   $0x7fff,-0x38(%rbp)
jbe    1474 <main+0x314>
mov    0x2b74(%rip),%rax
mov    (%rax),%edi
lea    0xc45(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1479 <main+0x319>
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x38(%rbp)
cmp    $0x0,%rax
je     14b0 <main+0x350>
mov    -0x18(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,%edi
mov    0x2b24(%rip),%rax
mov    (%rax),%esi
call   1040 <fputc@plt>
jmp    1479 <main+0x319>
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   %r12
push   %rbx
cmp    $0x1,%edi
jg     118e <main+0x2e>
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
lea    0xe83(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0xffffffff,%ebp
jmp    13f9 <main+0x299>
mov    %rsi,%rbp
mov    0x8(%rsi),%rdi
lea    0xe77(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     133f <main+0x1df>
mov    %rax,%rbx
mov    0x2e34(%rip),%rax
mov    (%rax),%edx
xor    %ebp,%ebp
mov    %rbx,%rdi
xor    %esi,%esi
call   1070 <fseek@plt>
mov    %rbx,%rdi
call   1060 <ftell@plt>
mov    %rax,%r14
mov    0x2dfc(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1070 <fseek@plt>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    $0xffffffff,%eax
je     1364 <main+0x204>
mov    %eax,%r15d
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    $0x1f,%r15d
jne    137d <main+0x21d>
cmp    $0x8b,%eax
jne    137d <main+0x21d>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    $0x8,%eax
jne    13a0 <main+0x240>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    %eax,%r15d
cmp    $0x20,%eax
jb     1249 <main+0xe9>
mov    0x2d9f(%rip),%rax
mov    (%rax),%edi
lea    0xe5c(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
test   $0x4,%r15b
je     12ad <main+0x14d>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    %eax,%ebp
shl    $0x8,%ebp
add    %r12d,%ebp
je     12ad <main+0x14d>
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1030 <fgetc@plt>
add    $0xffffffff,%ebp
jne    12a0 <main+0x140>
test   $0x8,%r15b
je     12cc <main+0x16c>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
call   1030 <fgetc@plt>
test   %eax,%eax
jg     12c0 <main+0x160>
test   $0x10,%r15b
je     12ec <main+0x18c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1030 <fgetc@plt>
test   %eax,%eax
jg     12e0 <main+0x180>
test   $0x2,%r15b
je     1302 <main+0x1a2>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    %rbx,%rdi
call   1060 <ftell@plt>
mov    %rax,%rbp
mov    %r14,%rax
sub    %rbp,%rax
add    $0xfffffffffffffff8,%rax
cmp    $0x8000,%rax
jb     13c0 <main+0x260>
mov    0x2cae(%rip),%rax
mov    (%rax),%edi
lea    0xd7f(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    13c5 <main+0x265>
mov    0x2c92(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbp),%rdx
lea    0xcc3(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x14,%ebp
jmp    13f9 <main+0x299>
mov    0x2c6d(%rip),%rax
mov    (%rax),%edi
lea    0xcc6(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    13f9 <main+0x299>
mov    0x2c54(%rip),%rcx
mov    (%rcx),%edi
lea    0xccb(%rip),%rsi
mov    %r15d,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x14,%ebp
jmp    13f9 <main+0x299>
mov    0x2c31(%rip),%rcx
mov    (%rcx),%edi
lea    0xcca(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x14,%ebp
jmp    13f9 <main+0x299>
test   %rax,%rax
je     13f7 <main+0x297>
sub    %r14,%rbp
add    $0x8,%rbp
mov    0x2bf5(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    (%r14),%esi
mov    %eax,%edi
call   1040 <fputc@plt>
inc    %rbp
jne    13e0 <main+0x280>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [19 x i8] c"specify filename!\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [36 x i8] c"Could not open file %s for reading\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.3 = [30 x i8] c"error reading data from file\0A\00"
@.str.4 = [34 x i8] c"Magic number mismatch 0x%02x%02x\0A\00"
@.str.5 = [36 x i8] c"Unknown compression method: 0x%02x\0A\00"
@.str.6 = [20 x i8] c"Unknown flags set!\0A\00"
@.str.7 = [44 x i8] c"Warning: Resulting file will be too large\0A\00"
@stdout = global i32 0
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 [4 x i32]
%10 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 2
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %176
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32* @fopen(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %20, i32** %6
%21 = load i32*, i32** %6
%22 = icmp ne i32* %21, null
br i1 %22, label %29, label %23
23: ; preds = %16
%24 = load i32, i32* @stderr
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* %27)
store i32 20, i32* %3
br label %176
29: ; preds = %16
%30 = load i32*, i32** %6
%31 = load i32, i32* @SEEK_END
%32 = call i32 @fseek(i32* %30, i32 0, i32 %31)
%33 = load i32*, i32** %6
%34 = call i64 @ftell(i32* %33)
store i64 %34, i64* %10
%35 = load i32*, i32** %6
%36 = load i32, i32* @SEEK_SET
%37 = call i32 @fseek(i32* %35, i32 0, i32 %36)
%38 = load i32*, i32** %6
%39 = call i32 @fgetc(i32* %38)
%40 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
store i32 %39, i32* %40
%41 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
%42 = load i32, i32* %41
%43 = icmp eq i32 %42, -1
br i1 %43, label %44, label %47
44: ; preds = %29
%45 = load i32, i32* @stderr
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %3
br label %176
47: ; preds = %29
%48 = load i32*, i32** %6
%49 = call i32 @fgetc(i32* %48)
%50 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 1
store i32 %49, i32* %50
%51 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
%52 = load i32, i32* %51
%53 = icmp ne i32 %52, 31
br i1 %53, label %58, label %54
54: ; preds = %47
%55 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 1
%56 = load i32, i32* %55
%57 = icmp ne i32 %56, 139
br i1 %57, label %58, label %65
58: ; preds = %54, %47
%59 = load i32, i32* @stderr
%60 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
%61 = load i32, i32* %60
%62 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 1
%63 = load i32, i32* %62
%64 = call i32 (i32, i8*, ...) @fprintf(i32 %59, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32 %61, i32 %63)
store i32 20, i32* %3
br label %176
65: ; preds = %54
%66 = load i32*, i32** %6
%67 = call i32 @fgetc(i32* %66)
%68 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
store i32 %67, i32* %68
%69 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
%70 = load i32, i32* %69
%71 = icmp ne i32 %70, 8
br i1 %71, label %72, label %77
72: ; preds = %65
%73 = load i32, i32* @stderr
%74 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
%75 = load i32, i32* %74
%76 = call i32 (i32, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32 %75)
store i32 20, i32* %3
br label %176
77: ; preds = %65
%78 = load i32*, i32** %6
%79 = call i32 @fgetc(i32* %78)
store i32 %79, i32* %8
%80 = load i32, i32* %8
%81 = and i32 %80, -32
%82 = icmp ne i32 %81, 0
br i1 %82, label %83, label %86
83: ; preds = %77
%84 = load i32, i32* @stderr
%85 = call i32 (i32, i8*, ...) @fprintf(i32 %84, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
br label %86
86: ; preds = %83, %77
%87 = load i32*, i32** %6
%88 = call i32 @fgetc(i32* %87)
%89 = load i32*, i32** %6
%90 = call i32 @fgetc(i32* %89)
%91 = load i32*, i32** %6
%92 = call i32 @fgetc(i32* %91)
%93 = load i32*, i32** %6
%94 = call i32 @fgetc(i32* %93)
%95 = load i32*, i32** %6
%96 = call i32 @fgetc(i32* %95)
%97 = load i32*, i32** %6
%98 = call i32 @fgetc(i32* %97)
%99 = load i32, i32* %8
%100 = and i32 %99, 4
%101 = icmp ne i32 %100, 0
br i1 %101, label %102, label %123
102: ; preds = %86
%103 = load i32*, i32** %6
%104 = call i32 @fgetc(i32* %103)
%105 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
store i32 %104, i32* %105
%106 = load i32*, i32** %6
%107 = call i32 @fgetc(i32* %106)
%108 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 1
store i32 %107, i32* %108
%109 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
%110 = load i32, i32* %109
%111 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 1
%112 = load i32, i32* %111
%113 = mul nsw i32 256, %112
%114 = add nsw i32 %110, %113
store i32 %114, i32* %7
br label %115
115: ; preds = %119, %102
%116 = load i32, i32* %7
%117 = add nsw i32 %116, -1
store i32 %117, i32* %7
%118 = icmp ne i32 %116, 0
br i1 %118, label %119, label %122
119: ; preds = %115
%120 = load i32*, i32** %6
%121 = call i32 @fgetc(i32* %120)
br label %115
122: ; preds = %115
br label %123
123: ; preds = %122, %86
%124 = load i32, i32* %8
%125 = and i32 %124, 8
%126 = icmp ne i32 %125, 0
br i1 %126, label %127, label %134
127: ; preds = %123
br label %128
128: ; preds = %132, %127
%129 = load i32*, i32** %6
%130 = call i32 @fgetc(i32* %129)
%131 = icmp sgt i32 %130, 0
br i1 %131, label %132, label %133
132: ; preds = %128
br label %128
133: ; preds = %128
br label %134
134: ; preds = %133, %123
%135 = load i32, i32* %8
%136 = and i32 %135, 16
%137 = icmp ne i32 %136, 0
br i1 %137, label %138, label %145
138: ; preds = %134
br label %139
139: ; preds = %143, %138
%140 = load i32*, i32** %6
%141 = call i32 @fgetc(i32* %140)
%142 = icmp sgt i32 %141, 0
br i1 %142, label %143, label %144
143: ; preds = %139
br label %139
144: ; preds = %139
br label %145
145: ; preds = %144, %134
%146 = load i32, i32* %8
%147 = and i32 %146, 2
%148 = icmp ne i32 %147, 0
br i1 %148, label %149, label %154
149: ; preds = %145
%150 = load i32*, i32** %6
%151 = call i32 @fgetc(i32* %150)
%152 = load i32*, i32** %6
%153 = call i32 @fgetc(i32* %152)
br label %154
154: ; preds = %149, %145
%155 = load i64, i64* %10
%156 = load i32*, i32** %6
%157 = call i64 @ftell(i32* %156)
%158 = sub i64 %155, %157
%159 = sub i64 %158, 8
store i64 %159, i64* %10
%160 = load i64, i64* %10
%161 = icmp ugt i64 %160, 32767
br i1 %161, label %162, label %165
162: ; preds = %154
%163 = load i32, i32* @stderr
%164 = call i32 (i32, i8*, ...) @fprintf(i32 %163, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.7, i64 0, i64 0))
br label %165
165: ; preds = %162, %154
br label %166
166: ; preds = %170, %165
%167 = load i64, i64* %10
%168 = add i64 %167, -1
store i64 %168, i64* %10
%169 = icmp ne i64 %167, 0
br i1 %169, label %170, label %175
170: ; preds = %166
%171 = load i32*, i32** %6
%172 = call i32 @fgetc(i32* %171)
%173 = load i32, i32* @stdout
%174 = call i32 @fputc(i32 %172, i32 %173)
br label %166
175: ; preds = %166
store i32 0, i32* %3
br label %176
176: ; preds = %175, %72, %58, %44, %23, %13
%177 = load i32, i32* %3
ret i32 %177
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"specify filename!\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [36 x i8] c"Could not open file %s for reading\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.3 = [30 x i8] c"error reading data from file\0A\00"
@.str.4 = [34 x i8] c"Magic number mismatch 0x%02x%02x\0A\00"
@.str.5 = [36 x i8] c"Unknown compression method: 0x%02x\0A\00"
@.str.6 = [20 x i8] c"Unknown flags set!\0A\00"
@.str.7 = [44 x i8] c"Warning: Resulting file will be too large\0A\00"
@stdout = global i32 0
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 i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %103
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 ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %16
12: ; preds = %7
%13 = load i32, i32* @stderr
%14 = load i8*, i8** %8
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8* %14)
br label %103
16: ; preds = %7
%17 = load i32, i32* @SEEK_END
%18 = tail call i32 @fseek(i32* %10, i32 0, i32 %17)
%19 = tail call i64 @ftell(i32* %10)
%20 = load i32, i32* @SEEK_SET
%21 = tail call i32 @fseek(i32* %10, i32 0, i32 %20)
%22 = tail call i32 @fgetc(i32* %10)
%23 = icmp eq i32 %22, -1
br i1 %23, label %24, label %27
24: ; preds = %16
%25 = load i32, i32* @stderr
%26 = tail call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
br label %103
27: ; preds = %16
%28 = tail call i32 @fgetc(i32* %10)
%29 = icmp ne i32 %22, 31
%30 = icmp ne i32 %28, 139
%31 = or i1 %29, %30
br i1 %31, label %32, label %35
32: ; preds = %27
%33 = load i32, i32* @stderr
%34 = tail call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32 %22, i32 %28)
br label %103
35: ; preds = %27
%36 = tail call i32 @fgetc(i32* %10)
%37 = icmp eq i32 %36, 8
br i1 %37, label %41, label %38
38: ; preds = %35
%39 = load i32, i32* @stderr
%40 = tail call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32 %36)
br label %103
41: ; preds = %35
%42 = tail call i32 @fgetc(i32* %10)
%43 = icmp ult i32 %42, 32
br i1 %43, label %47, label %44
44: ; preds = %41
%45 = load i32, i32* @stderr
%46 = tail call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
br label %47
47: ; preds = %44, %41
%48 = tail call i32 @fgetc(i32* %10)
%49 = tail call i32 @fgetc(i32* %10)
%50 = tail call i32 @fgetc(i32* %10)
%51 = tail call i32 @fgetc(i32* %10)
%52 = tail call i32 @fgetc(i32* %10)
%53 = tail call i32 @fgetc(i32* %10)
%54 = and i32 %42, 4
%55 = icmp eq i32 %54, 0
br i1 %55, label %67, label %56
56: ; preds = %47
%57 = tail call i32 @fgetc(i32* %10)
%58 = tail call i32 @fgetc(i32* %10)
%59 = shl nsw i32 %58, 8
%60 = add nsw i32 %59, %57
%61 = icmp eq i32 %60, 0
br i1 %61, label %67, label %62
62: ; preds = %56, %62
%63 = phi i32 [ %64, %62 ], [ %60, %56 ]
%64 = add nsw i32 %63, -1
%65 = tail call i32 @fgetc(i32* %10)
%66 = icmp eq i32 %64, 0
br i1 %66, label %67, label %62
67: ; preds = %62, %56, %47
%68 = and i32 %42, 8
%69 = icmp eq i32 %68, 0
br i1 %69, label %73, label %70
70: ; preds = %67, %70
%71 = tail call i32 @fgetc(i32* %10)
%72 = icmp sgt i32 %71, 0
br i1 %72, label %70, label %73
73: ; preds = %70, %67
%74 = and i32 %42, 16
%75 = icmp eq i32 %74, 0
br i1 %75, label %79, label %76
76: ; preds = %73, %76
%77 = tail call i32 @fgetc(i32* %10)
%78 = icmp sgt i32 %77, 0
br i1 %78, label %76, label %79
79: ; preds = %76, %73
%80 = and i32 %42, 2
%81 = icmp eq i32 %80, 0
br i1 %81, label %85, label %82
82: ; preds = %79
%83 = tail call i32 @fgetc(i32* %10)
%84 = tail call i32 @fgetc(i32* %10)
br label %85
85: ; preds = %82, %79
%86 = tail call i64 @ftell(i32* %10)
%87 = sub i64 %19, %86
%88 = add i64 %87, -8
%89 = icmp ugt i64 %88, 32767
br i1 %89, label %90, label %93
90: ; preds = %85
%91 = load i32, i32* @stderr
%92 = tail call i32 (i32, i8*, ...) @fprintf(i32 %91, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.7, i64 0, i64 0))
br label %95
93: ; preds = %85
%94 = icmp eq i64 %88, 0
br i1 %94, label %103, label %95
95: ; preds = %90, %93
br label %96
96: ; preds = %95, %96
%97 = phi i64 [ %98, %96 ], [ %88, %95 ]
%98 = add i64 %97, -1
%99 = tail call i32 @fgetc(i32* %10)
%100 = load i32, i32* @stdout
%101 = tail call i32 @fputc(i32 %99, i32 %100)
%102 = icmp eq i64 %98, 0
br i1 %102, label %103, label %96
103: ; preds = %96, %93, %38, %32, %24, %12, %4
%104 = phi i32 [ -1, %4 ], [ 0, %24 ], [ 20, %32 ], [ 20, %38 ], [ 20, %12 ], [ 0, %93 ], [ 0, %96 ]
ret i32 %104
}