#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 */
char *deciphering(char *, char *, int);
int encryption(char *, char *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ system(char *);
int main(void) {
  int i;
  char *p, c[20];
  i = encryption("I Love You Panke!", "testcipher.txt", 555);
  if (i != 0) {
    printf("Find Error! Exitting...\n");
    return 0;
  }
  printf("Succeed!,File is:\n\n");
  system("cat ./testcipher.txt");
  p = deciphering("testcipher.txt", c, 555);
  if (p == NULL) {
    printf("Read Error! Exitting...\n");
    return 0;
  }
  printf("\n\nSucceed!,String is:\n\n");
  puts(c);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    0xed8(%rip),%rsi
mov    $0x22b,%edx
call   1050 <encryption@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     119c <main+0x4c>
lea    0xe87(%rip),%rdi
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1218 <main+0xc8>
lea    0xe88(%rip),%rdi
call   1060 <printf@plt>
lea    0xe90(%rip),%rdi
call   1040 <system@plt>
lea    -0x30(%rbp),%rsi
lea    0xe86(%rip),%rdi
mov    $0x22b,%edx
call   1070 <deciphering@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11f0 <main+0xa0>
lea    0xe75(%rip),%rdi
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1218 <main+0xc8>
lea    0xe76(%rip),%rdi
call   1060 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1030 <puts@plt>
lea    0xe31(%rip),%rdi
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xea5(%rip),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x22b,%edx
call   1060 <encryption@plt>
test   %eax,%eax
je     117e <main+0x2e>
lea    0xef2(%rip),%rdi
call   1040 <puts@plt>
jmp    11cd <main+0x7d>
lea    0xea2(%rip),%rdi
call   1040 <puts@plt>
lea    0xe81(%rip),%rdi
call   1050 <system@plt>
lea    0xe7b(%rip),%rdi
mov    %rsp,%rsi
mov    $0x22b,%edx
call   1070 <deciphering@plt>
test   %rax,%rax
je     11d4 <main+0x84>
lea    0xe84(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret
lea    0xe76(%rip),%rdi
jmp    1177 <main+0x27>

LLVM IR (-O0):
@.str = [18 x i8] c"I Love You Panke!\00"
@.str.1 = [15 x i8] c"testcipher.txt\00"
@.str.2 = [25 x i8] c"Find Error! Exitting...\0A\00"
@.str.3 = [20 x i8] c"Succeed!,File is:\0A\0A\00"
@.str.4 = [21 x i8] c"cat ./testcipher.txt\00"
@.str.5 = [25 x i8] c"Read Error! Exitting...\0A\00"
@.str.6 = [24 x i8] c"\0A\0ASucceed!,String is:\0A\0A\00"
@.str.7 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [20 x i8]
store i32 0, i32* %1
%5 = call i32 @encryption(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 555)
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %24
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @system(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%13 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%14 = call i8* @deciphering(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %13, i32 555)
store i8* %14, i8** %3
%15 = load i8*, i8** %3
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %19
17: ; preds = %10
%18 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %1
br label %24
19: ; preds = %10
%20 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%21 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%22 = call i32 @puts(i8* %21)
%23 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %1
br label %24
24: ; preds = %19, %17, %8
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@.str = [18 x i8] c"I Love You Panke!\00"
@.str.1 = [15 x i8] c"testcipher.txt\00"
@.str.4 = [21 x i8] c"cat ./testcipher.txt\00"
@str = [19 x i8] c"Succeed!,File is:\0A\00"
@str.8 = [23 x i8] c"\0A\0ASucceed!,String is:\0A\00"
@str.9 = [24 x i8] c"Read Error! Exitting...\00"
@str.10 = [24 x i8] c"Find Error! Exitting...\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @encryption(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 555)
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.10, i64 0, i64 0))
br label %18
7: ; preds = %0
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 @system(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%10 = call i8* @deciphering(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %2, i32 555)
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.9, i64 0, i64 0))
br label %18
14: ; preds = %7
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.8, i64 0, i64 0))
%16 = call i32 @puts(i8* %2)
%17 = call i32 @putchar(i32 10)
br label %18
18: ; preds = %14, %12, %5
ret i32 0
}