#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 */
char caesar_cyph(char);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, char);
scalar_t__ read(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stdout;
int strlen(char *);
int main(int argc, char **argv) {
  if (argc > 1) {
    char *instr = argv[argc - 1];
    int islen = strlen(instr);
    int i;
    for (i = 0; i < islen; i++)
      instr[i] = caesar_cyph(instr[i]);
    fprintf(stdout, "%s", instr);
  } else if (argc == 1) {
    char inchr;
    while (read(0, &inchr, 1)) {
      inchr = caesar_cyph(inchr);
      printf("%c", inchr);
    }
  }
  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)
jle    11ee <main+0x9e>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11d0 <main+0x80>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1070 <caesar_cyph@plt>
mov    %al,%dl
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1198 <main+0x48>
mov    0x2e09(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xe1c(%rip),%rsi
call   1060 <fprintf@plt>
jmp    1242 <main+0xf2>
cmpl   $0x1,-0x8(%rbp)
jne    123d <main+0xed>
jmp    11fd <main+0xad>
xor    %edi,%edi
lea    -0x21(%rbp),%rsi
mov    $0x1,%edx
call   1050 <read@plt>
cmp    $0x0,%rax
je     1238 <main+0xe8>
movsbl -0x21(%rbp),%edi
call   1070 <caesar_cyph@plt>
mov    %al,-0x21(%rbp)
lea    0xdd9(%rip),%rdi
movsbl -0x21(%rbp),%esi
call   1040 <printf@plt>
jmp    11fd <main+0xad>
jmp    123d <main+0xed>
jmp    1242 <main+0xf2>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
cmp    $0x2,%edi
jl     11b1 <main+0x61>
add    $0xffffffff,%edi
mov    (%rsi,%rdi,8),%r15
mov    %r15,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    1197 <main+0x47>
mov    %eax,%r14d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movsbl (%r15,%rbx,1),%edi
call   1070 <caesar_cyph@plt>
mov    %al,(%r15,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1180 <main+0x30>
mov    0x2e42(%rip),%rax
mov    (%rax),%edi
lea    0xe59(%rip),%rsi
mov    %r15,%rdx
call   1060 <fprintf@plt>
jmp    120d <main+0xbd>
cmp    $0x1,%edi
jne    120d <main+0xbd>
lea    0xf(%rsp),%rsi
xor    %edi,%edi
mov    $0x1,%edx
call   1050 <read@plt>
test   %rax,%rax
je     120d <main+0xbd>
lea    0xe30(%rip),%r14
lea    0xf(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
movsbl 0xf(%rsp),%edi
call   1070 <caesar_cyph@plt>
mov    %al,0xf(%rsp)
movsbl %al,%esi
mov    %r14,%rdi
call   1040 <printf@plt>
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1050 <read@plt>
test   %rax,%rax
jne    11e0 <main+0x90>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"%c\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp sgt i32 %10, 1
br i1 %11, label %12, label %43
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = load i32, i32* %4
%15 = sub nsw i32 %14, 1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8*, i8** %13, i64 %16
%18 = load i8*, i8** %17
store i8* %18, i8** %6
%19 = load i8*, i8** %6
%20 = call i32 @strlen(i8* %19)
store i32 %20, i32* %7
store i32 0, i32* %8
br label %21
21: ; preds = %36, %12
%22 = load i32, i32* %8
%23 = load i32, i32* %7
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %39
25: ; preds = %21
%26 = load i8*, i8** %6
%27 = load i32, i32* %8
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %26, i64 %28
%30 = load i8, i8* %29
%31 = call signext i8 @caesar_cyph(i8 signext %30)
%32 = load i8*, i8** %6
%33 = load i32, i32* %8
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %32, i64 %34
store i8 %31, i8* %35
br label %36
36: ; preds = %25
%37 = load i32, i32* %8
%38 = add nsw i32 %37, 1
store i32 %38, i32* %8
br label %21
39: ; preds = %21
%40 = load i32, i32* @stdout
%41 = load i8*, i8** %6
%42 = call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %41)
br label %57
43: ; preds = %2
%44 = load i32, i32* %4
%45 = icmp eq i32 %44, 1
br i1 %45, label %46, label %56
46: ; preds = %43
br label %47
47: ; preds = %50, %46
%48 = call i64 @read(i32 0, i8* %9, i32 1)
%49 = icmp ne i64 %48, 0
br i1 %49, label %50, label %55
50: ; preds = %47
%51 = load i8, i8* %9
%52 = call signext i8 @caesar_cyph(i8 signext %51)
store i8 %52, i8* %9
%53 = load i8, i8* %9
%54 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %53)
br label %47
55: ; preds = %47
br label %56
56: ; preds = %55, %43
br label %57
57: ; preds = %56, %39
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"%c\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %24
5: ; preds = %2
%6 = add nsw i32 %0, -1
%7 = zext i32 %6 to i64
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i32 @strlen(i8* %9)
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %21
12: ; preds = %5
%13 = zext i32 %10 to i64
br label %14
14: ; preds = %12, %14
%15 = phi i64 [ 0, %12 ], [ %19, %14 ]
%16 = getelementptr inbounds i8, i8* %9, i64 %15
%17 = load i8, i8* %16
%18 = tail call signext i8 @caesar_cyph(i8 signext %17)
store i8 %18, i8* %16
%19 = add nuw nsw i64 %15, 1
%20 = icmp eq i64 %19, %13
br i1 %20, label %21, label %14
21: ; preds = %14, %5
%22 = load i32, i32* @stdout
%23 = tail call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %36
24: ; preds = %2
%25 = icmp eq i32 %0, 1
br i1 %25, label %26, label %36
26: ; preds = %24
%27 = call i64 @read(i32 0, i8* %3, i32 1)
%28 = icmp eq i64 %27, 0
br i1 %28, label %35, label %29
29: ; preds = %26, %29
%30 = load i8, i8* %3
%31 = tail call signext i8 @caesar_cyph(i8 signext %30)
store i8 %31, i8* %3
%32 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %31)
%33 = call i64 @read(i32 0, i8* %3, i32 1)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %29
35: ; preds = %29, %26
br label %36
36: ; preds = %24, %35, %21
ret i32 0
}