#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 EOF;
char fgetc(int /*<<< orphan*/);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/);
scalar_t__ isalpha(char);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
char toupper(char);
int main(void) {
  char ch;
  while ((ch = fgetc(stdin)) != EOF) {
    if (isalpha(ch)) {
      if (toupper(ch) >= 'A' && toupper(ch) <= 'M')
        ch += 13;
      else
        ch -= 13;
    }
    fputc(ch, stdout);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
call   1040 <fgetc@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2e76(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11e9 <main+0xa9>
movsbl -0x5(%rbp),%edi
call   1060 <isalpha@plt>
cmp    $0x0,%rax
je     11d0 <main+0x90>
movsbl -0x5(%rbp),%edi
call   1030 <toupper@plt>
movsbl %al,%eax
cmp    $0x41,%eax
jl     11c1 <main+0x81>
movsbl -0x5(%rbp),%edi
call   1030 <toupper@plt>
movsbl %al,%eax
cmp    $0x4d,%eax
jg     11c1 <main+0x81>
movsbl -0x5(%rbp),%eax
add    $0xd,%eax
mov    %al,-0x5(%rbp)
jmp    11cb <main+0x8b>
movsbl -0x5(%rbp),%eax
sub    $0xd,%eax
mov    %al,-0x5(%rbp)
jmp    11d0 <main+0x90>
mov    -0x5(%rbp),%al
mov    0x2df6(%rip),%rcx
mov    (%rcx),%esi
movsbl %al,%edi
call   1050 <fputc@plt>
jmp    114f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    0x2e99(%rip),%r14
mov    (%r14),%edi
call   1040 <fgetc@plt>
mov    0x2e82(%rip),%r15
cmp    (%r15),%al
jne    116e <main+0x2e>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebx
mov    0x2e59(%rip),%r12
jmp    119e <main+0x5e>
nopl   0x0(%rax)
add    $0xf3,%bl
mov    (%r12),%esi
movsbl %bl,%edi
call   1050 <fputc@plt>
mov    (%r14),%edi
call   1040 <fgetc@plt>
mov    %eax,%ebx
cmp    (%r15),%al
je     1163 <main+0x23>
movsbl %bl,%ebp
mov    %ebp,%edi
call   1060 <isalpha@plt>
test   %rax,%rax
je     1183 <main+0x43>
mov    %ebp,%edi
call   1030 <toupper@plt>
cmp    $0x41,%al
jl     1180 <main+0x40>
mov    %ebp,%edi
call   1030 <toupper@plt>
cmp    $0x4d,%al
jg     1180 <main+0x40>
add    $0xd,%bl
jmp    1183 <main+0x43>

LLVM IR (-O0):
@stdin = global i32 0
@EOF = global i8 0
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
br label %3
3: ; preds = %35, %0
%4 = load i32, i32* @stdin
%5 = call signext i8 @fgetc(i32 %4)
store i8 %5, i8* %2
%6 = sext i8 %5 to i32
%7 = load i8, i8* @EOF
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %6, %8
br i1 %9, label %10, label %39
10: ; preds = %3
%11 = load i8, i8* %2
%12 = call i64 @isalpha(i8 signext %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %35
14: ; preds = %10
%15 = load i8, i8* %2
%16 = call signext i8 @toupper(i8 signext %15)
%17 = sext i8 %16 to i32
%18 = icmp sge i32 %17, 65
br i1 %18, label %19, label %29
19: ; preds = %14
%20 = load i8, i8* %2
%21 = call signext i8 @toupper(i8 signext %20)
%22 = sext i8 %21 to i32
%23 = icmp sle i32 %22, 77
br i1 %23, label %24, label %29
24: ; preds = %19
%25 = load i8, i8* %2
%26 = sext i8 %25 to i32
%27 = add nsw i32 %26, 13
%28 = trunc i32 %27 to i8
store i8 %28, i8* %2
br label %34
29: ; preds = %19, %14
%30 = load i8, i8* %2
%31 = sext i8 %30 to i32
%32 = sub nsw i32 %31, 13
%33 = trunc i32 %32 to i8
store i8 %33, i8* %2
br label %34
34: ; preds = %29, %24
br label %35
35: ; preds = %34, %10
%36 = load i8, i8* %2
%37 = load i32, i32* @stdout
%38 = call i32 @fputc(i8 signext %36, i32 %37)
br label %3
39: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@EOF = global i8 0
@stdout = global i32 0
define i32 @main() {
%1 = load i32, i32* @stdin
%2 = tail call signext i8 @fgetc(i32 %1)
%3 = load i8, i8* @EOF
%4 = icmp eq i8 %2, %3
br i1 %4, label %27, label %5
5: ; preds = %0, %19
%6 = phi i8 [ %24, %19 ], [ %2, %0 ]
%7 = tail call i64 @isalpha(i8 signext %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %19, label %9
9: ; preds = %5
%10 = tail call signext i8 @toupper(i8 signext %6)
%11 = icmp sgt i8 %10, 64
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = tail call signext i8 @toupper(i8 signext %6)
%14 = icmp slt i8 %13, 78
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = add i8 %6, 13
br label %19
17: ; preds = %12, %9
%18 = add i8 %6, -13
br label %19
19: ; preds = %15, %17, %5
%20 = phi i8 [ %16, %15 ], [ %18, %17 ], [ %6, %5 ]
%21 = load i32, i32* @stdout
%22 = tail call i32 @fputc(i8 signext %20, i32 %21)
%23 = load i32, i32* @stdin
%24 = tail call signext i8 @fgetc(i32 %23)
%25 = load i8, i8* @EOF
%26 = icmp eq i8 %24, %25
br i1 %26, label %27, label %5
27: ; preds = %19, %0
ret i32 0
}