#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(char *, char *);
int /*<<< orphan*/ decompress(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  clock_t s, e;
  if (argc == 4) {
    s = clock();
    if (strcmp(argv[1], "e") == 0) {
      compress(argv[2], argv[3]);
      e = clock();
      printf("%fs\n", ((double)(e - s)) / CLOCKS_PER_SEC);
    } else if (strcmp(argv[1], "d") == 0) {
      decompress(argv[2], argv[3]);
      e = clock();
      printf("%fs\n", ((double)(e - s)) / CLOCKS_PER_SEC);
    } else {
      printf("usage: e/d infile outfile\n");
    }
  } else {
    printf("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    1265 <main+0x115>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe76(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11e4 <main+0x94>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1030 <compress@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
sub    -0x18(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2e1b(%rip),%rax
divsd  (%rax),%xmm0
lea    0xe2a(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    1260 <main+0x110>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe14(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    124d <main+0xfd>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1070 <decompress@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
sub    -0x18(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2db2(%rip),%rax
divsd  (%rax),%xmm0
lea    0xdc1(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    125b <main+0x10b>
lea    0xdb5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1260 <main+0x110>
jmp    1273 <main+0x123>
lea    0xd9d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@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    11a0 <main+0x40>
mov    %rsi,%rbx
xor    %eax,%eax
call   1050 <clock@plt>
mov    %rax,%r14
mov    0x8(%rbx),%rdi
lea    0xe9e(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     11ae <main+0x4e>
mov    0x8(%rbx),%rdi
lea    0xe6f(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     11bd <main+0x5d>
lea    0xe60(%rip),%rdi
call   1040 <puts@plt>
jmp    11f2 <main+0x92>
mov    0x10(%rbx),%rdi
mov    0x18(%rbx),%rsi
call   1030 <compress@plt>
jmp    11ca <main+0x6a>
mov    0x10(%rbx),%rdi
mov    0x18(%rbx),%rsi
call   1080 <decompress@plt>
xor    %eax,%eax
call   1050 <clock@plt>
sub    %r14,%rax
cvtsi2sd %rax,%xmm0
mov    0x2e08(%rip),%rax
divsd  (%rax),%xmm0
lea    0xe15(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"e\00"
@.str.1 = [5 x i8] c"%fs\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str.2 = [2 x i8] c"d\00"
@.str.3 = [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 %59
10: ; preds = %2
%11 = call i64 (...) @clock()
store i64 %11, i64* %6
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %33
17: ; preds = %10
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 2
%20 = load i8*, i8** %19
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 3
%23 = load i8*, i8** %22
%24 = call i32 @compress(i8* %20, i8* %23)
%25 = call i64 (...) @clock()
store i64 %25, i64* %7
%26 = load i64, i64* %7
%27 = load i64, i64* %6
%28 = sub nsw i64 %26, %27
%29 = sitofp i64 %28 to double
%30 = load double, double* @CLOCKS_PER_SEC
%31 = fdiv double %29, %30
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %31)
br label %58
33: ; preds = %10
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = call i64 @strcmp(i8* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %55
39: ; preds = %33
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 2
%42 = load i8*, i8** %41
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 3
%45 = load i8*, i8** %44
%46 = call i32 @decompress(i8* %42, i8* %45)
%47 = call i64 (...) @clock()
store i64 %47, i64* %7
%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 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %53)
br label %57
55: ; preds = %33
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
br label %57
57: ; preds = %55, %39
br label %58
58: ; preds = %57, %17
br label %61
59: ; preds = %2
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
br label %61
61: ; preds = %59, %58
ret i32 0
}

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