#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*/ plain;
typedef int /*<<< orphan*/ cipher;

/* Variables and functions */
char *caesar_decode_cstr_simple(char const *, char *, int, int);
char *caesar_encode_cstr_simple(char const *, char *, int, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char plain[1024];
  char cipher[1024];
  const char *plain1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  const char *plain2 = "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG";
  const char *plain3 = "Hello, world!";
  const char *plain4 = "exxegoexsrgi";
  const char *plain5 = "bob, i love you. alice";
  int i;
  printf("Cipher: %s.\n",
         caesar_encode_cstr_simple(plain1, cipher,
                                   (sizeof(cipher) / sizeof(cipher[0])), 23));
  printf("Cipher: %s.\n",
         caesar_encode_cstr_simple(plain2, cipher,
                                   (sizeof(cipher) / sizeof(cipher[0])), 23));
  printf("Plain: %s.\n",
         caesar_decode_cstr_simple(cipher, plain,
                                   (sizeof(plain) / sizeof(plain[0])), 23));
  printf("Cipher: %s.\n",
         caesar_encode_cstr_simple(plain3, cipher,
                                   (sizeof(cipher) / sizeof(cipher[0])), 23));
  printf("Plain: %s.\n",
         caesar_decode_cstr_simple(cipher, plain,
                                   (sizeof(plain) / sizeof(plain[0])), 23));
  for (i = -27; i <= 27; ++i)
    printf("[%03d] %s.\n", i,
           caesar_decode_cstr_simple(plain4, plain,
                                     (sizeof(plain) / sizeof(plain[0])), i));
  printf("Cipher: %s.\n",
         caesar_encode_cstr_simple(plain5, cipher,
                                   (sizeof(cipher) / sizeof(cipher[0])), 3));
  printf("Plain: %s.\n",
         caesar_decode_cstr_simple(cipher, plain,
                                   (sizeof(plain) / sizeof(plain[0])), 3));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x840,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rax
mov    %rax,-0x818(%rbp)
lea    0xec4(%rip),%rax
mov    %rax,-0x820(%rbp)
lea    0xee2(%rip),%rax
mov    %rax,-0x828(%rbp)
lea    0xee2(%rip),%rax
mov    %rax,-0x830(%rbp)
lea    0xee1(%rip),%rax
mov    %rax,-0x838(%rbp)
mov    -0x818(%rbp),%rdi
lea    -0x810(%rbp),%rsi
mov    $0x400,%edx
mov    $0x17,%ecx
call   1050 <caesar_encode_cstr_simple@plt>
mov    %rax,%rsi
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x820(%rbp),%rdi
lea    -0x810(%rbp),%rsi
mov    $0x400,%edx
mov    $0x17,%ecx
call   1050 <caesar_encode_cstr_simple@plt>
mov    %rax,%rsi
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x810(%rbp),%rdi
lea    -0x410(%rbp),%rsi
mov    $0x400,%edx
mov    $0x17,%ecx
call   1040 <caesar_decode_cstr_simple@plt>
mov    %rax,%rsi
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x828(%rbp),%rdi
lea    -0x810(%rbp),%rsi
mov    $0x400,%edx
mov    $0x17,%ecx
call   1050 <caesar_encode_cstr_simple@plt>
mov    %rax,%rsi
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x810(%rbp),%rdi
lea    -0x410(%rbp),%rsi
mov    $0x400,%edx
mov    $0x17,%ecx
call   1040 <caesar_decode_cstr_simple@plt>
mov    %rax,%rsi
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffe5,-0x83c(%rbp)
ff ff ff
cmpl   $0x1b,-0x83c(%rbp)
jg     12da <main+0x1aa>
mov    -0x83c(%rbp),%eax
mov    %eax,-0x840(%rbp)
mov    -0x830(%rbp),%rdi
lea    -0x410(%rbp),%rsi
mov    -0x83c(%rbp),%ecx
mov    $0x400,%edx
call   1040 <caesar_decode_cstr_simple@plt>
mov    -0x840(%rbp),%esi
mov    %rax,%rdx
lea    0xdd3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x83c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x83c(%rbp)
jmp    1278 <main+0x148>
mov    -0x838(%rbp),%rdi
lea    -0x810(%rbp),%rsi
mov    $0x400,%edx
mov    $0x3,%ecx
call   1050 <caesar_encode_cstr_simple@plt>
mov    %rax,%rsi
lea    0xd78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x810(%rbp),%rdi
lea    -0x410(%rbp),%rsi
mov    $0x400,%edx
mov    $0x3,%ecx
call   1040 <caesar_decode_cstr_simple@plt>
mov    %rax,%rsi
lea    0xd57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x840,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x800,%rsp
lea    0xeba(%rip),%rdi
mov    %rsp,%r14
mov    %r14,%rsi
mov    $0x400,%edx
mov    $0x17,%ecx
call   1050 <caesar_encode_cstr_simple@plt>
lea    0xf17(%rip),%r15
mov    %r15,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xea5(%rip),%rdi
mov    %r14,%rsi
mov    $0x400,%edx
mov    $0x17,%ecx
call   1050 <caesar_encode_cstr_simple@plt>
mov    %r15,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x400(%rsp),%r12
mov    %r14,%rdi
mov    %r12,%rsi
mov    $0x400,%edx
mov    $0x17,%ecx
call   1040 <caesar_decode_cstr_simple@plt>
lea    0xecd(%rip),%rbx
mov    %rbx,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe7a(%rip),%rdi
mov    %r14,%rsi
mov    $0x400,%edx
mov    $0x17,%ecx
call   1050 <caesar_encode_cstr_simple@plt>
mov    %r15,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %r12,%rsi
mov    $0x400,%edx
mov    $0x17,%ecx
call   1040 <caesar_decode_cstr_simple@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xffffffe5,%ebp
lea    0xe3b(%rip),%r14
lea    0xe71(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r12,%rsi
mov    $0x400,%edx
mov    %ebp,%ecx
call   1040 <caesar_decode_cstr_simple@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %rax,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    $0x1c,%ebp
jne    1230 <main+0x100>
lea    0xe02(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
mov    $0x400,%edx
mov    $0x3,%ecx
call   1050 <caesar_encode_cstr_simple@plt>
lea    0xdfd(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x400(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x400,%edx
mov    $0x3,%ecx
call   1040 <caesar_decode_cstr_simple@plt>
lea    0xddf(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x800,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZ\00"
@.str.1 = [44 x i8] c"THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG\00"
@.str.2 = [14 x i8] c"Hello, world!\00"
@.str.3 = [13 x i8] c"exxegoexsrgi\00"
@.str.4 = [23 x i8] c"bob, i love you. alice\00"
@.str.5 = [13 x i8] c"Cipher: %s.\0A\00"
@.str.6 = [12 x i8] c"Plain: %s.\0A\00"
@.str.7 = [12 x i8] c"[%03d] %s.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = alloca [1024 x i8]
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8** %4
store i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i8** %5
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8** %6
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8** %7
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8** %8
%10 = load i8*, i8** %4
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%12 = call i8* @caesar_encode_cstr_simple(i8* %10, i8* %11, i32 1024, i32 23)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %12)
%14 = load i8*, i8** %5
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%16 = call i8* @caesar_encode_cstr_simple(i8* %14, i8* %15, i32 1024, i32 23)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%20 = call i8* @caesar_decode_cstr_simple(i8* %18, i8* %19, i32 1024, i32 23)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %20)
%22 = load i8*, i8** %6
%23 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%24 = call i8* @caesar_encode_cstr_simple(i8* %22, i8* %23, i32 1024, i32 23)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %24)
%26 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%28 = call i8* @caesar_decode_cstr_simple(i8* %26, i8* %27, i32 1024, i32 23)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %28)
store i32 -27, i32* %9
br label %30
30: ; preds = %40, %0
%31 = load i32, i32* %9
%32 = icmp sle i32 %31, 27
br i1 %32, label %33, label %43
33: ; preds = %30
%34 = load i32, i32* %9
%35 = load i8*, i8** %7
%36 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%37 = load i32, i32* %9
%38 = call i8* @caesar_decode_cstr_simple(i8* %35, i8* %36, i32 1024, i32 %37)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 %34, i8* %38)
br label %40
40: ; preds = %33
%41 = load i32, i32* %9
%42 = add nsw i32 %41, 1
store i32 %42, i32* %9
br label %30
43: ; preds = %30
%44 = load i8*, i8** %8
%45 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%46 = call i8* @caesar_encode_cstr_simple(i8* %44, i8* %45, i32 1024, i32 3)
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %46)
%48 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%49 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%50 = call i8* @caesar_decode_cstr_simple(i8* %48, i8* %49, i32 1024, i32 3)
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %50)
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZ\00"
@.str.1 = [44 x i8] c"THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG\00"
@.str.2 = [14 x i8] c"Hello, world!\00"
@.str.3 = [13 x i8] c"exxegoexsrgi\00"
@.str.4 = [23 x i8] c"bob, i love you. alice\00"
@.str.5 = [13 x i8] c"Cipher: %s.\0A\00"
@.str.6 = [12 x i8] c"Plain: %s.\0A\00"
@.str.7 = [12 x i8] c"[%03d] %s.\0A\00"
define i32 @main() {
%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 = call i8* @caesar_encode_cstr_simple(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %4, i32 1024, i32 23)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %5)
%7 = call i8* @caesar_encode_cstr_simple(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i8* %4, i32 1024, i32 23)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %7)
%9 = call i8* @caesar_decode_cstr_simple(i8* %4, i8* %3, i32 1024, i32 23)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %9)
%11 = call i8* @caesar_encode_cstr_simple(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %4, i32 1024, i32 23)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %11)
%13 = call i8* @caesar_decode_cstr_simple(i8* %4, i8* %3, i32 1024, i32 23)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %13)
br label %15
15: ; preds = %0, %15
%16 = phi i32 [ -27, %0 ], [ %19, %15 ]
%17 = call i8* @caesar_decode_cstr_simple(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %3, i32 1024, i32 %16)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 %16, i8* %17)
%19 = add nsw i32 %16, 1
%20 = icmp eq i32 %19, 28
br i1 %20, label %21, label %15
21: ; preds = %15
%22 = call i8* @caesar_encode_cstr_simple(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %4, i32 1024, i32 3)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %22)
%24 = call i8* @caesar_decode_cstr_simple(i8* %4, i8* %3, i32 1024, i32 3)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %24)
ret i32 0
}