#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 EXIT_SUCCESS;
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
scalar_t__ isalpha(char);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdin;
int main(void) {
  char buf[1024];
  do {
    for (int i = 0; buf[i]; i++) {
      if (isalpha(buf[i])) {
        if ((buf[i] >= 65 && buf[i] <= 77) || (buf[i] >= 97 && buf[i] <= 109))
          buf[i] += 13;
        else
          buf[i] -= 13;
      }
    }
    printf("%s", buf);
  } while (fgets(buf, 1024, stdin));
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x414(%rbp)
movslq -0x414(%rbp),%rax
cmpb   $0x0,-0x410(%rbp,%rax,1)
je     1234 <main+0x104>
movslq -0x414(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%edi
ff
call   1050 <isalpha@plt>
cmp    $0x0,%rax
je     121b <main+0xeb>
movslq -0x414(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%eax
ff
cmp    $0x41,%eax
jl     11af <main+0x7f>
movslq -0x414(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%eax
ff
cmp    $0x4d,%eax
jle    11df <main+0xaf>
movslq -0x414(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%eax
ff
cmp    $0x61,%eax
jl     11fd <main+0xcd>
movslq -0x414(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%eax
ff
cmp    $0x6d,%eax
jg     11fd <main+0xcd>
movslq -0x414(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%ecx
ff
add    $0xd,%ecx
mov    %cl,-0x410(%rbp,%rax,1)
jmp    1216 <main+0xe6>
movslq -0x414(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%ecx
ff
sub    $0xd,%ecx
mov    %cl,-0x410(%rbp,%rax,1)
jmp    121b <main+0xeb>
jmp    1220 <main+0xf0>
mov    -0x414(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x414(%rbp)
jmp    114c <main+0x1c>
lea    -0x410(%rbp),%rsi
lea    0xdbe(%rip),%rdi
call   1030 <printf@plt>
lea    -0x410(%rbp),%rdi
mov    0x2d93(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
jne    1142 <main+0x12>
mov    0x2d66(%rip),%rax
mov    (%rax),%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x400,%rsp
lea    0xeba(%rip),%r14
mov    %rsp,%r12
mov    0x2e98(%rip),%r15
mov    $0xd,%ebp
test   %al,%al
je     11b0 <main+0x80>
nopl   0x0(%rax)
mov    %r12,%rbx
jmp    117c <main+0x4c>
cs nopw 0x0(%rax,%rax,1)
nop
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     11b0 <main+0x80>
movsbl %al,%edi
call   1050 <isalpha@plt>
test   %rax,%rax
je     1170 <main+0x40>
movzbl (%rbx),%eax
mov    %eax,%ecx
and    $0xdf,%cl
add    $0xbf,%cl
cmp    $0xd,%cl
mov    $0xf3,%ecx
cmovb  %ebp,%ecx
add    %al,%cl
mov    %cl,(%rbx)
jmp    1170 <main+0x40>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %r12,%rsi
call   1030 <printf@plt>
mov    (%r15),%edx
mov    %r12,%rdi
mov    $0x400,%esi
call   1040 <fgets@plt>
test   %rax,%rax
je     11da <main+0xaa>
movzbl (%rsp),%eax
test   %al,%al
jne    1160 <main+0x30>
jmp    11b0 <main+0x80>
mov    0x2df7(%rip),%rax
mov    (%rax),%eax
add    $0x400,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@stdin = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %70, %0
store i32 0, i32* %3
br label %5
5: ; preds = %64, %4
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %7
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %67
11: ; preds = %5
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = call i64 @isalpha(i8 signext %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %63
18: ; preds = %11
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp sge i32 %23, 65
br i1 %24, label %25, label %32
25: ; preds = %18
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp sle i32 %30, 77
br i1 %31, label %46, label %32
32: ; preds = %25, %18
%33 = load i32, i32* %3
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp sge i32 %37, 97
br i1 %38, label %39, label %54
39: ; preds = %32
%40 = load i32, i32* %3
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp sle i32 %44, 109
br i1 %45, label %46, label %54
46: ; preds = %39, %25
%47 = load i32, i32* %3
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %48
%50 = load i8, i8* %49
%51 = sext i8 %50 to i32
%52 = add nsw i32 %51, 13
%53 = trunc i32 %52 to i8
store i8 %53, i8* %49
br label %62
54: ; preds = %39, %32
%55 = load i32, i32* %3
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %56
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = sub nsw i32 %59, 13
%61 = trunc i32 %60 to i8
store i8 %61, i8* %57
br label %62
62: ; preds = %54, %46
br label %63
63: ; preds = %62, %11
br label %64
64: ; preds = %63
%65 = load i32, i32* %3
%66 = add nsw i32 %65, 1
store i32 %66, i32* %3
br label %5
67: ; preds = %5
%68 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%69 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %68)
br label %70
70: ; preds = %67
%71 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%72 = load i32, i32* @stdin
%73 = call i64 @fgets(i8* %71, i32 1024, i32 %72)
%74 = icmp ne i64 %73, 0
br i1 %74, label %4, label %75
75: ; preds = %70
%76 = load i32, i32* @EXIT_SUCCESS
ret i32 %76
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@stdin = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %11, %0
%4 = phi i8 [ %12, %11 ], [ undef, %0 ]
%5 = icmp eq i8 %4, 0
br i1 %5, label %6, label %13
6: ; preds = %26, %3
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%8 = load i32, i32* @stdin
%9 = call i64 @fgets(i8* %2, i32 1024, i32 %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %31, label %11
11: ; preds = %6
%12 = load i8, i8* %2
br label %3
13: ; preds = %3, %26
%14 = phi i64 [ %27, %26 ], [ 0, %3 ]
%15 = phi i8 [ %29, %26 ], [ %4, %3 ]
%16 = phi i8* [ %28, %26 ], [ %2, %3 ]
%17 = call i64 @isalpha(i8 signext %15)
%18 = icmp eq i64 %17, 0
br i1 %18, label %26, label %19
19: ; preds = %13
%20 = load i8, i8* %16
%21 = and i8 %20, -33
%22 = add i8 %21, -65
%23 = icmp ult i8 %22, 13
%24 = select i1 %23, i8 13, i8 -13
%25 = add i8 %20, %24
store i8 %25, i8* %16
br label %26
26: ; preds = %19, %13
%27 = add nuw i64 %14, 1
%28 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = icmp eq i8 %29, 0
br i1 %30, label %6, label %13
31: ; preds = %6
%32 = load i32, i32* @EXIT_SUCCESS
ret i32 %32
}