#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 /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int /*<<< orphan*/ system(char *);
int aescrypt() {
  char buf[1024];
  char pt1[1024];
  printf("ENTER ENCRYPTION PASSCODE: ");
  scanf("%s", pt1);
  printf("\x1B[31m"
         "--DECRYPTING--\n");
  system("touch data/data.fdf");
  system("touch data/cmd_history.fdf");
  snprintf(buf, sizeof(buf), "aescrypt -d -p %s data/data.fdf.aes", pt1);
  system(buf);
  snprintf(buf, sizeof(buf), "aescrypt -d -p %s data/cmd_history.fdf.aes", pt1);
  system(buf);
  system("rm data/data.fdf.aes");
  system("rm data/cmd_history.fdf.aes");
  printf("\033[0m"
         "--END--");
  printf("\x1B[37m"
         "[  "
         "\x1B[32m"
         "OK"
         "\x1B[37m"
         "  ] decryption successful \n");
  sleep(1);
}


x86 assembly (clang, -O0):
<aescrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x810,%rsp
lea    0xe9e(%rip),%rdi
call   1040 <printf@plt>
lea    -0x810(%rbp),%rsi
lea    0xea7(%rip),%rdi
call   1060 <scanf@plt>
lea    0xe9e(%rip),%rdi
call   1040 <printf@plt>
lea    0xea7(%rip),%rdi
call   1030 <system@plt>
lea    0xeaf(%rip),%rdi
call   1030 <system@plt>
lea    -0x410(%rbp),%rdi
lea    -0x810(%rbp),%rcx
mov    $0x400,%esi
lea    0xeab(%rip),%rdx
call   1050 <snprintf@plt>
lea    -0x410(%rbp),%rdi
call   1030 <system@plt>
lea    -0x410(%rbp),%rdi
lea    -0x810(%rbp),%rcx
mov    $0x400,%esi
lea    0xea4(%rip),%rdx
call   1050 <snprintf@plt>
lea    -0x410(%rbp),%rdi
call   1030 <system@plt>
lea    0xeb7(%rip),%rdi
call   1030 <system@plt>
lea    0xec0(%rip),%rdi
call   1030 <system@plt>
lea    0xed0(%rip),%rdi
call   1040 <printf@plt>
lea    0xed0(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
mov    -0x4(%rbp),%eax
add    $0x810,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aescrypt>:
push   %r14
push   %rbx
sub    $0x808,%rsp
lea    0xe8f(%rip),%rdi
call   1050 <printf@plt>
lea    0xe9f(%rip),%rdi
mov    %rsp,%r14
mov    %r14,%rsi
call   1070 <scanf@plt>
lea    0xf4b(%rip),%rdi
call   1030 <puts@plt>
lea    0xe84(%rip),%rdi
call   1040 <system@plt>
lea    0xe8c(%rip),%rdi
call   1040 <system@plt>
lea    0xe9b(%rip),%rdx
lea    0x400(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r14,%rcx
call   1060 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
lea    0xe98(%rip),%rdx
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r14,%rcx
call   1060 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
lea    0xea4(%rip),%rdi
call   1040 <system@plt>
lea    0xead(%rip),%rdi
call   1040 <system@plt>
lea    0xebd(%rip),%rdi
call   1050 <printf@plt>
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
add    $0x808,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [28 x i8] c"ENTER ENCRYPTION PASSCODE: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [21 x i8] c"\1B[31m--DECRYPTING--\0A\00"
@.str.3 = [20 x i8] c"touch data/data.fdf\00"
@.str.4 = [27 x i8] c"touch data/cmd_history.fdf\00"
@.str.5 = [36 x i8] c"aescrypt -d -p %s data/data.fdf.aes\00"
@.str.6 = [43 x i8] c"aescrypt -d -p %s data/cmd_history.fdf.aes\00"
@.str.7 = [21 x i8] c"rm data/data.fdf.aes\00"
@.str.8 = [28 x i8] c"rm data/cmd_history.fdf.aes\00"
@.str.9 = [12 x i8] c"\1B[0m--END--\00"
@.str.10 = [48 x i8] c"\1B[37m[ \1B[32mOK\1B[37m ] decryption successful \0A\00"
define i32 @aescrypt() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = alloca [1024 x i8]
%4 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @system(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @system(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%12 = call i32 @snprintf(i8* %10, i32 1024, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%14 = call i32 @system(i8* %13)
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%17 = call i32 @snprintf(i8* %15, i32 1024, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%19 = call i32 @system(i8* %18)
%20 = call i32 @system(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%21 = call i32 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
%22 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0))
%23 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.10, i64 0, i64 0))
%24 = call i32 @sleep(i32 1)
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@.str = [28 x i8] c"ENTER ENCRYPTION PASSCODE: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.3 = [20 x i8] c"touch data/data.fdf\00"
@.str.4 = [27 x i8] c"touch data/cmd_history.fdf\00"
@.str.5 = [36 x i8] c"aescrypt -d -p %s data/data.fdf.aes\00"
@.str.6 = [43 x i8] c"aescrypt -d -p %s data/cmd_history.fdf.aes\00"
@.str.7 = [21 x i8] c"rm data/data.fdf.aes\00"
@.str.8 = [28 x i8] c"rm data/cmd_history.fdf.aes\00"
@.str.9 = [12 x i8] c"\1B[0m--END--\00"
@str = [20 x i8] c"\1B[31m--DECRYPTING--\00"
@str.11 = [47 x i8] c"\1B[37m[ \1B[32mOK\1B[37m ] decryption successful \00"
define i32 @aescrypt() {
%1 = alloca [1024 x i8]
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%8 = call i32 @system(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @system(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%10 = call i32 @snprintf(i8* %3, i32 1024, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%11 = call i32 @system(i8* %3)
%12 = call i32 @snprintf(i8* %3, i32 1024, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i8* %4)
%13 = call i32 @system(i8* %3)
%14 = call i32 @system(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%15 = call i32 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
%16 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0))
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.11, i64 0, i64 0))
%18 = call i32 @sleep(i32 1)
ret i32 undef
}