#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*/ caesar_decipher(int, char *, char *);
int /*<<< orphan*/ caesar_encipher(int, char *, char *);
int /*<<< orphan*/ free(char *);
char *malloc(scalar_t__);
int /*<<< orphan*/ printf(char *, char *, char *, char *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ system(char *);
int main(int argc, char *argv[]) {
  char *plaintext = "Defend the east wall of the castle.";
  char *ciphertext = malloc(strlen(plaintext) + 1);
  char *result = malloc(strlen(plaintext) + 1);
  caesar_encipher(10, plaintext, ciphertext);
  caesar_decipher(10, ciphertext, result);
  printf("-->original:   %s\n-->ciphertext: %s\n-->plaintext:  %s\n", plaintext,
         ciphertext, result);
  free(ciphertext);
  free(result);
  system("PAUSE");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe73(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1090 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1090 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    $0xa,%edi
call   1030 <caesar_encipher@plt>
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    $0xa,%edi
call   1050 <caesar_decipher@plt>
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
lea    0xe2a(%rip),%rdi
call   1080 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1040 <free@plt>
mov    -0x28(%rbp),%rdi
call   1040 <free@plt>
lea    0xe43(%rip),%rdi
call   1070 <system@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x24,%edi
call   1080 <malloc@plt>
mov    %rax,%rbx
mov    $0x24,%edi
call   1080 <malloc@plt>
mov    %rax,%r14
lea    0xe7a(%rip),%r15
mov    $0xa,%edi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1030 <caesar_encipher@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1050 <caesar_decipher@plt>
lea    0xe77(%rip),%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1040 <free@plt>
mov    %r14,%rdi
call   1040 <free@plt>
lea    0xe89(%rip),%rdi
call   1060 <system@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Defend the east wall of the castle.\00"
@.str.1 = [55 x i8] c"-->original: %s\0A-->ciphertext: %s\0A-->plaintext: %s\0A\00"
@.str.2 = [6 x i8] c"PAUSE\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8** %6
%9 = load i8*, i8** %6
%10 = call i64 @strlen(i8* %9)
%11 = add nsw i64 %10, 1
%12 = call i8* @malloc(i64 %11)
store i8* %12, i8** %7
%13 = load i8*, i8** %6
%14 = call i64 @strlen(i8* %13)
%15 = add nsw i64 %14, 1
%16 = call i8* @malloc(i64 %15)
store i8* %16, i8** %8
%17 = load i8*, i8** %6
%18 = load i8*, i8** %7
%19 = call i32 @caesar_encipher(i32 10, i8* %17, i8* %18)
%20 = load i8*, i8** %7
%21 = load i8*, i8** %8
%22 = call i32 @caesar_decipher(i32 10, i8* %20, i8* %21)
%23 = load i8*, i8** %6
%24 = load i8*, i8** %7
%25 = load i8*, i8** %8
%26 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0), i8* %23, i8* %24, i8* %25)
%27 = load i8*, i8** %7
%28 = call i32 @free(i8* %27)
%29 = load i8*, i8** %8
%30 = call i32 @free(i8* %29)
%31 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [36 x i8] c"Defend the east wall of the castle.\00"
@.str.1 = [55 x i8] c"-->original: %s\0A-->ciphertext: %s\0A-->plaintext: %s\0A\00"
@.str.2 = [6 x i8] c"PAUSE\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call dereferenceable_or_null(36) i8* @malloc(i64 36)
%4 = tail call dereferenceable_or_null(36) i8* @malloc(i64 36)
%5 = tail call i32 @caesar_encipher(i32 10, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %3)
%6 = tail call i32 @caesar_decipher(i32 10, i8* %3, i8* %4)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %4)
%8 = tail call i32 @free(i8* %3)
%9 = tail call i32 @free(i8* %4)
%10 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}