#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 atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ printf(char *, ...);
int rotate(int, char);
int /*<<< orphan*/ stderr;
int strlen(char *);
int main(int argc, char *argv[]) {
  if (argc == 1) {
    fprintf(
        stderr,
        "%s: program expected at least 1 argument, but instead received %d\n",
        argv[0], argc - 1);
    exit(EXIT_FAILURE);
  } else if (argc == 2) {
    fprintf(stderr,
            "%s: program expected an integer for rot value as 1st argument and "
            "at least 1 other argument, but instead received %d\n",
            argv[0], argc - 1);
    exit(EXIT_FAILURE);
  } else {
    int rot = atoi(argv[1]);
    printf("Rot = %d \n", rot);
    for (int numArgs = 1; numArgs < argc; numArgs++) {
      int length = strlen(argv[numArgs]);
      for (int i = 0; i < length; i++) {
        printf(
            "Index = %d	Original Char = %c		ROT Char = %c \n", i,
            argv[numArgs][i], rotate(rot, argv[numArgs][i]));
      }
      printf("\n");
    }
  }
  exit(EXIT_SUCCESS);
  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)
cmpl   $0x1,-0x8(%rbp)
jne    11b0 <main+0x50>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
lea    0xe63(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e2f(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
cmpl   $0x2,-0x8(%rbp)
jne    11ea <main+0x8a>
mov    0x2e1f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
lea    0xe6c(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2df5(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12be <main+0x15e>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    12a2 <main+0x142>
mov    -0x20(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
call   1060 <rotate@plt>
mov    -0x28(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    %eax,%ecx
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1239 <main+0xd9>
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1212 <main+0xb2>
jmp    12c3 <main+0x163>
jmp    12c8 <main+0x168>
mov    0x2d01(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
cmp    $0x2,%edi
je     11a2 <main+0x32>
mov    %edi,%r14d
cmp    $0x1,%edi
jne    11cd <main+0x5d>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%rdx
lea    0xe62(%rip),%rsi
xor    %ecx,%ecx
jmp    11ba <main+0x4a>
mov    0x2e37(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%rdx
lea    0xe8e(%rip),%rsi
mov    $0x1,%ecx
call   1060 <fprintf@plt>
mov    0x2e12(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
mov    0x8(%r15),%rdi
call   1080 <atoi@plt>
mov    %eax,%r12d
lea    0xed9(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x2,%r14d
jl     1261 <main+0xf1>
mov    %r14d,%eax
mov    %rax,(%rsp)
mov    $0x1,%r13d
jmp    1214 <main+0xa4>
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13
cmp    (%rsp),%r13
je     1261 <main+0xf1>
mov    (%r15,%r13,8),%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1200 <main+0x90>
mov    %eax,%r14d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    (%r15,%r13,8),%rax
movsbl (%rax,%rbx,1),%ebp
mov    %r12d,%edi
mov    %ebp,%esi
call   1070 <rotate@plt>
lea    0xe7b(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1230 <main+0xc0>
jmp    1200 <main+0x90>
mov    0x2d68(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [67 x i8] c"%s: program expected at least 1 argument, but instead received %d\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [118 x i8] c"%s: program expected an integer for rot value as 1st argument and at least 1 other argument, but instead received %d\0A\00"
@.str.2 = [11 x i8] c"Rot = %d \0A\00"
@.str.3 = [47 x i8] c"Index = %d\09Original Char = %c\09\09ROT Char = %c \0A\00"
@.str.4 = [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
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %22
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = load i32, i32* %4
%18 = sub nsw i32 %17, 1
%19 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0), i8* %16, i32 %18)
%20 = load i32, i32* @EXIT_FAILURE
%21 = call i32 @exit(i32 %20)
unreachable
22: ; preds = %2
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 2
br i1 %24, label %25, label %35
25: ; preds = %22
%26 = load i32, i32* @stderr
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 0
%29 = load i8*, i8** %28
%30 = load i32, i32* %4
%31 = sub nsw i32 %30, 1
%32 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([118 x i8], [118 x i8]* @.str.1, i64 0, i64 0), i8* %29, i32 %31)
%33 = load i32, i32* @EXIT_FAILURE
%34 = call i32 @exit(i32 %33)
unreachable
35: ; preds = %22
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = call i32 @atoi(i8* %38)
store i32 %39, i32* %6
%40 = load i32, i32* %6
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %40)
store i32 1, i32* %7
br label %42
42: ; preds = %86, %35
%43 = load i32, i32* %7
%44 = load i32, i32* %4
%45 = icmp slt i32 %43, %44
br i1 %45, label %46, label %89
46: ; preds = %42
%47 = load i8**, i8*** %5
%48 = load i32, i32* %7
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8*, i8** %47, i64 %49
%51 = load i8*, i8** %50
%52 = call i32 @strlen(i8* %51)
store i32 %52, i32* %8
store i32 0, i32* %9
br label %53
53: ; preds = %81, %46
%54 = load i32, i32* %9
%55 = load i32, i32* %8
%56 = icmp slt i32 %54, %55
br i1 %56, label %57, label %84
57: ; preds = %53
%58 = load i32, i32* %9
%59 = load i8**, i8*** %5
%60 = load i32, i32* %7
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8*, i8** %59, i64 %61
%63 = load i8*, i8** %62
%64 = load i32, i32* %9
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i8, i8* %63, i64 %65
%67 = load i8, i8* %66
%68 = sext i8 %67 to i32
%69 = load i32, i32* %6
%70 = load i8**, i8*** %5
%71 = load i32, i32* %7
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i8*, i8** %70, i64 %72
%74 = load i8*, i8** %73
%75 = load i32, i32* %9
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i8, i8* %74, i64 %76
%78 = load i8, i8* %77
%79 = call i32 @rotate(i32 %69, i8 signext %78)
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i32 %58, i32 %68, i32 %79)
br label %81
81: ; preds = %57
%82 = load i32, i32* %9
%83 = add nsw i32 %82, 1
store i32 %83, i32* %9
br label %53
84: ; preds = %53
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %86
86: ; preds = %84
%87 = load i32, i32* %7
%88 = add nsw i32 %87, 1
store i32 %88, i32* %7
br label %42
89: ; preds = %42
br label %90
90: ; preds = %89
br label %91
91: ; preds = %90
%92 = load i32, i32* @EXIT_SUCCESS
%93 = call i32 @exit(i32 %92)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [67 x i8] c"%s: program expected at least 1 argument, but instead received %d\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [118 x i8] c"%s: program expected an integer for rot value as 1st argument and at least 1 other argument, but instead received %d\0A\00"
@.str.2 = [11 x i8] c"Rot = %d \0A\00"
@.str.3 = [47 x i8] c"Index = %d\09Original Char = %c\09\09ROT Char = %c \0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %15 [
i32 1, label %3
i32 2, label %9
]
3: ; preds = %2
%4 = load i32, i32* @stderr
%5 = load i8*, i8** %1
%6 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0), i8* %5, i32 0)
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i8*, i8** %1
%12 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([118 x i8], [118 x i8]* @.str.1, i64 0, i64 0), i8* %11, i32 1)
%13 = load i32, i32* @EXIT_FAILURE
%14 = tail call i32 @exit(i32 %13)
unreachable
15: ; preds = %2
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = load i8*, i8** %16
%18 = tail call i32 @atoi(i8* %17)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%20 = icmp sgt i32 %0, 1
br i1 %20, label %21, label %23
21: ; preds = %15
%22 = zext i32 %0 to i64
br label %26
23: ; preds = %34, %15
%24 = load i32, i32* @EXIT_SUCCESS
%25 = tail call i32 @exit(i32 %24)
unreachable
26: ; preds = %21, %34
%27 = phi i64 [ 1, %21 ], [ %36, %34 ]
%28 = getelementptr inbounds i8*, i8** %1, i64 %27
%29 = load i8*, i8** %28
%30 = tail call i32 @strlen(i8* %29)
%31 = icmp sgt i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %26
%33 = zext i32 %30 to i64
br label %38
34: ; preds = %38, %26
%35 = tail call i32 @putchar(i32 10)
%36 = add nuw nsw i64 %27, 1
%37 = icmp eq i64 %36, %22
br i1 %37, label %23, label %26
38: ; preds = %32, %38
%39 = phi i64 [ 0, %32 ], [ %47, %38 ]
%40 = load i8*, i8** %28
%41 = getelementptr inbounds i8, i8* %40, i64 %39
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = tail call i32 @rotate(i32 %18, i8 signext %42)
%45 = trunc i64 %39 to i32
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i32 %45, i32 %43, i32 %44)
%47 = add nuw nsw i64 %39, 1
%48 = icmp eq i64 %47, %33
br i1 %48, label %34, label %38
}