#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*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ printf(char *, ...);
int rotate(char);
int /*<<< orphan*/ stderr;
int strlen(char *);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    fprintf(stderr,
            "%s: program expected 1 argument, but instead received %d\n",
            argv[0], argc - 1);
    exit(EXIT_FAILURE);
  } else {
    int length = strlen(argv[1]);
    for (int i = 0; i < length; i++) {
      printf("%c", rotate(argv[1][i]));
    }
    printf("\n");
    exit(EXIT_SUCCESS);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11a0 <main+0x50>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
lea    0xe73(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e3f(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11f6 <main+0xa6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1060 <rotate@plt>
mov    %eax,%esi
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11b7 <main+0x67>
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2dc5(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
cmp    $0x2,%edi
jne    11a5 <main+0x55>
mov    0x8(%r14),%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    118d <main+0x3d>
mov    %eax,%r15d
xor    %ebx,%ebx
nop
mov    0x8(%r14),%rax
movsbl (%rax,%rbx,1),%edi
call   1060 <rotate@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1170 <main+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2e32(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    %edi,%ecx
mov    0x2e32(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
add    $0xffffffff,%ecx
lea    0xe43(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e0f(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [58 x i8] c"%s: program expected 1 argument, but instead received %d\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [2 x i8] c"\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %20
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = load i32, i32* %4
%16 = sub nsw i32 %15, 1
%17 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i8* %14, i32 %16)
%18 = load i32, i32* @EXIT_FAILURE
%19 = call i32 @exit(i32 %18)
unreachable
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @strlen(i8* %23)
store i32 %24, i32* %6
store i32 0, i32* %7
br label %25
25: ; preds = %39, %20
%26 = load i32, i32* %7
%27 = load i32, i32* %6
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %42
29: ; preds = %25
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = load i32, i32* %7
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %32, i64 %34
%36 = load i8, i8* %35
%37 = call i32 @rotate(i8 signext %36)
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %37)
br label %39
39: ; preds = %29
%40 = load i32, i32* %7
%41 = add nsw i32 %40, 1
store i32 %41, i32* %7
br label %25
42: ; preds = %25
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%44 = load i32, i32* @EXIT_SUCCESS
%45 = call i32 @exit(i32 %44)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [58 x i8] c"%s: program expected 1 argument, but instead received %d\0A\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %11, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = add nsw i32 %0, -1
%8 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i8* %6, i32 %7)
%9 = load i32, i32* @EXIT_FAILURE
%10 = tail call i32 @exit(i32 %9)
unreachable
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32 @strlen(i8* %13)
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = zext i32 %14 to i64
br label %22
18: ; preds = %22, %11
%19 = tail call i32 @putchar(i32 10)
%20 = load i32, i32* @EXIT_SUCCESS
%21 = tail call i32 @exit(i32 %20)
unreachable
22: ; preds = %16, %22
%23 = phi i64 [ 0, %16 ], [ %29, %22 ]
%24 = load i8*, i8** %12
%25 = getelementptr inbounds i8, i8* %24, i64 %23
%26 = load i8, i8* %25
%27 = tail call i32 @rotate(i8 signext %26)
%28 = tail call i32 @putchar(i32 %27)
%29 = add nuw nsw i64 %23, 1
%30 = icmp eq i64 %29, %17
br i1 %30, label %18, label %22
}