#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 aescryptd() {
  char buf[1024];
  char pt2[1024];
  printf("ENTER PASSCODE FOR ENCRYPTION: ");
  scanf("%s", pt2);
  printf("\x1B[31m"
         "--ENCRYPTING--\n");
  snprintf(buf, sizeof(buf), "aescrypt -e -p %s data/data.fdf", pt2);
  system(buf);
  snprintf(buf, sizeof(buf), "aescrypt -e -p %s data/cmd_history.fdf", pt2);
  system(buf);
  system("rm data/data.fdf");
  system("rm data/cmd_history.fdf");
  printf("\033[0m"
         "--END--\n");
  printf("\x1B[37m"
         "[  "
         "\x1B[32m"
         "OK"
         "\x1B[37m"
         "  ] encryption successful \n");
  sleep(1);
}


x86 assembly (clang, -O0):
<aescryptd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x810,%rsp
lea    0xe9e(%rip),%rdi
call   1040 <printf@plt>
lea    -0x810(%rbp),%rsi
lea    0xeab(%rip),%rdi
call   1060 <scanf@plt>
lea    0xea2(%rip),%rdi
call   1040 <printf@plt>
lea    -0x410(%rbp),%rdi
lea    -0x810(%rbp),%rcx
mov    $0x400,%esi
lea    0xe98(%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    0xe8d(%rip),%rdx
call   1050 <snprintf@plt>
lea    -0x410(%rbp),%rdi
call   1030 <system@plt>
lea    0xe9c(%rip),%rdi
call   1030 <system@plt>
lea    0xea1(%rip),%rdi
call   1030 <system@plt>
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
lea    0xeae(%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):
<aescryptd>:
push   %r14
push   %rbx
sub    $0x808,%rsp
lea    0xe8f(%rip),%rdi
call   1050 <printf@plt>
lea    0xea3(%rip),%rdi
mov    %rsp,%r14
mov    %r14,%rsi
call   1070 <scanf@plt>
lea    0xf04(%rip),%rdi
call   1030 <puts@plt>
lea    0xe88(%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    0xe81(%rip),%rdx
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r14,%rcx
call   1060 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
lea    0xe89(%rip),%rdi
call   1040 <system@plt>
lea    0xe8e(%rip),%rdi
call   1040 <system@plt>
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
lea    0xeae(%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 = [32 x i8] c"ENTER PASSCODE FOR ENCRYPTION: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [21 x i8] c"\1B[31m--ENCRYPTING--\0A\00"
@.str.3 = [32 x i8] c"aescrypt -e -p %s data/data.fdf\00"
@.str.4 = [39 x i8] c"aescrypt -e -p %s data/cmd_history.fdf\00"
@.str.5 = [17 x i8] c"rm data/data.fdf\00"
@.str.6 = [24 x i8] c"rm data/cmd_history.fdf\00"
@.str.7 = [13 x i8] c"\1B[0m--END--\0A\00"
@.str.8 = [48 x i8] c"\1B[37m[ \1B[32mOK\1B[37m ] encryption successful \0A\00"
define i32 @aescryptd() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = alloca [1024 x i8]
%4 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 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 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%10 = call i32 @snprintf(i8* %8, i32 1024, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%12 = call i32 @system(i8* %11)
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%15 = call i32 @snprintf(i8* %13, i32 1024, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i8* %14)
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%17 = call i32 @system(i8* %16)
%18 = call i32 @system(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%19 = call i32 @system(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%20 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%21 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.8, i64 0, i64 0))
%22 = call i32 @sleep(i32 1)
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
@.str = [32 x i8] c"ENTER PASSCODE FOR ENCRYPTION: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.3 = [32 x i8] c"aescrypt -e -p %s data/data.fdf\00"
@.str.4 = [39 x i8] c"aescrypt -e -p %s data/cmd_history.fdf\00"
@.str.5 = [17 x i8] c"rm data/data.fdf\00"
@.str.6 = [24 x i8] c"rm data/cmd_history.fdf\00"
@str = [20 x i8] c"\1B[31m--ENCRYPTING--\00"
@str.9 = [12 x i8] c"\1B[0m--END--\00"
@str.10 = [47 x i8] c"\1B[37m[ \1B[32mOK\1B[37m ] encryption successful \00"
define i32 @aescryptd() {
%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 ([32 x i8], [32 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 @snprintf(i8* %3, i32 1024, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%9 = call i32 @system(i8* %3)
%10 = call i32 @snprintf(i8* %3, i32 1024, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i8* %4)
%11 = call i32 @system(i8* %3)
%12 = call i32 @system(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%13 = call i32 @system(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.9, i64 0, i64 0))
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.10, i64 0, i64 0))
%16 = call i32 @sleep(i32 1)
ret i32 undef
}