#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*/ printf(char *, char *);
int /*<<< orphan*/ rot(char *, char **, int);
size_t strlen(char *);
int main() {
  char *test = "HELLO WORLD. This is a test";
  char out[strlen(test)];
  out[strlen(test)] = '\0';
  rot(test, &out, 13);
  printf("Input: %s\n", test);
  printf("Output: %s", out);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rdx
mov    %rdx,%rax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rsi
movb   $0x0,(%rsi,%rax,1)
mov    -0x10(%rbp),%rdi
mov    $0xd,%edx
call   1050 <rot@plt>
mov    -0x10(%rbp),%rsi
lea    0xe79(%rip),%rdi
call   1040 <printf@plt>
mov    -0x28(%rbp),%rsi
lea    0xe74(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movb   $0x0,0x1b(%rsp)
lea    0xecd(%rip),%rbx
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0xd,%edx
call   1040 <rot@plt>
lea    0xecf(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [28 x i8] c"HELLO WORLD. This is a test\00"
@.str.1 = [11 x i8] c"Input: %s\0A\00"
@.str.2 = [11 x i8] c"Output: %s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
store i32 0, i32* %1
store i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @strlen(i8* %5)
%7 = call i8* @llvm.stacksave()
store i8* %7, i8** %3
%8 = alloca i8, i64 %6
store i64 %6, i64* %4
%9 = load i8*, i8** %2
%10 = call i64 @strlen(i8* %9)
%11 = getelementptr inbounds i8, i8* %8, i64 %10
store i8 0, i8* %11
%12 = load i8*, i8** %2
%13 = bitcast i8* %8 to i8**
%14 = call i32 @rot(i8* %12, i8** %13, i32 13)
%15 = load i8*, i8** %2
%16 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %8)
store i32 0, i32* %1
%18 = load i8*, i8** %3
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
@.str = [28 x i8] c"HELLO WORLD. This is a test\00"
@.str.1 = [11 x i8] c"Input: %s\0A\00"
@.str.2 = [11 x i8] c"Output: %s\00"
define i32 @main() {
%1 = alloca [27 x i8]
%2 = getelementptr inbounds [27 x i8], [27 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds [27 x i8], [27 x i8]* %1, i64 0, i64 27
store i8 0, i8* %3
%4 = bitcast [27 x i8]* %1 to i8**
%5 = call i32 @rot(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8** %4, i32 13)
%6 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %2)
ret i32 0
}