#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 */

/* Variables and functions */
int bruteforceFileNoKeys(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, float);
int getopt(int, char **, char *);
int /*<<< orphan*/ isprint(float);
char *optarg;
float optopt;
int /*<<< orphan*/ prnlog(char *);
int showHelp();
int /*<<< orphan*/ stderr;
int unitTests();
int main(int argc, char **argv) {
  prnlog("IClass Cipher version 1.2, Copyright (C) 2014 Martin Holst Swende\n");
  prnlog("Comes with ABSOLUTELY NO WARRANTY");
  prnlog("Released as GPLv2\n");
  prnlog("WARNING");
  prnlog("");
  prnlog("THIS TOOL IS CREATED FOR EXPERIMENTATION AND EDUCATIONAL USE ONLY. ");
  prnlog("");
  prnlog(
      "USAGE OF THIS TOOL IN OTHER WAYS MAY INFRINGE UPON THE INTELLECTUAL ");
  prnlog("PROPERTY OF OTHER PARTIES, SUCH AS INSIDE SECURE AND HID GLOBAL, ");
  prnlog("AND MAY EXPOSE YOU TO AN INFRINGEMENT ACTION FROM THOSE PARTIES. ");
  prnlog("");
  prnlog("THIS TOOL SHOULD NEVER BE USED TO INFRINGE PATENTS OR INTELLECTUAL "
         "PROPERTY RIGHTS. ");
  char *fileName = NULL;
  int c;
  while ((c = getopt(argc, argv, "thf:")) != -1)
    switch (c) {
    case 't':
      return unitTests();
    case 'h':
      return showHelp();
    case 'f':
      fileName = optarg;
      return bruteforceFileNoKeys(fileName);
    case '?':
      if (optopt == 'f')
        fprintf(stderr, "Option -%c requires an argument.\n", optopt);
      else if (isprint(optopt))
        fprintf(stderr, "Unknown option `-%c'.\n", optopt);
      else
        fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt);
      return 1;
    }
  showHelp();
  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)
lea    0xe77(%rip),%rdi
call   1040 <prnlog@plt>
lea    0xeae(%rip),%rdi
call   1040 <prnlog@plt>
lea    0xec4(%rip),%rdi
call   1040 <prnlog@plt>
lea    0xecb(%rip),%rdi
call   1040 <prnlog@plt>
lea    0x1066(%rip),%rdi
call   1040 <prnlog@plt>
lea    0xebb(%rip),%rdi
call   1040 <prnlog@plt>
lea    0x104e(%rip),%rdi
call   1040 <prnlog@plt>
lea    0xee7(%rip),%rdi
call   1040 <prnlog@plt>
lea    0xf20(%rip),%rdi
call   1040 <prnlog@plt>
lea    0xf56(%rip),%rdi
call   1040 <prnlog@plt>
lea    0x101e(%rip),%rdi
call   1040 <prnlog@plt>
lea    0xf80(%rip),%rdi
call   1040 <prnlog@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xfba(%rip),%rdx
call   1090 <getopt@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
je     137c <main+0x20c>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
sub    $0x3f,%eax
je     12c1 <main+0x151>
jmp    1251 <main+0xe1>
mov    -0x20(%rbp),%eax
sub    $0x66,%eax
je     12a2 <main+0x132>
jmp    1262 <main+0xf2>
mov    -0x20(%rbp),%eax
sub    $0x68,%eax
je     1293 <main+0x123>
jmp    1273 <main+0x103>
mov    -0x20(%rbp),%eax
sub    $0x74,%eax
jne    1377 <main+0x207>
jmp    1284 <main+0x114>
mov    $0x0,%al
call   1060 <unitTests@plt>
mov    %eax,-0x4(%rbp)
jmp    138a <main+0x21a>
mov    $0x0,%al
call   1030 <showHelp@plt>
mov    %eax,-0x4(%rbp)
jmp    138a <main+0x21a>
mov    0x2d4f(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <bruteforceFileNoKeys@plt>
mov    %eax,-0x4(%rbp)
jmp    138a <main+0x21a>
mov    0x2d18(%rip),%rax
movss  (%rax),%xmm0
movss  0xd2c(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    1308 <main+0x198>
jp     1308 <main+0x198>
mov    0x2ce6(%rip),%rax
mov    (%rax),%edi
mov    0x2ced(%rip),%rax
movss  (%rax),%xmm0
lea    0xeed(%rip),%rsi
call   1070 <fprintf@plt>
jmp    136b <main+0x1fb>
mov    0x2cd1(%rip),%rax
movss  (%rax),%xmm0
call   1080 <isprint@plt>
cmp    $0x0,%eax
je     1346 <main+0x1d6>
mov    0x2ca8(%rip),%rax
mov    (%rax),%edi
mov    0x2caf(%rip),%rax
movss  (%rax),%xmm0
lea    0xed1(%rip),%rsi
call   1070 <fprintf@plt>
jmp    1366 <main+0x1f6>
mov    0x2c83(%rip),%rax
mov    (%rax),%edi
mov    0x2c8a(%rip),%rax
movss  (%rax),%xmm0
lea    0xec3(%rip),%rsi
call   1070 <fprintf@plt>
jmp    136b <main+0x1fb>
movl   $0x1,-0x4(%rbp)
jmp    138a <main+0x21a>
jmp    121e <main+0xae>
mov    $0x0,%al
call   1030 <showHelp@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
lea    0xe84(%rip),%rdi
call   1040 <prnlog@plt>
lea    0xebb(%rip),%rdi
call   1040 <prnlog@plt>
lea    0xed1(%rip),%rdi
call   1040 <prnlog@plt>
lea    0xed8(%rip),%rdi
call   1040 <prnlog@plt>
lea    0x1073(%rip),%rbx
mov    %rbx,%rdi
call   1040 <prnlog@plt>
lea    0xec5(%rip),%rdi
call   1040 <prnlog@plt>
mov    %rbx,%rdi
call   1040 <prnlog@plt>
lea    0xef5(%rip),%rdi
call   1040 <prnlog@plt>
lea    0xf2e(%rip),%rdi
call   1040 <prnlog@plt>
lea    0xf64(%rip),%rdi
call   1040 <prnlog@plt>
mov    %rbx,%rdi
call   1040 <prnlog@plt>
lea    0xf92(%rip),%rdi
call   1040 <prnlog@plt>
lea    0xfdb(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1090 <getopt@plt>
cmp    $0x65,%eax
jle    1240 <main+0xd0>
cmp    $0x66,%eax
je     127a <main+0x10a>
cmp    $0x68,%eax
je     128d <main+0x11d>
cmp    $0x74,%eax
jne    1210 <main+0xa0>
jmp    1298 <main+0x128>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    $0xffffffff,%eax
je     12a3 <main+0x133>
cmp    $0x3f,%eax
jne    1210 <main+0xa0>
mov    0x2d8f(%rip),%rbx
movss  (%rbx),%xmm0
ucomiss 0xda4(%rip),%xmm0
jne    12ae <main+0x13e>
jp     12ae <main+0x13e>
mov    0x2d69(%rip),%rax
mov    (%rax),%edi
lea    0xf7b(%rip),%rsi
movss  0xd88(%rip),%xmm0
jmp    12d4 <main+0x164>
mov    0x2d77(%rip),%rax
mov    (%rax),%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <bruteforceFileNoKeys@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <showHelp@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <unitTests@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <showHelp@plt>
jmp    12de <main+0x16e>
call   1080 <isprint@plt>
mov    0x2d16(%rip),%rcx
mov    (%rcx),%edi
movss  (%rbx),%xmm0
test   %eax,%eax
je     12cd <main+0x15d>
lea    0xf42(%rip),%rsi
jmp    12d4 <main+0x164>
lea    0xf50(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [67 x i8] c"IClass Cipher version 1.2, Copyright (C) 2014 Martin Holst Swende\0A\00"
@.str.1 = [34 x i8] c"Comes with ABSOLUTELY NO WARRANTY\00"
@.str.2 = [19 x i8] c"Released as GPLv2\0A\00"
@.str.3 = [8 x i8] c"WARNING\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [68 x i8] c"THIS TOOL IS CREATED FOR EXPERIMENTATION AND EDUCATIONAL USE ONLY. \00"
@.str.6 = [69 x i8] c"USAGE OF THIS TOOL IN OTHER WAYS MAY INFRINGE UPON THE INTELLECTUAL \00"
@.str.7 = [66 x i8] c"PROPERTY OF OTHER PARTIES, SUCH AS INSIDE SECURE AND HID GLOBAL, \00"
@.str.8 = [66 x i8] c"AND MAY EXPOSE YOU TO AN INFRINGEMENT ACTION FROM THOSE PARTIES. \00"
@.str.9 = [85 x i8] c"THIS TOOL SHOULD NEVER BE USED TO INFRINGE PATENTS OR INTELLECTUAL PROPERTY RIGHTS. \00"
@.str.10 = [5 x i8] c"thf:\00"
@optarg = global i8* null
@optopt = global float 0.000000e+00
@stderr = global i32 0
@.str.11 = [34 x i8] c"Option -%c requires an argument.\0A\00"
@.str.12 = [23 x i8] c"Unknown option `-%c'.\0A\00"
@.str.13 = [34 x i8] c"Unknown option character `\\x%x'.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 @prnlog(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @prnlog(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @prnlog(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @prnlog(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @prnlog(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 @prnlog(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 @prnlog(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @prnlog(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.6, i64 0, i64 0))
%16 = call i32 @prnlog(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.7, i64 0, i64 0))
%17 = call i32 @prnlog(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.8, i64 0, i64 0))
%18 = call i32 @prnlog(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
%19 = call i32 @prnlog(i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str.9, i64 0, i64 0))
store i8* null, i8** %6
br label %20
20: ; preds = %56, %2
%21 = load i32, i32* %4
%22 = load i8**, i8*** %5
%23 = call i32 @getopt(i32 %21, i8** %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
store i32 %23, i32* %7
%24 = icmp ne i32 %23, -1
br i1 %24, label %25, label %57
25: ; preds = %20
%26 = load i32, i32* %7
switch i32 %26, label %56 [
i32 116, label %27
i32 104, label %29
i32 102, label %31
i32 63, label %35
]
27: ; preds = %25
%28 = call i32 (...) @unitTests()
store i32 %28, i32* %3
br label %59
29: ; preds = %25
%30 = call i32 (...) @showHelp()
store i32 %30, i32* %3
br label %59
31: ; preds = %25
%32 = load i8*, i8** @optarg
store i8* %32, i8** %6
%33 = load i8*, i8** %6
%34 = call i32 @bruteforceFileNoKeys(i8* %33)
store i32 %34, i32* %3
br label %59
35: ; preds = %25
%36 = load float, float* @optopt
%37 = fcmp oeq float %36, 1.020000e+02
br i1 %37, label %38, label %42
38: ; preds = %35
%39 = load i32, i32* @stderr
%40 = load float, float* @optopt
%41 = call i32 @fprintf(i32 %39, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.11, i64 0, i64 0), float %40)
br label %55
42: ; preds = %35
%43 = load float, float* @optopt
%44 = call i32 @isprint(float %43)
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %50
46: ; preds = %42
%47 = load i32, i32* @stderr
%48 = load float, float* @optopt
%49 = call i32 @fprintf(i32 %47, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0), float %48)
br label %54
50: ; preds = %42
%51 = load i32, i32* @stderr
%52 = load float, float* @optopt
%53 = call i32 @fprintf(i32 %51, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.13, i64 0, i64 0), float %52)
br label %54
54: ; preds = %50, %46
br label %55
55: ; preds = %54, %38
store i32 1, i32* %3
br label %59
56: ; preds = %25
br label %20
57: ; preds = %20
%58 = call i32 (...) @showHelp()
store i32 0, i32* %3
br label %59
59: ; preds = %57, %55, %31, %29, %27
%60 = load i32, i32* %3
ret i32 %60
}

LLVM IR (-O2):
@.str = [67 x i8] c"IClass Cipher version 1.2, Copyright (C) 2014 Martin Holst Swende\0A\00"
@.str.1 = [34 x i8] c"Comes with ABSOLUTELY NO WARRANTY\00"
@.str.2 = [19 x i8] c"Released as GPLv2\0A\00"
@.str.3 = [8 x i8] c"WARNING\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [68 x i8] c"THIS TOOL IS CREATED FOR EXPERIMENTATION AND EDUCATIONAL USE ONLY. \00"
@.str.6 = [69 x i8] c"USAGE OF THIS TOOL IN OTHER WAYS MAY INFRINGE UPON THE INTELLECTUAL \00"
@.str.7 = [66 x i8] c"PROPERTY OF OTHER PARTIES, SUCH AS INSIDE SECURE AND HID GLOBAL, \00"
@.str.8 = [66 x i8] c"AND MAY EXPOSE YOU TO AN INFRINGEMENT ACTION FROM THOSE PARTIES. \00"
@.str.9 = [85 x i8] c"THIS TOOL SHOULD NEVER BE USED TO INFRINGE PATENTS OR INTELLECTUAL PROPERTY RIGHTS. \00"
@.str.10 = [5 x i8] c"thf:\00"
@optarg = global i8* null
@optopt = global float 0.000000e+00
@stderr = global i32 0
@.str.11 = [34 x i8] c"Option -%c requires an argument.\0A\00"
@.str.12 = [23 x i8] c"Unknown option `-%c'.\0A\00"
@.str.13 = [34 x i8] c"Unknown option character `\\x%x'.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @prnlog(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @prnlog(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @prnlog(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @prnlog(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%7 = tail call i32 @prnlog(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
%8 = tail call i32 @prnlog(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.5, i64 0, i64 0))
%9 = tail call i32 @prnlog(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
%10 = tail call i32 @prnlog(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.6, i64 0, i64 0))
%11 = tail call i32 @prnlog(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.7, i64 0, i64 0))
%12 = tail call i32 @prnlog(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.8, i64 0, i64 0))
%13 = tail call i32 @prnlog(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
%14 = tail call i32 @prnlog(i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str.9, i64 0, i64 0))
br label %15
15: ; preds = %15, %2
%16 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
switch i32 %16, label %15 [
i32 -1, label %39
i32 116, label %17
i32 104, label %19
i32 102, label %21
i32 63, label %24
]
17: ; preds = %15
%18 = tail call i32 (...) @unitTests()
br label %41
19: ; preds = %15
%20 = tail call i32 (...) @showHelp()
br label %41
21: ; preds = %15
%22 = load i8*, i8** @optarg
%23 = tail call i32 @bruteforceFileNoKeys(i8* %22)
br label %41
24: ; preds = %15
%25 = load float, float* @optopt
%26 = fcmp oeq float %25, 1.020000e+02
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = load i32, i32* @stderr
%29 = tail call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.11, i64 0, i64 0), float 1.020000e+02)
br label %41
30: ; preds = %24
%31 = tail call i32 @isprint(float %25)
%32 = icmp eq i32 %31, 0
%33 = load i32, i32* @stderr
%34 = load float, float* @optopt
br i1 %32, label %37, label %35
35: ; preds = %30
%36 = tail call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0), float %34)
br label %41
37: ; preds = %30
%38 = tail call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.13, i64 0, i64 0), float %34)
br label %41
39: ; preds = %15
%40 = tail call i32 (...) @showHelp()
br label %41
41: ; preds = %27, %37, %35, %39, %21, %19, %17
%42 = phi i32 [ %23, %21 ], [ %20, %19 ], [ %18, %17 ], [ 0, %39 ], [ 1, %35 ], [ 1, %37 ], [ 1, %27 ]
ret i32 %42
}