#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*/ getchar();
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, char *);
void rot13() {
  int i;
  char string[100];
  scanf("%s", string);
  getchar();
  for (i = 0; string[i] != '\0'; i++) {
    if ('z' - string[i] >= 13) {
      string[i] = string[i] + 13;
    } else {
      string[i] = string[i] - 13;
    }
  }
  printf("%s\n", string);
}


x86 assembly (clang, -O0):
<rot13>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    -0x70(%rbp),%rsi
lea    0xebd(%rip),%rdi
call   1050 <scanf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
movl   $0x0,-0x4(%rbp)
movslq -0x4(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11c5 <rot13+0x95>
movslq -0x4(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%ecx
mov    $0x7a,%eax
sub    %ecx,%eax
cmp    $0xd,%eax
jl     119c <rot13+0x6c>
movslq -0x4(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
add    $0xd,%eax
mov    %al,%cl
movslq -0x4(%rbp),%rax
mov    %cl,-0x70(%rbp,%rax,1)
jmp    11b2 <rot13+0x82>
movslq -0x4(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
sub    $0xd,%eax
mov    %al,%cl
movslq -0x4(%rbp),%rax
mov    %cl,-0x70(%rbp,%rax,1)
jmp    11b7 <rot13+0x87>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1156 <rot13+0x26>
lea    -0x70(%rbp),%rsi
lea    0xe33(%rip),%rdi
call   1030 <printf@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rot13>:
sub    $0x68,%rsp
lea    0xec5(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    (%rsp),%al
test   %al,%al
je     117c <rot13+0x4c>
lea    0x1(%rsp),%rcx
mov    $0xd,%edx
nopl   0x0(%rax,%rax,1)
cmp    $0x6e,%al
mov    $0xf3,%esi
cmovl  %edx,%esi
add    %al,%sil
mov    %sil,-0x1(%rcx)
movzbl (%rcx),%eax
add    $0x1,%rcx
test   %al,%al
jne    1160 <rot13+0x30>
lea    0xe80(%rip),%rdi
mov    %rsp,%rsi
call   1030 <printf@plt>
add    $0x68,%rsp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @rot13() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (...) @getchar()
store i32 0, i32* %1
br label %6
6: ; preds = %44, %0
%7 = load i32, i32* %1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %47
13: ; preds = %6
%14 = load i32, i32* %1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = sub nsw i32 122, %18
%20 = icmp sge i32 %19, 13
br i1 %20, label %21, label %32
21: ; preds = %13
%22 = load i32, i32* %1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = add nsw i32 %26, 13
%28 = trunc i32 %27 to i8
%29 = load i32, i32* %1
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %30
store i8 %28, i8* %31
br label %43
32: ; preds = %13
%33 = load i32, i32* %1
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = sub nsw i32 %37, 13
%39 = trunc i32 %38 to i8
%40 = load i32, i32* %1
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %41
store i8 %39, i8* %42
br label %43
43: ; preds = %32, %21
br label %44
44: ; preds = %43
%45 = load i32, i32* %1
%46 = add nsw i32 %45, 1
store i32 %46, i32* %1
br label %6
47: ; preds = %6
%48 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%49 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %48)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @rot13() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 (...) @getchar()
%5 = load i8, i8* %2
%6 = icmp eq i8 %5, 0
br i1 %6, label %18, label %7
7: ; preds = %0, %7
%8 = phi i64 [ %14, %7 ], [ 0, %0 ]
%9 = phi i8 [ %16, %7 ], [ %5, %0 ]
%10 = phi i8* [ %15, %7 ], [ %2, %0 ]
%11 = icmp slt i8 %9, 110
%12 = select i1 %11, i8 13, i8 -13
%13 = add i8 %12, %9
store i8 %13, i8* %10
%14 = add nuw nsw i64 %8, 1
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %7
18: ; preds = %7, %0
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret void
}