#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 EOF;
int /*<<< orphan*/ die(char *, char *);
int getchar();
int getrot(char *);
scalar_t__ isalpha(int);
int /*<<< orphan*/ putchar(int);
int rot(int, int);
int main(int argc, char **argv) {
  int r, c;
  if (argc != 2)
    die("Usage: %s <rotation>\n", argv[0]);
  r = getrot(argv[1]);
  while (c = getchar(), c != EOF) {
    if (isalpha(c))
      putchar(rot(c, r));
    else
      putchar(c);
  }
  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     1193 <main+0x33>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe72(%rip),%rdi
call   1070 <die@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <getrot@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    0x2e31(%rip),%rcx
cmp    (%rcx),%eax
je     11f5 <main+0x95>
mov    -0x18(%rbp),%edi
call   1060 <isalpha@plt>
cmp    $0x0,%rax
je     11e8 <main+0x88>
mov    -0x18(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1080 <rot@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
jmp    11f0 <main+0x90>
mov    -0x18(%rbp),%edi
call   1030 <putchar@plt>
jmp    11a3 <main+0x43>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
je     117b <main+0x1b>
mov    (%rbx),%rsi
lea    0xe8a(%rip),%rdi
call   1070 <die@plt>
mov    0x8(%rbx),%rdi
call   1040 <getrot@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e54(%rip),%r14
cmp    (%r14),%eax
jne    11a0 <main+0x40>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %eax,%ebp
jmp    11c5 <main+0x65>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebp,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebp
cmp    (%r14),%eax
je     1199 <main+0x39>
mov    %ebp,%edi
call   1060 <isalpha@plt>
test   %rax,%rax
je     11b0 <main+0x50>
mov    %ebp,%edi
mov    %ebx,%esi
call   1080 <rot@plt>
mov    %eax,%ebp
jmp    11b0 <main+0x50>

LLVM IR (-O0):
@.str = [22 x i8] c"Usage: %s <rotation>\0A\00"
@EOF = 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 %15
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 @die(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %13)
br label %15
15: ; preds = %10, %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @getrot(i8* %18)
store i32 %19, i32* %6
br label %20
20: ; preds = %37, %15
%21 = call i32 (...) @getchar()
store i32 %21, i32* %7
%22 = load i32, i32* %7
%23 = load i32, i32* @EOF
%24 = icmp ne i32 %22, %23
br i1 %24, label %25, label %38
25: ; preds = %20
%26 = load i32, i32* %7
%27 = call i64 @isalpha(i32 %26)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %34
29: ; preds = %25
%30 = load i32, i32* %7
%31 = load i32, i32* %6
%32 = call i32 @rot(i32 %30, i32 %31)
%33 = call i32 @putchar(i32 %32)
br label %37
34: ; preds = %25
%35 = load i32, i32* %7
%36 = call i32 @putchar(i32 %35)
br label %37
37: ; preds = %34, %29
br label %20
38: ; preds = %20
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Usage: %s <rotation>\0A\00"
@EOF = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @die(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %7
7: ; preds = %4, %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @getrot(i8* %9)
%11 = tail call i32 (...) @getchar()
%12 = load i32, i32* @EOF
%13 = icmp eq i32 %11, %12
br i1 %13, label %26, label %14
14: ; preds = %7, %20
%15 = phi i32 [ %23, %20 ], [ %11, %7 ]
%16 = tail call i64 @isalpha(i32 %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %14
%19 = tail call i32 @rot(i32 %15, i32 %10)
br label %20
20: ; preds = %14, %18
%21 = phi i32 [ %19, %18 ], [ %15, %14 ]
%22 = tail call i32 @putchar(i32 %21)
%23 = tail call i32 (...) @getchar()
%24 = load i32, i32* @EOF
%25 = icmp eq i32 %23, %24
br i1 %25, label %26, label %14
26: ; preds = %20, %7
ret i32 0
}