#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(int);
scalar_t__ isalpha(char);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(char);
unsigned int strlen(char *);
int strtol(char *, int /*<<< orphan*/ *, int);
int main(int argc, char **argv) {
  if (argc != 3) {
    printf("Incorrect number of arguments.\n");
    exit(1);
  }
  int rot = strtol(argv[2], NULL, 10);
  unsigned length = strlen(argv[1]);
  for (unsigned i = 0; i < length; i++) {
    if (isalpha(argv[1][i])) {
      if (argv[1][i] - 'A' < 26)
        putchar((argv[1][i] - 'A' + rot) % 26 + 'A');
      else
        putchar((argv[1][i] - 'a' + rot) % 26 + 'a');
    } else
      putchar(argv[1][i]);
  }
  putchar('\n');
  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   $0x3,-0x8(%rbp)
je     1196 <main+0x36>
lea    0xe79(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jae    1290 <main+0x130>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x1c(%rbp),%ecx
movsbl (%rax,%rcx,1),%edi
call   1070 <isalpha@plt>
cmp    $0x0,%rax
je     1269 <main+0x109>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x1c(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
sub    $0x41,%eax
cmp    $0x1a,%eax
jge    123a <main+0xda>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x1c(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
sub    $0x41,%eax
add    -0x14(%rbp),%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
add    $0x41,%edx
mov    %dl,%al
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    1264 <main+0x104>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x1c(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
sub    $0x61,%eax
add    -0x14(%rbp),%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
add    $0x61,%edx
mov    %dl,%al
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    127d <main+0x11d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x1c(%rbp),%ecx
movsbl (%rax,%rcx,1),%edi
call   1030 <putchar@plt>
jmp    1282 <main+0x122>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11c6 <main+0x66>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    $0x3,%edi
jne    1241 <main+0xe1>
mov    %rsi,%r12
mov    0x10(%rsi),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %eax,%r14d
mov    0x8(%r12),%rdi
call   1050 <strlen@plt>
test   %eax,%eax
je     1229 <main+0xc9>
mov    %eax,%r15d
xor    %ebx,%ebx
jmp    11d8 <main+0x78>
add    $0xffffff9f,%eax
movslq %eax,%rcx
imul   $0x4ec4ec4f,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rax
add    %edx,%eax
lea    (%rax,%rax,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %eax,%edx
sub    %edx,%ecx
add    $0x61,%cl
movsbl %cl,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
je     1229 <main+0xc9>
mov    0x8(%r12),%rax
movsbl (%rax,%rbx,1),%edi
call   1070 <isalpha@plt>
mov    0x8(%r12),%rcx
movzbl (%rcx,%rbx,1),%ecx
test   %rax,%rax
je     11c7 <main+0x67>
movsbl %cl,%ecx
lea    (%r14,%rcx,1),%eax
cmp    $0x5a,%cl
jg     11a0 <main+0x40>
add    $0xffffffbf,%eax
movslq %eax,%rcx
imul   $0x4ec4ec4f,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rax
add    %edx,%eax
lea    (%rax,%rax,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %eax,%edx
sub    %edx,%ecx
add    $0x41,%cl
jmp    11c7 <main+0x67>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xdb8(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"Incorrect number of arguments.\0A\00"
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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 3
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 2
%17 = load i8*, i8** %16
%18 = call i32 @strtol(i8* %17, i32* null, i32 10)
store i32 %18, i32* %6
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @strlen(i8* %21)
store i32 %22, i32* %7
store i32 0, i32* %8
br label %23
23: ; preds = %91, %14
%24 = load i32, i32* %8
%25 = load i32, i32* %7
%26 = icmp ult i32 %24, %25
br i1 %26, label %27, label %94
27: ; preds = %23
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = load i32, i32* %8
%32 = zext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
%34 = load i8, i8* %33
%35 = call i64 @isalpha(i8 signext %34)
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %81
37: ; preds = %27
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 1
%40 = load i8*, i8** %39
%41 = load i32, i32* %8
%42 = zext i32 %41 to i64
%43 = getelementptr inbounds i8, i8* %40, i64 %42
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = sub nsw i32 %45, 65
%47 = icmp slt i32 %46, 26
br i1 %47, label %48, label %64
48: ; preds = %37
%49 = load i8**, i8*** %5
%50 = getelementptr inbounds i8*, i8** %49, i64 1
%51 = load i8*, i8** %50
%52 = load i32, i32* %8
%53 = zext i32 %52 to i64
%54 = getelementptr inbounds i8, i8* %51, i64 %53
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = sub nsw i32 %56, 65
%58 = load i32, i32* %6
%59 = add nsw i32 %57, %58
%60 = srem i32 %59, 26
%61 = add nsw i32 %60, 65
%62 = trunc i32 %61 to i8
%63 = call i32 @putchar(i8 signext %62)
br label %80
64: ; preds = %37
%65 = load i8**, i8*** %5
%66 = getelementptr inbounds i8*, i8** %65, i64 1
%67 = load i8*, i8** %66
%68 = load i32, i32* %8
%69 = zext i32 %68 to i64
%70 = getelementptr inbounds i8, i8* %67, i64 %69
%71 = load i8, i8* %70
%72 = sext i8 %71 to i32
%73 = sub nsw i32 %72, 97
%74 = load i32, i32* %6
%75 = add nsw i32 %73, %74
%76 = srem i32 %75, 26
%77 = add nsw i32 %76, 97
%78 = trunc i32 %77 to i8
%79 = call i32 @putchar(i8 signext %78)
br label %80
80: ; preds = %64, %48
br label %90
81: ; preds = %27
%82 = load i8**, i8*** %5
%83 = getelementptr inbounds i8*, i8** %82, i64 1
%84 = load i8*, i8** %83
%85 = load i32, i32* %8
%86 = zext i32 %85 to i64
%87 = getelementptr inbounds i8, i8* %84, i64 %86
%88 = load i8, i8* %87
%89 = call i32 @putchar(i8 signext %88)
br label %90
90: ; preds = %81, %80
br label %91
91: ; preds = %90
%92 = load i32, i32* %8
%93 = add i32 %92, 1
store i32 %93, i32* %8
br label %23
94: ; preds = %23
%95 = call i32 @putchar(i8 signext 10)
ret i32 0
}

LLVM IR (-O2):
@str = [31 x i8] c"Incorrect number of arguments.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 2
%9 = load i8*, i8** %8
%10 = tail call i32 @strtol(i8* nocapture %9, i32* null, i32 10)
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @strlen(i8* %12)
%14 = icmp eq i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %7
%16 = zext i32 %13 to i64
br label %19
17: ; preds = %43, %7
%18 = tail call i32 @putchar(i8 signext 10)
ret i32 0
19: ; preds = %15, %43
%20 = phi i64 [ 0, %15 ], [ %46, %43 ]
%21 = load i8*, i8** %11
%22 = getelementptr inbounds i8, i8* %21, i64 %20
%23 = load i8, i8* %22
%24 = tail call i64 @isalpha(i8 signext %23)
%25 = icmp eq i64 %24, 0
%26 = load i8*, i8** %11
%27 = getelementptr inbounds i8, i8* %26, i64 %20
%28 = load i8, i8* %27
br i1 %25, label %43, label %29
29: ; preds = %19
%30 = sext i8 %28 to i32
%31 = icmp slt i8 %28, 91
%32 = add i32 %10, %30
br i1 %31, label %33, label %38
33: ; preds = %29
%34 = add i32 %32, -65
%35 = srem i32 %34, 26
%36 = trunc i32 %35 to i8
%37 = add nsw i8 %36, 65
br label %43
38: ; preds = %29
%39 = add i32 %32, -97
%40 = srem i32 %39, 26
%41 = trunc i32 %40 to i8
%42 = add nsw i8 %41, 97
br label %43
43: ; preds = %19, %38, %33
%44 = phi i8 [ %42, %38 ], [ %37, %33 ], [ %28, %19 ]
%45 = tail call i32 @putchar(i8 signext %44)
%46 = add nuw nsw i64 %20, 1
%47 = icmp eq i64 %46, %16
br i1 %47, label %17, label %19
}