#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 scalar_t__ clock_t;

/* Variables and functions */
double CLOCKS_PER_SEC;
scalar_t__ clock();
int /*<<< orphan*/ compress();
int /*<<< orphan*/ decompress();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ freopen(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  clock_t s, e;
  if (argc == 4) {
    freopen(argv[2], "rb", stdin);
    freopen(argv[3], "wb", stdout);
    s = clock();
    if (strcmp(argv[1], "e") == 0) {
      compress();
      e = clock();
      fprintf(stderr, "%fs\n", ((double)(e - s)) / CLOCKS_PER_SEC);
    } else if (strcmp(argv[1], "d") == 0) {
      decompress();
      e = clock();
      fprintf(stderr, "%fs\n", ((double)(e - s)) / CLOCKS_PER_SEC);
    } else {
      fprintf(stderr, "usage: e/d infile outfile\n");
    }
  } else {
    fprintf(stderr, "usage: e/d infile outfile\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
jne    12ae <main+0x14e>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    0x2e59(%rip),%rax
mov    (%rax),%edx
lea    0xe68(%rip),%rsi
call   1050 <freopen@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
mov    0x2e1c(%rip),%rax
mov    (%rax),%edx
lea    0xe4e(%rip),%rsi
call   1050 <freopen@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe32(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1229 <main+0xc9>
mov    $0x0,%al
call   1030 <compress@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x20(%rbp)
mov    0x2dd4(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rax
sub    -0x18(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2dce(%rip),%rax
divsd  (%rax),%xmm0
lea    0xdeb(%rip),%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
jmp    12a9 <main+0x149>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdd5(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    128d <main+0x12d>
mov    $0x0,%al
call   1080 <decompress@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x20(%rbp)
mov    0x2d70(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rax
sub    -0x18(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2d6a(%rip),%rax
divsd  (%rax),%xmm0
lea    0xd87(%rip),%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
jmp    12a4 <main+0x144>
mov    0x2d3c(%rip),%rax
mov    (%rax),%edi
lea    0xd72(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    12a9 <main+0x149>
jmp    12c5 <main+0x165>
mov    0x2d1b(%rip),%rax
mov    (%rax),%edi
lea    0xd51(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x4,%edi
jne    11d2 <main+0x72>
mov    %rsi,%rbx
mov    0x10(%rsi),%rdi
mov    0x2e71(%rip),%rax
mov    (%rax),%edx
lea    0xe80(%rip),%rsi
call   1050 <freopen@plt>
mov    0x18(%rbx),%rdi
mov    0x2e38(%rip),%rax
mov    (%rax),%edx
lea    0xe6a(%rip),%rsi
call   1050 <freopen@plt>
xor    %eax,%eax
call   1040 <clock@plt>
mov    %rax,%r14
mov    0x8(%rbx),%rdi
lea    0xe53(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11eb <main+0x8b>
mov    0x8(%rbx),%rdi
lea    0xe45(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11f4 <main+0x94>
mov    0x2df7(%rip),%rax
mov    (%rax),%edi
lea    0xe2d(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    122c <main+0xcc>
xor    %eax,%eax
call   1030 <compress@plt>
jmp    11fb <main+0x9b>
xor    %eax,%eax
call   1080 <decompress@plt>
xor    %eax,%eax
call   1040 <clock@plt>
mov    0x2dc7(%rip),%rcx
sub    %r14,%rax
cvtsi2sd %rax,%xmm0
mov    (%rcx),%edi
mov    0x2dc6(%rip),%rax
divsd  (%rax),%xmm0
lea    0xde3(%rip),%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"wb\00"
@stdout = global i32 0
@.str.2 = [2 x i8] c"e\00"
@stderr = global i32 0
@.str.3 = [5 x i8] c"%fs\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str.4 = [2 x i8] c"d\00"
@.str.5 = [27 x i8] c"usage: e/d infile outfile\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 4
br i1 %9, label %10, label %60
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 2
%13 = load i8*, i8** %12
%14 = load i32, i32* @stdin
%15 = call i32 @freopen(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 3
%18 = load i8*, i8** %17
%19 = load i32, i32* @stdout
%20 = call i32 @freopen(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %19)
%21 = call i64 (...) @clock()
store i64 %21, i64* %6
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %38
27: ; preds = %10
%28 = call i32 (...) @compress()
%29 = call i64 (...) @clock()
store i64 %29, i64* %7
%30 = load i32, i32* @stderr
%31 = load i64, i64* %7
%32 = load i64, i64* %6
%33 = sub nsw i64 %31, %32
%34 = sitofp i64 %33 to double
%35 = load double, double* @CLOCKS_PER_SEC
%36 = fdiv double %34, %35
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), double %36)
br label %59
38: ; preds = %10
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 1
%41 = load i8*, i8** %40
%42 = call i64 @strcmp(i8* %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %55
44: ; preds = %38
%45 = call i32 (...) @decompress()
%46 = call i64 (...) @clock()
store i64 %46, i64* %7
%47 = load i32, i32* @stderr
%48 = load i64, i64* %7
%49 = load i64, i64* %6
%50 = sub nsw i64 %48, %49
%51 = sitofp i64 %50 to double
%52 = load double, double* @CLOCKS_PER_SEC
%53 = fdiv double %51, %52
%54 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), double %53)
br label %58
55: ; preds = %38
%56 = load i32, i32* @stderr
%57 = call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
br label %58
58: ; preds = %55, %44
br label %59
59: ; preds = %58, %27
br label %63
60: ; preds = %2
%61 = load i32, i32* @stderr
%62 = call i32 (i32, i8*, ...) @fprintf(i32 %61, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
br label %63
63: ; preds = %60, %59
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"wb\00"
@stdout = global i32 0
@.str.2 = [2 x i8] c"e\00"
@stderr = global i32 0
@.str.3 = [5 x i8] c"%fs\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str.4 = [2 x i8] c"d\00"
@.str.5 = [27 x i8] c"usage: e/d infile outfile\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %4, label %43
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 2
%6 = load i8*, i8** %5
%7 = load i32, i32* @stdin
%8 = tail call i32 @freopen(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds i8*, i8** %1, i64 3
%10 = load i8*, i8** %9
%11 = load i32, i32* @stdout
%12 = tail call i32 @freopen(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = tail call i64 (...) @clock()
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = tail call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %27
18: ; preds = %4
%19 = tail call i32 (...) @compress()
%20 = tail call i64 (...) @clock()
%21 = load i32, i32* @stderr
%22 = sub nsw i64 %20, %13
%23 = sitofp i64 %22 to double
%24 = load double, double* @CLOCKS_PER_SEC
%25 = fdiv double %23, %24
%26 = tail call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), double %25)
br label %46
27: ; preds = %4
%28 = load i8*, i8** %14
%29 = tail call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %40
31: ; preds = %27
%32 = tail call i32 (...) @decompress()
%33 = tail call i64 (...) @clock()
%34 = load i32, i32* @stderr
%35 = sub nsw i64 %33, %13
%36 = sitofp i64 %35 to double
%37 = load double, double* @CLOCKS_PER_SEC
%38 = fdiv double %36, %37
%39 = tail call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), double %38)
br label %46
40: ; preds = %27
%41 = load i32, i32* @stderr
%42 = tail call i32 (i32, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
br label %46
43: ; preds = %2
%44 = load i32, i32* @stderr
%45 = tail call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
br label %46
46: ; preds = %18, %40, %31, %43
ret i32 0
}