#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 char const *uint64_t;

/* Variables and functions */
unsigned long crc32(char const *);
char *crc64(char const *);
int fcompare(char const *, char const *);
unsigned long getFileSize(char const *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char const *, char *);
int main(int argc, const char *argv[]) {
  if (argc == 3) {
    if (strcmp(argv[2], "-CRC32") == 0) {
      unsigned long crcres = crc32(argv[1]);
      printf("%lu", crcres);
      return 0;
    } else if (strcmp(argv[2], "-CRC64") == 0) {
      uint64_t crcres = crc64(argv[1]);
      printf("%llu", crcres);
      return 0;
    } else if (strcmp(argv[2], "-SIZE") == 0) {
      unsigned long fsize = getFileSize(argv[1]);
      printf("%lu", fsize);
      return 0;
    } else {
      return 1;
    }
  } else if (argc == 4) {
    if (strcmp(argv[3], "-COMP") == 0) {
      int ret = fcompare(argv[1], argv[2]);
      if (ret == 0)
        printf("same");
      else
        printf("different");
    } else {
      return 1;
    }
  } else {
    printf("please use: %s filename -CRC32 \n", argv[0]);
    printf("please use: %s filename -CRC64 \n", argv[0]);
    printf("please use: %s filename1 filename2 -COMP \n", argv[0]);
    printf("please use: %s filename1 -SIZE \n", argv[0]);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    1273 <main+0x113>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe71(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11cd <main+0x6d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <crc32@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1360 <main+0x200>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe2f(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    121a <main+0xba>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <crc64@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1360 <main+0x200>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xdee(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1267 <main+0x107>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <getFileSize@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1360 <main+0x200>
movl   $0x1,-0x4(%rbp)
jmp    1360 <main+0x200>
cmpl   $0x4,-0x8(%rbp)
jne    12f4 <main+0x194>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xd91(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    12e3 <main+0x183>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1080 <fcompare@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jne    12d0 <main+0x170>
lea    0xd5f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12de <main+0x17e>
lea    0xd51(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12ef <main+0x18f>
movl   $0x1,-0x4(%rbp)
jmp    1360 <main+0x200>
jmp    1354 <main+0x1f4>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xd30(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xd3c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xd48(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xd5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1360 <main+0x200>
jmp    1359 <main+0x1f9>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x4,%edi
je     11d2 <main+0x72>
cmp    $0x3,%edi
jne    1211 <main+0xb1>
mov    0x10(%rbx),%rdi
lea    0xe81(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     125c <main+0xfc>
mov    0x10(%rbx),%rdi
lea    0xe73(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     126e <main+0x10e>
mov    0x10(%rbx),%rdi
lea    0xe66(%rip),%rsi
call   1060 <strcmp@plt>
mov    $0x1,%ebp
test   %rax,%rax
jne    129c <main+0x13c>
mov    0x8(%rbx),%rdi
call   1050 <getFileSize@plt>
jmp    1265 <main+0x105>
mov    0x18(%rbx),%rdi
lea    0xe40(%rip),%rsi
call   1060 <strcmp@plt>
mov    $0x1,%ebp
test   %rax,%rax
jne    129c <main+0x13c>
mov    0x8(%rbx),%rdi
mov    0x10(%rbx),%rsi
call   1080 <fcompare@plt>
test   %eax,%eax
je     128c <main+0x12c>
lea    0xe1c(%rip),%rdi
jmp    1293 <main+0x133>
mov    (%rbx),%rsi
lea    0xe17(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rbx),%rsi
lea    0xe27(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rbx),%rsi
lea    0xe37(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rbx),%rsi
lea    0xe51(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%ebp
jmp    129c <main+0x13c>
mov    0x8(%rbx),%rdi
call   1030 <crc32@plt>
lea    0xd9b(%rip),%rdi
jmp    127e <main+0x11e>
mov    0x8(%rbx),%rdi
call   1070 <crc64@plt>
lea    0xd94(%rip),%rdi
xor    %ebp,%ebp
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    129c <main+0x13c>
lea    0xd90(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"-CRC32\00"
@.str.1 = [4 x i8] c"%lu\00"
@.str.2 = [7 x i8] c"-CRC64\00"
@.str.3 = [5 x i8] c"%llu\00"
@.str.4 = [6 x i8] c"-SIZE\00"
@.str.5 = [6 x i8] c"-COMP\00"
@.str.6 = [5 x i8] c"same\00"
@.str.7 = [10 x i8] c"different\00"
@.str.8 = [33 x i8] c"please use: %s filename -CRC32 \0A\00"
@.str.9 = [33 x i8] c"please use: %s filename -CRC64 \0A\00"
@.str.10 = [43 x i8] c"please use: %s filename1 filename2 -COMP \0A\00"
@.str.11 = [33 x i8] c"please use: %s filename1 -SIZE \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 3
br i1 %11, label %12, label %52
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 2
%15 = load i8*, i8** %14
%16 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %25
18: ; preds = %12
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i64 @crc32(i8* %21)
store i64 %22, i64* %6
%23 = load i64, i64* %6
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %23)
store i32 0, i32* %3
br label %97
25: ; preds = %12
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 2
%28 = load i8*, i8** %27
%29 = call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %38
31: ; preds = %25
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = call i8* @crc64(i8* %34)
store i8* %35, i8** %7
%36 = load i8*, i8** %7
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %36)
store i32 0, i32* %3
br label %97
38: ; preds = %25
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 2
%41 = load i8*, i8** %40
%42 = call i64 @strcmp(i8* %41, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %51
44: ; preds = %38
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 1
%47 = load i8*, i8** %46
%48 = call i64 @getFileSize(i8* %47)
store i64 %48, i64* %8
%49 = load i64, i64* %8
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %49)
store i32 0, i32* %3
br label %97
51: ; preds = %38
store i32 1, i32* %3
br label %97
52: ; preds = %2
%53 = load i32, i32* %4
%54 = icmp eq i32 %53, 4
br i1 %54, label %55, label %78
55: ; preds = %52
%56 = load i8**, i8*** %5
%57 = getelementptr inbounds i8*, i8** %56, i64 3
%58 = load i8*, i8** %57
%59 = call i64 @strcmp(i8* %58, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%60 = icmp eq i64 %59, 0
br i1 %60, label %61, label %76
61: ; preds = %55
%62 = load i8**, i8*** %5
%63 = getelementptr inbounds i8*, i8** %62, i64 1
%64 = load i8*, i8** %63
%65 = load i8**, i8*** %5
%66 = getelementptr inbounds i8*, i8** %65, i64 2
%67 = load i8*, i8** %66
%68 = call i32 @fcompare(i8* %64, i8* %67)
store i32 %68, i32* %9
%69 = load i32, i32* %9
%70 = icmp eq i32 %69, 0
br i1 %70, label %71, label %73
71: ; preds = %61
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %75
73: ; preds = %61
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
br label %75
75: ; preds = %73, %71
br label %77
76: ; preds = %55
store i32 1, i32* %3
br label %97
77: ; preds = %75
br label %95
78: ; preds = %52
%79 = load i8**, i8*** %5
%80 = getelementptr inbounds i8*, i8** %79, i64 0
%81 = load i8*, i8** %80
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.8, i64 0, i64 0), i8* %81)
%83 = load i8**, i8*** %5
%84 = getelementptr inbounds i8*, i8** %83, i64 0
%85 = load i8*, i8** %84
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i8* %85)
%87 = load i8**, i8*** %5
%88 = getelementptr inbounds i8*, i8** %87, i64 0
%89 = load i8*, i8** %88
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.10, i64 0, i64 0), i8* %89)
%91 = load i8**, i8*** %5
%92 = getelementptr inbounds i8*, i8** %91, i64 0
%93 = load i8*, i8** %92
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.11, i64 0, i64 0), i8* %93)
store i32 1, i32* %3
br label %97
95: ; preds = %77
br label %96
96: ; preds = %95
store i32 0, i32* %3
br label %97
97: ; preds = %96, %78, %76, %51, %44, %31, %18
%98 = load i32, i32* %3
ret i32 %98
}

LLVM IR (-O2):
@.str = [7 x i8] c"-CRC32\00"
@.str.1 = [4 x i8] c"%lu\00"
@.str.2 = [7 x i8] c"-CRC64\00"
@.str.3 = [5 x i8] c"%llu\00"
@.str.4 = [6 x i8] c"-SIZE\00"
@.str.5 = [6 x i8] c"-COMP\00"
@.str.6 = [5 x i8] c"same\00"
@.str.7 = [10 x i8] c"different\00"
@.str.8 = [33 x i8] c"please use: %s filename -CRC32 \0A\00"
@.str.9 = [33 x i8] c"please use: %s filename -CRC64 \0A\00"
@.str.10 = [43 x i8] c"please use: %s filename1 filename2 -COMP \0A\00"
@.str.11 = [33 x i8] c"please use: %s filename1 -SIZE \0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %47 [
i32 3, label %3
i32 4, label %31
]
3: ; preds = %2
%4 = getelementptr inbounds i8*, i8** %1, i64 2
%5 = load i8*, i8** %4
%6 = tail call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %3
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i64 @crc32(i8* %10)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %11)
br label %56
13: ; preds = %3
%14 = load i8*, i8** %4
%15 = tail call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %13
%18 = getelementptr inbounds i8*, i8** %1, i64 1
%19 = load i8*, i8** %18
%20 = tail call i8* @crc64(i8* %19)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %20)
br label %56
22: ; preds = %13
%23 = load i8*, i8** %4
%24 = tail call i64 @strcmp(i8* %23, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %56
26: ; preds = %22
%27 = getelementptr inbounds i8*, i8** %1, i64 1
%28 = load i8*, i8** %27
%29 = tail call i64 @getFileSize(i8* %28)
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %29)
br label %56
31: ; preds = %2
%32 = getelementptr inbounds i8*, i8** %1, i64 3
%33 = load i8*, i8** %32
%34 = tail call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %56
36: ; preds = %31
%37 = getelementptr inbounds i8*, i8** %1, i64 1
%38 = load i8*, i8** %37
%39 = getelementptr inbounds i8*, i8** %1, i64 2
%40 = load i8*, i8** %39
%41 = tail call i32 @fcompare(i8* %38, i8* %40)
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %36
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %56
45: ; preds = %36
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
br label %56
47: ; preds = %2
%48 = load i8*, i8** %1
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.8, i64 0, i64 0), i8* %48)
%50 = load i8*, i8** %1
%51 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i8* %50)
%52 = load i8*, i8** %1
%53 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.10, i64 0, i64 0), i8* %52)
%54 = load i8*, i8** %1
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.11, i64 0, i64 0), i8* %54)
br label %56
56: ; preds = %31, %43, %45, %22, %47, %26, %17, %8
%57 = phi i32 [ 0, %8 ], [ 0, %17 ], [ 0, %26 ], [ 1, %47 ], [ 1, %22 ], [ 0, %45 ], [ 0, %43 ], [ 1, %31 ]
ret i32 %57
}