#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 /*<<< orphan*/ decrypt_fm(unsigned char *, char *, char *, int *);
int /*<<< orphan*/ encrypt(unsigned char *, char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  unsigned char *mk = "goodknight";
  int wrote_len;
  char buff[100], buff2[100];
  encrypt(mk, "a.txt", "b.txt");
  decrypt_fm(mk, "b.txt", buff2, &wrote_len);
  buff2[wrote_len] = '\0';
  printf("DATA: %s\n", buff2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb3(%rip),%rsi
lea    0xeb2(%rip),%rdx
call   1040 <encrypt@plt>
mov    -0x10(%rbp),%rdi
lea    -0xf0(%rbp),%rdx
lea    0xe9b(%rip),%rsi
lea    -0x14(%rbp),%rcx
call   1050 <decrypt_fm@plt>
movslq -0x14(%rbp),%rax
movb   $0x0,-0xf0(%rbp,%rax,1)
lea    -0xf0(%rbp),%rsi
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
lea    0xebd(%rip),%r14
lea    0xec1(%rip),%rsi
lea    0xec0(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rdx
call   1040 <encrypt@plt>
lea    0x10(%rsp),%r15
lea    0xc(%rsp),%rcx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1050 <decrypt_fm@plt>
movslq 0xc(%rsp),%rax
movb   $0x0,0x10(%rsp,%rax,1)
lea    0xe92(%rip),%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"goodknight\00"
@.str.1 = [6 x i8] c"a.txt\00"
@.str.2 = [6 x i8] c"b.txt\00"
@.str.3 = [10 x i8] c"DATA: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [100 x i8]
%5 = alloca [100 x i8]
store i32 0, i32* %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @encrypt(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%8 = load i8*, i8** %2
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%10 = call i32 @decrypt_fm(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %9, i32* %3)
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %12
store i8 0, i8* %13
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%15 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"goodknight\00"
@.str.1 = [6 x i8] c"a.txt\00"
@.str.2 = [6 x i8] c"b.txt\00"
@.str.3 = [10 x i8] c"DATA: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @encrypt(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @decrypt_fm(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %4, i32* %1)
%7 = load i32, i32* %1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %8
store i8 0, i8* %9
%10 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %4)
ret i32 0
}