#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 def(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
long ftell(int /*<<< orphan*/ *);
double get_time_usec();
int getpid();
int /*<<< orphan*/ inf(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int strtol(char const *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ unlink(char *);
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  FILE *f;
  char tempfile[256];
  int repeat_count = 10;
  int compression_level = 9;
  double usec0, usec1;
  if (argc < 2)
    usage();
  for (; argc > 1 && argv[1][0] == '-'; argc--, argv++) {
    const char *arg = &argv[1][1];
    switch (arg[0]) {
    case 'r':
      if (arg[1] == 0) {
        if (argc < 3)
          usage();
        arg = argv[2];
        argc--;
        argv++;
      } else
        arg += 1;
      repeat_count = strtol(arg, NULL, 10);
      if (repeat_count <= 0)
        repeat_count = 1;
      break;
    case '0':
    case '1':
    case '2':
    case '3':
    case '4':
    case '5':
    case '6':
    case '7':
    case '8':
    case '9':
      compression_level = arg[0] - '0';
      break;
    default:
      usage();
    }
  }
  sprintf(tempfile, "/tmp/ztest.%d", getpid());
  for (; argc > 1; argc--, argv++) {
    FILE *f = fopen(argv[1], "rb");
    FILE *out = NULL;
    long fsize;
    int ret, rr;
    if (f == NULL) {
      fprintf(stderr, "could not open '%s': %s\n", argv[1], strerror(errno));
      continue;
    }
    printf("testing %s\n", argv[1]);
    fseek(f, 0, SEEK_END);
    fsize = ftell(f);
    fseek(f, 0, SEEK_SET);
    out = fopen(tempfile, "wb");
    if (out == NULL) {
      fprintf(stderr, "could not create '%s': %s\n", tempfile, strerror(errno));
      fclose(f);
      continue;
    }
    usec0 = get_time_usec();
    ret = def(f, out, compression_level);
    usec1 = get_time_usec() - usec0;
    printf("compression took:   %10.3f ms  (%.2f KB/s)\n", usec1 / 1e3,
           fsize * (1e6 / 1024) / usec1);
    fclose(out);
    fclose(f);
    usec0 = get_time_usec();
    f = fopen(tempfile, "rb");
    for (rr = repeat_count; rr > 0; rr--) {
      fseek(f, 0, SEEK_SET);
      inf(f);
    }
    fclose(f);
    usec1 = get_time_usec() - usec0;
    printf("decompression took: %10.3f ms (%.2f KB/s, %d passes)\n",
           usec1 / 1e3, fsize * (1e6 / 1024) * repeat_count / usec1,
           repeat_count);
  }
  unlink(tempfile);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x190,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xa,-0x124(%rbp)
movl   $0x9,-0x128(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    122e <main+0x3e>
mov    $0x0,%al
call   10d0 <usage@plt>
jmp    1233 <main+0x43>
xor    %eax,%eax
cmpl   $0x1,-0x8(%rbp)
mov    %al,-0x161(%rbp)
jle    125c <main+0x6c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
sete   %al
mov    %al,-0x161(%rbp)
mov    -0x161(%rbp),%al
test   $0x1,%al
jne    126f <main+0x7f>
jmp    138c <main+0x19c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
add    $0x1,%rax
mov    %rax,-0x140(%rbp)
mov    -0x140(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x168(%rbp)
add    $0xffffffd0,%eax
sub    $0xa,%eax
jb     134e <main+0x15e>
jmp    12a3 <main+0xb3>
mov    -0x168(%rbp),%eax
sub    $0x72,%eax
jne    1366 <main+0x176>
jmp    12b7 <main+0xc7>
mov    -0x140(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
jne    1305 <main+0x115>
cmpl   $0x3,-0x8(%rbp)
jge    12dc <main+0xec>
mov    $0x0,%al
call   10d0 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x140(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1317 <main+0x127>
mov    -0x140(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x140(%rbp)
mov    -0x140(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1090 <strtol@plt>
mov    %eax,-0x124(%rbp)
cmpl   $0x0,-0x124(%rbp)
jg     1349 <main+0x159>
movl   $0x1,-0x124(%rbp)
jmp    136d <main+0x17d>
mov    -0x140(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
mov    %eax,-0x128(%rbp)
jmp    136d <main+0x17d>
mov    $0x0,%al
call   10d0 <usage@plt>
jmp    1372 <main+0x182>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1233 <main+0x43>
lea    -0x120(%rbp),%rax
mov    %rax,-0x170(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    -0x170(%rbp),%rdi
mov    %eax,%edx
lea    0xc5f(%rip),%rsi
call   1100 <sprintf@plt>
cmpl   $0x1,-0x8(%rbp)
jle    16bb <main+0x4cb>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xc4f(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x148(%rbp)
movq   $0x0,-0x150(%rbp)
cmpq   $0x0,-0x148(%rbp)
jne    1441 <main+0x251>
mov    0x2bdd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x17c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x178(%rbp)
mov    0x2bb7(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    -0x17c(%rbp),%edi
mov    -0x178(%rbp),%rdx
mov    %rax,%rcx
lea    0xbea(%rip),%rsi
call   1070 <fprintf@plt>
jmp    16a1 <main+0x4b1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xbea(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x148(%rbp),%rdi
mov    0x2b83(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10c0 <fseek@plt>
mov    -0x148(%rbp),%rdi
call   1080 <ftell@plt>
mov    %rax,-0x158(%rbp)
mov    -0x148(%rbp),%rdi
mov    0x2b39(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10c0 <fseek@plt>
lea    -0x120(%rbp),%rdi
lea    0xba0(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x150(%rbp)
cmpq   $0x0,-0x150(%rbp)
jne    1518 <main+0x328>
mov    0x2b11(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18c(%rbp)
lea    -0x120(%rbp),%rax
mov    %rax,-0x188(%rbp)
mov    0x2aec(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    -0x18c(%rbp),%edi
mov    -0x188(%rbp),%rdx
mov    %rax,%rcx
lea    0xb47(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0x148(%rbp),%rdi
call   1050 <fclose@plt>
jmp    16a1 <main+0x4b1>
mov    $0x0,%al
call   10b0 <get_time_usec@plt>
movsd  %xmm0,-0x130(%rbp)
ff
mov    -0x148(%rbp),%rdi
mov    -0x150(%rbp),%rsi
mov    -0x128(%rbp),%edx
call   10e0 <def@plt>
mov    %eax,-0x15c(%rbp)
mov    $0x0,%al
call   10b0 <get_time_usec@plt>
subsd  -0x130(%rbp),%xmm0
ff
movsd  %xmm0,-0x138(%rbp)
ff
movsd  -0x138(%rbp),%xmm0
ff
movsd  0xa9b(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsi2sdq -0x158(%rbp),%xmm1
ff ff
movsd  0xa7e(%rip),%xmm2
mulsd  %xmm2,%xmm1
divsd  -0x138(%rbp),%xmm1
ff
lea    0xacf(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
mov    -0x150(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x148(%rbp),%rdi
call   1050 <fclose@plt>
mov    $0x0,%al
call   10b0 <get_time_usec@plt>
movsd  %xmm0,-0x130(%rbp)
ff
lea    -0x120(%rbp),%rdi
lea    0xa4d(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x148(%rbp)
mov    -0x124(%rbp),%eax
mov    %eax,-0x160(%rbp)
cmpl   $0x0,-0x160(%rbp)
jle    162d <main+0x43d>
mov    -0x148(%rbp),%rdi
mov    0x29c4(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10c0 <fseek@plt>
mov    -0x148(%rbp),%rdi
call   10a0 <inf@plt>
mov    -0x160(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x160(%rbp)
jmp    15e9 <main+0x3f9>
mov    -0x148(%rbp),%rdi
call   1050 <fclose@plt>
mov    $0x0,%al
call   10b0 <get_time_usec@plt>
subsd  -0x130(%rbp),%xmm0
ff
movsd  %xmm0,-0x138(%rbp)
ff
movsd  -0x138(%rbp),%xmm0
ff
movsd  0x9a8(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsi2sdq -0x158(%rbp),%xmm1
ff ff
movsd  0x98b(%rip),%xmm2
mulsd  %xmm2,%xmm1
cvtsi2sdl -0x124(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm1
divsd  -0x138(%rbp),%xmm1
ff
mov    -0x124(%rbp),%esi
lea    0x9f6(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    13b6 <main+0x1c6>
lea    -0x120(%rbp),%rdi
call   1030 <unlink@plt>
xor    %eax,%eax
add    $0x190,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x138,%rsp
mov    %rsi,%r15
mov    %edi,%ebp
cmp    $0x2,%edi
jge    149f <main+0x2af>
xor    %eax,%eax
call   10d0 <usage@plt>
mov    $0x9,%ebx
mov    $0xa,%eax
mov    %rax,0x8(%rsp)
mov    %ebp,%r12d
mov    %ebx,0x24(%rsp)
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xdd6(%rip),%rsi
lea    0x30(%rsp),%rdi
mov    %eax,%edx
call   1100 <sprintf@plt>
cmp    $0x2,%r12d
jl     1481 <main+0x291>
mov    0x8(%rsp),%rax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x28(%rsp)
add    $0x1,%eax
mov    %eax,0x20(%rsp)
lea    0xdb1(%rip),%r13
mov    0x2d54(%rip),%r14
jmp    12c0 <main+0xd0>
cs nopw 0x0(%rax,%rax,1)
mov    0x2d51(%rip),%rax
mov    (%rax),%ebp
mov    (%r15),%rbx
mov    0x2d3d(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    %ebp,%edi
lea    0xd7e(%rip),%rsi
mov    %rbx,%rdx
mov    %rax,%rcx
call   1070 <fprintf@plt>
lea    -0x1(%r12),%eax
cmp    $0x2,%r12d
mov    %eax,%r12d
jle    1481 <main+0x291>
mov    0x8(%r15),%rdi
add    $0x8,%r15
mov    %r13,%rsi
call   10f0 <fopen@plt>
test   %rax,%rax
je     1280 <main+0x90>
mov    %rax,%rbp
mov    (%r15),%rsi
lea    0xd58(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2cf8(%rip),%rax
mov    (%rax),%edx
mov    %rbp,%rdi
xor    %esi,%esi
call   10c0 <fseek@plt>
mov    %rbp,%rdi
call   1080 <ftell@plt>
mov    %rax,0x18(%rsp)
mov    (%r14),%edx
mov    %rbp,%rdi
xor    %esi,%esi
call   10c0 <fseek@plt>
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
lea    0xd21(%rip),%rsi
call   10f0 <fopen@plt>
test   %rax,%rax
je     1440 <main+0x250>
mov    %rax,%r13
xor    %eax,%eax
call   10b0 <get_time_usec@plt>
movsd  %xmm0,0x10(%rsp)
mov    %rbp,%rdi
mov    %r13,%rsi
mov    0x24(%rsp),%edx
call   10e0 <def@plt>
xor    %eax,%eax
call   10b0 <get_time_usec@plt>
xorps  %xmm1,%xmm1
cvtsi2sdq 0x18(%rsp),%xmm1
subsd  0x10(%rsp),%xmm0
mulsd  0xc97(%rip),%xmm1
movsd  %xmm1,0x18(%rsp)
divsd  %xmm0,%xmm1
divsd  0xc7d(%rip),%xmm0
lea    0xcda(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
mov    %r13,%rdi
call   1050 <fclose@plt>
mov    %rbp,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
call   10b0 <get_time_usec@plt>
movsd  %xmm0,0x10(%rsp)
mov    %rbx,%rdi
lea    0xc66(%rip),%r13
mov    %r13,%rsi
call   10f0 <fopen@plt>
mov    %rax,%rbp
cmpl   $0x0,0x8(%rsp)
jle    13ed <main+0x1fd>
mov    0x20(%rsp),%ebx
xchg   %ax,%ax
mov    (%r14),%edx
mov    %rbp,%rdi
xor    %esi,%esi
call   10c0 <fseek@plt>
mov    %rbp,%rdi
call   10a0 <inf@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     13d0 <main+0x1e0>
mov    %rbp,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
call   10b0 <get_time_usec@plt>
subsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
mulsd  0x28(%rsp),%xmm1
divsd  %xmm0,%xmm1
divsd  0xbe6(%rip),%xmm0
lea    0xc6f(%rip),%rdi
mov    0x8(%rsp),%rsi
mov    $0x2,%al
call   1060 <printf@plt>
jmp    12ae <main+0xbe>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x2b91(%rip),%rax
mov    (%rax),%r13d
mov    0x2b7f(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    %r13d,%edi
lea    0xbe7(%rip),%rsi
mov    %rbx,%rdx
mov    %rax,%rcx
call   1070 <fprintf@plt>
mov    %rbp,%rdi
call   1050 <fclose@plt>
lea    0xba2(%rip),%r13
jmp    12ae <main+0xbe>
lea    0x30(%rsp),%rdi
call   1030 <unlink@plt>
xor    %eax,%eax
add    $0x138,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xa,%eax
mov    %rax,0x8(%rsp)
mov    $0x9,%ebx
mov    $0x1,%r14d
jmp    14d6 <main+0x2e6>
cs nopw 0x0(%rax,%rax,1)
mov    %eax,%ebx
lea    -0x1(%rbp),%r12d
add    $0x8,%r15
cmp    $0x2,%ebp
mov    %r12d,%ebp
jle    1228 <main+0x38>
mov    0x8(%r15),%rdi
cmpb   $0x2d,(%rdi)
jne    1225 <main+0x35>
movsbl 0x1(%rdi),%ecx
lea    -0x30(%rcx),%eax
cmp    $0xa,%eax
jb     14c0 <main+0x2d0>
cmp    $0x72,%ecx
jne    1500 <main+0x310>
cmpb   $0x0,0x2(%rdi)
je     1509 <main+0x319>
add    $0x2,%rdi
jmp    1520 <main+0x330>
xor    %eax,%eax
call   10d0 <usage@plt>
jmp    14c2 <main+0x2d2>
cmp    $0x2,%ebp
ja     1515 <main+0x325>
xor    %eax,%eax
call   10d0 <usage@plt>
mov    0x10(%r15),%rdi
add    $0x8,%r15
add    $0xffffffff,%ebp
xor    %esi,%esi
mov    $0xa,%edx
call   1090 <strtol@plt>
test   %eax,%eax
cmovle %r14d,%eax
mov    %rax,0x8(%rsp)
jmp    14c2 <main+0x2d2>

LLVM IR (-O0):
@.str = [14 x i8] c"/tmp/ztest.%d\00"
@.str.1 = [3 x i8] c"rb\00"
@stderr = global i32 0
@.str.2 = [25 x i8] c"could not open '%s': %s\0A\00"
@errno = global i32 0
@.str.3 = [12 x i8] c"testing %s\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.4 = [3 x i8] c"wb\00"
@.str.5 = [27 x i8] c"could not create '%s': %s\0A\00"
@.str.6 = [44 x i8] c"compression took: %10.3f ms (%.2f KB/s)\0A\00"
@.str.7 = [54 x i8] c"decompression took: %10.3f ms (%.2f KB/s, %d passes)\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [256 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca double
%11 = alloca double
%12 = alloca i8*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i64
%16 = alloca i32
%17 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 10, i32* %8
store i32 9, i32* %9
%18 = load i32, i32* %4
%19 = icmp slt i32 %18, 2
br i1 %19, label %20, label %22
20: ; preds = %2
%21 = call i32 (...) @usage()
br label %22
22: ; preds = %20, %2
br label %23
23: ; preds = %83, %22
%24 = load i32, i32* %4
%25 = icmp sgt i32 %24, 1
br i1 %25, label %26, label %34
26: ; preds = %23
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = getelementptr inbounds i8, i8* %29, i64 0
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 45
br label %34
34: ; preds = %26, %23
%35 = phi i1 [ false, %23 ], [ %33, %26 ]
br i1 %35, label %36, label %88
36: ; preds = %34
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 1
%39 = load i8*, i8** %38
%40 = getelementptr inbounds i8, i8* %39, i64 1
store i8* %40, i8** %12
%41 = load i8*, i8** %12
%42 = getelementptr inbounds i8, i8* %41, i64 0
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
switch i32 %44, label %80 [
i32 114, label %45
i32 48, label %74
i32 49, label %74
i32 50, label %74
i32 51, label %74
i32 52, label %74
i32 53, label %74
i32 54, label %74
i32 55, label %74
i32 56, label %74
i32 57, label %74
]
45: ; preds = %36
%46 = load i8*, i8** %12
%47 = getelementptr inbounds i8, i8* %46, i64 1
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %64
51: ; preds = %45
%52 = load i32, i32* %4
%53 = icmp slt i32 %52, 3
br i1 %53, label %54, label %56
54: ; preds = %51
%55 = call i32 (...) @usage()
br label %56
56: ; preds = %54, %51
%57 = load i8**, i8*** %5
%58 = getelementptr inbounds i8*, i8** %57, i64 2
%59 = load i8*, i8** %58
store i8* %59, i8** %12
%60 = load i32, i32* %4
%61 = add nsw i32 %60, -1
store i32 %61, i32* %4
%62 = load i8**, i8*** %5
%63 = getelementptr inbounds i8*, i8** %62, i32 1
store i8** %63, i8*** %5
br label %67
64: ; preds = %45
%65 = load i8*, i8** %12
%66 = getelementptr inbounds i8, i8* %65, i64 1
store i8* %66, i8** %12
br label %67
67: ; preds = %64, %56
%68 = load i8*, i8** %12
%69 = call i32 @strtol(i8* %68, i32* null, i32 10)
store i32 %69, i32* %8
%70 = load i32, i32* %8
%71 = icmp sle i32 %70, 0
br i1 %71, label %72, label %73
72: ; preds = %67
store i32 1, i32* %8
br label %73
73: ; preds = %72, %67
br label %82
74: ; preds = %36, %36, %36, %36, %36, %36, %36, %36, %36, %36
%75 = load i8*, i8** %12
%76 = getelementptr inbounds i8, i8* %75, i64 0
%77 = load i8, i8* %76
%78 = sext i8 %77 to i32
%79 = sub nsw i32 %78, 48
store i32 %79, i32* %9
br label %82
80: ; preds = %36
%81 = call i32 (...) @usage()
br label %82
82: ; preds = %80, %74, %73
br label %83
83: ; preds = %82
%84 = load i32, i32* %4
%85 = add nsw i32 %84, -1
store i32 %85, i32* %4
%86 = load i8**, i8*** %5
%87 = getelementptr inbounds i8*, i8** %86, i32 1
store i8** %87, i8*** %5
br label %23
88: ; preds = %34
%89 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%90 = call i32 (...) @getpid()
%91 = call i32 @sprintf(i8* %89, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %90)
br label %92
92: ; preds = %190, %88
%93 = load i32, i32* %4
%94 = icmp sgt i32 %93, 1
br i1 %94, label %95, label %195
95: ; preds = %92
%96 = load i8**, i8*** %5
%97 = getelementptr inbounds i8*, i8** %96, i64 1
%98 = load i8*, i8** %97
%99 = call i32* @fopen(i8* %98, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %99, i32** %13
store i32* null, i32** %14
%100 = load i32*, i32** %13
%101 = icmp eq i32* %100, null
br i1 %101, label %102, label %110
102: ; preds = %95
%103 = load i32, i32* @stderr
%104 = load i8**, i8*** %5
%105 = getelementptr inbounds i8*, i8** %104, i64 1
%106 = load i8*, i8** %105
%107 = load i32, i32* @errno
%108 = call i8* @strerror(i32 %107)
%109 = call i32 @fprintf(i32 %103, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %106, i8* %108)
br label %190
110: ; preds = %95
%111 = load i8**, i8*** %5
%112 = getelementptr inbounds i8*, i8** %111, i64 1
%113 = load i8*, i8** %112
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %113)
%115 = load i32*, i32** %13
%116 = load i32, i32* @SEEK_END
%117 = call i32 @fseek(i32* %115, i32 0, i32 %116)
%118 = load i32*, i32** %13
%119 = call i64 @ftell(i32* %118)
store i64 %119, i64* %15
%120 = load i32*, i32** %13
%121 = load i32, i32* @SEEK_SET
%122 = call i32 @fseek(i32* %120, i32 0, i32 %121)
%123 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%124 = call i32* @fopen(i8* %123, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %124, i32** %14
%125 = load i32*, i32** %14
%126 = icmp eq i32* %125, null
br i1 %126, label %127, label %135
127: ; preds = %110
%128 = load i32, i32* @stderr
%129 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%130 = load i32, i32* @errno
%131 = call i8* @strerror(i32 %130)
%132 = call i32 @fprintf(i32 %128, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i8* %129, i8* %131)
%133 = load i32*, i32** %13
%134 = call i32 @fclose(i32* %133)
br label %190
135: ; preds = %110
%136 = call double (...) @get_time_usec()
store double %136, double* %10
%137 = load i32*, i32** %13
%138 = load i32*, i32** %14
%139 = load i32, i32* %9
%140 = call i32 @def(i32* %137, i32* %138, i32 %139)
store i32 %140, i32* %16
%141 = call double (...) @get_time_usec()
%142 = load double, double* %10
%143 = fsub double %141, %142
store double %143, double* %11
%144 = load double, double* %11
%145 = fdiv double %144, 1.000000e+03
%146 = load i64, i64* %15
%147 = sitofp i64 %146 to double
%148 = fmul double %147, 0x408E848000000000
%149 = load double, double* %11
%150 = fdiv double %148, %149
%151 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), double %145, double %150)
%152 = load i32*, i32** %14
%153 = call i32 @fclose(i32* %152)
%154 = load i32*, i32** %13
%155 = call i32 @fclose(i32* %154)
%156 = call double (...) @get_time_usec()
store double %156, double* %10
%157 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%158 = call i32* @fopen(i8* %157, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %158, i32** %13
%159 = load i32, i32* %8
store i32 %159, i32* %17
br label %160
160: ; preds = %169, %135
%161 = load i32, i32* %17
%162 = icmp sgt i32 %161, 0
br i1 %162, label %163, label %172
163: ; preds = %160
%164 = load i32*, i32** %13
%165 = load i32, i32* @SEEK_SET
%166 = call i32 @fseek(i32* %164, i32 0, i32 %165)
%167 = load i32*, i32** %13
%168 = call i32 @inf(i32* %167)
br label %169
169: ; preds = %163
%170 = load i32, i32* %17
%171 = add nsw i32 %170, -1
store i32 %171, i32* %17
br label %160
172: ; preds = %160
%173 = load i32*, i32** %13
%174 = call i32 @fclose(i32* %173)
%175 = call double (...) @get_time_usec()
%176 = load double, double* %10
%177 = fsub double %175, %176
store double %177, double* %11
%178 = load double, double* %11
%179 = fdiv double %178, 1.000000e+03
%180 = load i64, i64* %15
%181 = sitofp i64 %180 to double
%182 = fmul double %181, 0x408E848000000000
%183 = load i32, i32* %8
%184 = sitofp i32 %183 to double
%185 = fmul double %182, %184
%186 = load double, double* %11
%187 = fdiv double %185, %186
%188 = load i32, i32* %8
%189 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.7, i64 0, i64 0), double %179, double %187, i32 %188)
br label %190
190: ; preds = %172, %127, %102
%191 = load i32, i32* %4
%192 = add nsw i32 %191, -1
store i32 %192, i32* %4
%193 = load i8**, i8*** %5
%194 = getelementptr inbounds i8*, i8** %193, i32 1
store i8** %194, i8*** %5
br label %92
195: ; preds = %92
%196 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%197 = call i32 @unlink(i8* %196)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"/tmp/ztest.%d\00"
@.str.1 = [3 x i8] c"rb\00"
@stderr = global i32 0
@.str.2 = [25 x i8] c"could not open '%s': %s\0A\00"
@errno = global i32 0
@.str.3 = [12 x i8] c"testing %s\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.4 = [3 x i8] c"wb\00"
@.str.5 = [27 x i8] c"could not create '%s': %s\0A\00"
@.str.6 = [44 x i8] c"compression took: %10.3f ms (%.2f KB/s)\0A\00"
@.str.7 = [54 x i8] c"decompression took: %10.3f ms (%.2f KB/s, %d passes)\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 (...) @usage()
br label %52
8: ; preds = %2, %44
%9 = phi i32 [ %49, %44 ], [ %0, %2 ]
%10 = phi i32 [ %47, %44 ], [ 9, %2 ]
%11 = phi i32 [ %46, %44 ], [ 10, %2 ]
%12 = phi i8** [ %50, %44 ], [ %1, %2 ]
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 45
br i1 %16, label %17, label %52
17: ; preds = %8
%18 = getelementptr inbounds i8, i8* %14, i64 1
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
switch i32 %20, label %42 [
i32 114, label %21
i32 48, label %40
i32 49, label %40
i32 50, label %40
i32 51, label %40
i32 52, label %40
i32 53, label %40
i32 54, label %40
i32 55, label %40
i32 56, label %40
i32 57, label %40
]
21: ; preds = %17
%22 = getelementptr inbounds i8, i8* %14, i64 2
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 0
br i1 %24, label %25, label %33
25: ; preds = %21
%26 = icmp ult i32 %9, 3
br i1 %26, label %27, label %29
27: ; preds = %25
%28 = tail call i32 (...) @usage()
br label %29
29: ; preds = %27, %25
%30 = getelementptr inbounds i8*, i8** %12, i64 2
%31 = load i8*, i8** %30
%32 = add nsw i32 %9, -1
br label %33
33: ; preds = %21, %29
%34 = phi i8** [ %13, %29 ], [ %12, %21 ]
%35 = phi i8* [ %31, %29 ], [ %22, %21 ]
%36 = phi i32 [ %32, %29 ], [ %9, %21 ]
%37 = tail call i32 @strtol(i8* nocapture %35, i32* null, i32 10)
%38 = icmp sgt i32 %37, 1
%39 = select i1 %38, i32 %37, i32 1
br label %44
40: ; preds = %17, %17, %17, %17, %17, %17, %17, %17, %17, %17
%41 = add nsw i32 %20, -48
br label %44
42: ; preds = %17
%43 = tail call i32 (...) @usage()
br label %44
44: ; preds = %42, %40, %33
%45 = phi i8** [ %12, %42 ], [ %12, %40 ], [ %34, %33 ]
%46 = phi i32 [ %11, %42 ], [ %11, %40 ], [ %39, %33 ]
%47 = phi i32 [ %10, %42 ], [ %41, %40 ], [ %10, %33 ]
%48 = phi i32 [ %9, %42 ], [ %9, %40 ], [ %36, %33 ]
%49 = add nsw i32 %48, -1
%50 = getelementptr inbounds i8*, i8** %45, i64 1
%51 = icmp sgt i32 %48, 2
br i1 %51, label %8, label %52
52: ; preds = %8, %44, %6
%53 = phi i8** [ %1, %6 ], [ %50, %44 ], [ %12, %8 ]
%54 = phi i32 [ 10, %6 ], [ %46, %44 ], [ %11, %8 ]
%55 = phi i32 [ 9, %6 ], [ %47, %44 ], [ %10, %8 ]
%56 = phi i32 [ %0, %6 ], [ %49, %44 ], [ %9, %8 ]
%57 = tail call i32 (...) @getpid()
%58 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %57)
%59 = icmp sgt i32 %56, 1
br i1 %59, label %60, label %124
60: ; preds = %52
%61 = icmp sgt i32 %54, 0
%62 = sitofp i32 %54 to double
br label %63
63: ; preds = %60, %121
%64 = phi i32 [ %56, %60 ], [ %122, %121 ]
%65 = phi i8** [ %53, %60 ], [ %66, %121 ]
%66 = getelementptr inbounds i8*, i8** %65, i64 1
%67 = load i8*, i8** %66
%68 = call i32* @fopen(i8* %67, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%69 = icmp eq i32* %68, null
br i1 %69, label %70, label %76
70: ; preds = %63
%71 = load i32, i32* @stderr
%72 = load i8*, i8** %66
%73 = load i32, i32* @errno
%74 = call i8* @strerror(i32 %73)
%75 = call i32 @fprintf(i32 %71, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %72, i8* %74)
br label %121
76: ; preds = %63
%77 = load i8*, i8** %66
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %77)
%79 = load i32, i32* @SEEK_END
%80 = call i32 @fseek(i32* %68, i32 0, i32 %79)
%81 = call i64 @ftell(i32* %68)
%82 = load i32, i32* @SEEK_SET
%83 = call i32 @fseek(i32* %68, i32 0, i32 %82)
%84 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%85 = icmp eq i32* %84, null
br i1 %85, label %86, label %92
86: ; preds = %76
%87 = load i32, i32* @stderr
%88 = load i32, i32* @errno
%89 = call i8* @strerror(i32 %88)
%90 = call i32 @fprintf(i32 %87, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i8* %4, i8* %89)
%91 = call i32 @fclose(i32* %68)
br label %121
92: ; preds = %76
%93 = call double (...) @get_time_usec()
%94 = call i32 @def(i32* %68, i32* %84, i32 %55)
%95 = call double (...) @get_time_usec()
%96 = fsub double %95, %93
%97 = fdiv double %96, 1.000000e+03
%98 = sitofp i64 %81 to double
%99 = fmul double %98, 0x408E848000000000
%100 = fdiv double %99, %96
%101 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), double %97, double %100)
%102 = call i32 @fclose(i32* %84)
%103 = call i32 @fclose(i32* %68)
%104 = call double (...) @get_time_usec()
%105 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br i1 %61, label %106, label %113
106: ; preds = %92, %106
%107 = phi i32 [ %111, %106 ], [ %54, %92 ]
%108 = load i32, i32* @SEEK_SET
%109 = call i32 @fseek(i32* %105, i32 0, i32 %108)
%110 = call i32 @inf(i32* %105)
%111 = add nsw i32 %107, -1
%112 = icmp ugt i32 %107, 1
br i1 %112, label %106, label %113
113: ; preds = %106, %92
%114 = call i32 @fclose(i32* %105)
%115 = call double (...) @get_time_usec()
%116 = fsub double %115, %104
%117 = fdiv double %116, 1.000000e+03
%118 = fmul double %99, %62
%119 = fdiv double %118, %116
%120 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.7, i64 0, i64 0), double %117, double %119, i32 %54)
br label %121
121: ; preds = %113, %86, %70
%122 = add nsw i32 %64, -1
%123 = icmp sgt i32 %64, 2
br i1 %123, label %63, label %124
124: ; preds = %121, %52
%125 = call i32 @unlink(i8* %4)
ret i32 0
}