#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 time_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
int time(int /*<<< orphan*/ *);
int main() {
  time_t start, end;
  int t, option;
  void encryption();
  void decryption();
  void bruteforce();
  printf("Choose:\n1.Encryption\n2.Decryption\n3.Bruteforce\n");
  scanf("%d", &option);
  if (option == 1)
    encryption();
  else if (option == 2)
    decryption();
  else if (option == 3) {
    start = time(NULL);
    bruteforce();
    end = time(NULL);
    double mean;
    mean = (end - start) / t;
    printf("Mesos xronos:%f\n", mean / 10);
    printf("Prospa9eies: %d \n", t);
  } else
    printf("Den edwses egkuro xaraktira.\n");
  system("PAUSE");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xea4(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1090 <scanf@plt>
cmpl   $0x1,-0x14(%rbp)
jne    11b3 <main+0x43>
mov    $0x0,%al
call   1060 <encryption@plt>
jmp    1252 <main+0xe2>
cmpl   $0x2,-0x14(%rbp)
jne    11c9 <main+0x59>
mov    $0x0,%al
call   1040 <decryption@plt>
jmp    124d <main+0xdd>
cmpl   $0x3,-0x14(%rbp)
jne    123a <main+0xca>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <time@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <bruteforce@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <time@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xdee(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe1e(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1248 <main+0xd8>
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    124d <main+0xdd>
jmp    1252 <main+0xe2>
lea    0xe23(%rip),%rdi
call   1050 <system@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xea4(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6c(%rip),%rdi
lea    0x4(%rsp),%rsi
call   10a0 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x3,%eax
je     11ba <main+0x3a>
cmp    $0x2,%eax
je     11ed <main+0x6d>
cmp    $0x1,%eax
jne    11f6 <main+0x76>
xor    %eax,%eax
call   1070 <encryption@plt>
jmp    1202 <main+0x82>
xor    %edi,%edi
call   1090 <time@plt>
xor    %eax,%eax
call   1040 <bruteforce@plt>
xor    %edi,%edi
call   1090 <time@plt>
lea    0xe2d(%rip),%rdi
mov    $0x1,%al
call   1080 <printf@plt>
lea    0xe30(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
jmp    1202 <main+0x82>
xor    %eax,%eax
call   1050 <decryption@plt>
jmp    1202 <main+0x82>
lea    0xe5e(%rip),%rdi
call   1030 <puts@plt>
lea    0xe1d(%rip),%rdi
call   1060 <system@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [48 x i8] c"Choose:\0A1.Encryption\0A2.Decryption\0A3.Bruteforce\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [17 x i8] c"Mesos xronos:%f\0A\00"
@.str.3 = [18 x i8] c"Prospa9eies: %d \0A\00"
@.str.4 = [30 x i8] c"Den edwses egkuro xaraktira.\0A\00"
@.str.5 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %12
11: ; preds = %0
br label %37
12: ; preds = %0
%13 = load i32, i32* %5
%14 = icmp eq i32 %13, 2
br i1 %14, label %15, label %16
15: ; preds = %12
br label %36
16: ; preds = %12
%17 = load i32, i32* %5
%18 = icmp eq i32 %17, 3
br i1 %18, label %19, label %33
19: ; preds = %16
%20 = call i32 @time(i32* null)
store i32 %20, i32* %2
%21 = call i32 @time(i32* null)
store i32 %21, i32* %3
%22 = load i32, i32* %3
%23 = load i32, i32* %2
%24 = sub nsw i32 %22, %23
%25 = load i32, i32* %4
%26 = sdiv i32 %24, %25
%27 = sitofp i32 %26 to double
store double %27, double* %6
%28 = load double, double* %6
%29 = fdiv double %28, 1.000000e+01
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), double %29)
%31 = load i32, i32* %4
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %31)
br label %35
33: ; preds = %16
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
br label %35
35: ; preds = %33, %19
br label %36
36: ; preds = %35, %15
br label %37
37: ; preds = %36, %11
%38 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [17 x i8] c"Mesos xronos:%f\0A\00"
@.str.3 = [18 x i8] c"Prospa9eies: %d \0A\00"
@.str.5 = [6 x i8] c"PAUSE\00"
@str = [47 x i8] c"Choose:\0A1.Encryption\0A2.Decryption\0A3.Bruteforce\00"
@str.6 = [29 x i8] c"Den edwses egkuro xaraktira.\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
switch i32 %5, label %13 [
i32 1, label %6
i32 2, label %7
i32 3, label %8
]
6: ; preds = %0
br label %15
7: ; preds = %0
br label %15
8: ; preds = %0
%9 = call i32 @time(i32* null)
%10 = call i32 @time(i32* null)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), double poison)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 undef)
br label %15
13: ; preds = %0
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.6, i64 0, i64 0))
br label %15
15: ; preds = %7, %13, %8, %6
%16 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}