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

/* Variables and functions */
int /*<<< orphan*/ decryptstr(char *, char *, char *);
int /*<<< orphan*/ encryptstr(char *, char *, char *);
int /*<<< orphan*/ printASCII(char *, char *);
int /*<<< orphan*/ printcypher(char *);
int /*<<< orphan*/ printf(char *, char *, char *);
int /*<<< orphan*/ printplain(char *);
void test_encryptdecrypt() {
  char *keyword = "EDMONTON";
  char *plaintext = "UNIVERSITY OF ALBERTA";
  int len = sizeof(plaintext);
  printf("keyword: %s\nplaintext: %s\n", keyword, plaintext);
  char cyphertext[len];
  printASCII("Keyword", keyword);
  encryptstr(cyphertext, keyword, plaintext);
  printASCII("Plaintext", plaintext);
  printcypher(cyphertext);
  char decrpyted[len];
  decryptstr(decrpyted, keyword, cyphertext);
  printplain(decrpyted);
  printASCII("Decrypted", decrpyted);
}


x86 assembly (clang, -O0):
<test_encryptdecrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    0xe91(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xe8f(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x8,-0x14(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe70(%rip),%rdi
call   1040 <printASCII@plt>
mov    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1070 <encryptstr@plt>
mov    -0x10(%rbp),%rsi
lea    0xe57(%rip),%rdi
call   1040 <printASCII@plt>
mov    -0x40(%rbp),%rdi
call   1060 <printcypher@plt>
mov    -0x40(%rbp),%rdx
mov    -0x14(%rbp),%eax
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x38(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rsi
call   1080 <decryptstr@plt>
mov    -0x38(%rbp),%rdi
call   1050 <printplain@plt>
mov    -0x38(%rbp),%rsi
lea    0xe13(%rip),%rdi
call   1040 <printASCII@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_encryptdecrypt>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xead(%rip),%rdi
lea    0xe87(%rip),%r15
lea    0xe89(%rip),%r14
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <printf@plt>
lea    0xea8(%rip),%rdi
mov    %r15,%rsi
call   1040 <printASCII@plt>
lea    0x10(%rsp),%r12
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1070 <encryptstr@plt>
lea    0xe8e(%rip),%rdi
mov    %r14,%rsi
call   1040 <printASCII@plt>
mov    %r12,%rdi
call   1060 <printcypher@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1080 <decryptstr@plt>
mov    %rbx,%rdi
call   1050 <printplain@plt>
lea    0xe68(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printASCII@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [9 x i8] c"EDMONTON\00"
@.str.1 = [22 x i8] c"UNIVERSITY OF ALBERTA\00"
@.str.2 = [27 x i8] c"keyword: %s\0Aplaintext: %s\0A\00"
@.str.3 = [8 x i8] c"Keyword\00"
@.str.4 = [10 x i8] c"Plaintext\00"
@.str.5 = [10 x i8] c"Decrypted\00"
define void @test_encryptdecrypt() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8** %2
store i32 8, i32* %3
%7 = load i8*, i8** %1
%8 = load i8*, i8** %2
%9 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %7, i8* %8)
%10 = load i32, i32* %3
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %4
%13 = alloca i8, i64 %11
store i64 %11, i64* %5
%14 = load i8*, i8** %1
%15 = call i32 @printASCII(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %14)
%16 = load i8*, i8** %1
%17 = load i8*, i8** %2
%18 = call i32 @encryptstr(i8* %13, i8* %16, i8* %17)
%19 = load i8*, i8** %2
%20 = call i32 @printASCII(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %19)
%21 = call i32 @printcypher(i8* %13)
%22 = load i32, i32* %3
%23 = zext i32 %22 to i64
%24 = alloca i8, i64 %23
store i64 %23, i64* %6
%25 = load i8*, i8** %1
%26 = call i32 @decryptstr(i8* %24, i8* %25, i8* %13)
%27 = call i32 @printplain(i8* %24)
%28 = call i32 @printASCII(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %24)
%29 = load i8*, i8** %4
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"EDMONTON\00"
@.str.1 = [22 x i8] c"UNIVERSITY OF ALBERTA\00"
@.str.2 = [27 x i8] c"keyword: %s\0Aplaintext: %s\0A\00"
@.str.3 = [8 x i8] c"Keyword\00"
@.str.4 = [10 x i8] c"Plaintext\00"
@.str.5 = [10 x i8] c"Decrypted\00"
define void @test_encryptdecrypt() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%2 = alloca [8 x i8]
%3 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @printASCII(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @encryptstr(i8* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printASCII(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @printcypher(i8* %3)
%8 = alloca [8 x i8]
%9 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 0
%10 = call i32 @decryptstr(i8* %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %3)
%11 = call i32 @printplain(i8* %9)
%12 = call i32 @printASCII(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %9)
ret void
}