#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 getchar();
scalar_t__ isalpha(char);
scalar_t__ islower(char);
int /*<<< orphan*/ putchar(char);
int main() {
  char c;
  int i = 0, delta = 'F' - 'A';
  while ((c = getchar()) != EOF && i++ < 512) {
    if (isalpha(c))
      islower(c) ? putchar((c + delta - 'a') % 26 + 'a')
                 : putchar((c + delta - 'A') % 26 + 'A');
    else
      putchar(c);
  }
  putchar('\n');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x5,-0x10(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%ecx
mov    0x2e77(%rip),%rax
movsbl (%rax),%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x11(%rbp)
je     1197 <main+0x57>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x200,%eax
setl   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    11a7 <main+0x67>
jmp    1223 <main+0xe3>
movsbl -0x5(%rbp),%edi
call   1060 <isalpha@plt>
cmp    $0x0,%rax
je     1215 <main+0xd5>
movsbl -0x5(%rbp),%edi
call   1040 <islower@plt>
cmp    $0x0,%rax
je     11f1 <main+0xb1>
movsbl -0x5(%rbp),%eax
add    -0x10(%rbp),%eax
sub    $0x61,%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
add    $0x61,%edx
mov    %dl,%al
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    1210 <main+0xd0>
movsbl -0x5(%rbp),%eax
add    -0x10(%rbp),%eax
sub    $0x41,%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
add    $0x41,%edx
mov    %dl,%al
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    121e <main+0xde>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
jmp    115d <main+0x1d>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e93(%rip),%r14
cmp    (%r14),%al
jne    1171 <main+0x31>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebx
mov    $0x201,%r15d
jmp    11b6 <main+0x76>
nopl   0x0(%rax,%rax,1)
add    $0xffffffa4,%ebx
imul   $0x4ec5,%ebx,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
shr    $0x13,%eax
add    %ecx,%eax
lea    (%rax,%rax,4),%ecx
lea    (%rcx,%rcx,4),%ecx
add    %eax,%ecx
sub    %ecx,%ebx
add    $0x61,%bl
movsbl %bl,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebx
cmp    (%r14),%al
je     115a <main+0x1a>
add    $0xffffffff,%r15d
je     115a <main+0x1a>
movsbl %bl,%ebp
mov    %ebp,%edi
call   1060 <isalpha@plt>
test   %rax,%rax
je     11a0 <main+0x60>
mov    %ebp,%edi
call   1040 <islower@plt>
movswl %bp,%ebx
test   %rax,%rax
jne    1180 <main+0x40>
add    $0xffffffc4,%ebx
imul   $0x4ec5,%ebx,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
shr    $0x13,%eax
add    %ecx,%eax
lea    (%rax,%rax,4),%ecx
lea    (%rcx,%rcx,4),%ecx
add    %eax,%ecx
sub    %ecx,%ebx
add    $0x41,%bl
jmp    11a0 <main+0x60>

LLVM IR (-O0):
@EOF = global i8 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 5, i32* %4
br label %5
5: ; preds = %50, %0
%6 = call signext i8 (...) @getchar()
store i8 %6, i8* %2
%7 = sext i8 %6 to i32
%8 = load i8, i8* @EOF
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %7, %9
br i1 %10, label %11, label %15
11: ; preds = %5
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
%14 = icmp slt i32 %12, 512
br label %15
15: ; preds = %11, %5
%16 = phi i1 [ false, %5 ], [ %14, %11 ]
br i1 %16, label %17, label %51
17: ; preds = %15
%18 = load i8, i8* %2
%19 = call i64 @isalpha(i8 signext %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %47
21: ; preds = %17
%22 = load i8, i8* %2
%23 = call i64 @islower(i8 signext %22)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %35
25: ; preds = %21
%26 = load i8, i8* %2
%27 = sext i8 %26 to i32
%28 = load i32, i32* %4
%29 = add nsw i32 %27, %28
%30 = sub nsw i32 %29, 97
%31 = srem i32 %30, 26
%32 = add nsw i32 %31, 97
%33 = trunc i32 %32 to i8
%34 = call i32 @putchar(i8 signext %33)
br label %45
35: ; preds = %21
%36 = load i8, i8* %2
%37 = sext i8 %36 to i32
%38 = load i32, i32* %4
%39 = add nsw i32 %37, %38
%40 = sub nsw i32 %39, 65
%41 = srem i32 %40, 26
%42 = add nsw i32 %41, 65
%43 = trunc i32 %42 to i8
%44 = call i32 @putchar(i8 signext %43)
br label %45
45: ; preds = %35, %25
%46 = phi i32 [ %34, %25 ], [ %44, %35 ]
br label %50
47: ; preds = %17
%48 = load i8, i8* %2
%49 = call i32 @putchar(i8 signext %48)
br label %50
50: ; preds = %47, %45
br label %5
51: ; preds = %15
%52 = call i32 @putchar(i8 signext 10)
ret i32 0
}

LLVM IR (-O2):
@EOF = global i8 0
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = load i8, i8* @EOF
%3 = icmp eq i8 %1, %2
br i1 %3, label %32, label %4
4: ; preds = %0, %26
%5 = phi i8 [ %29, %26 ], [ %1, %0 ]
%6 = phi i32 [ %8, %26 ], [ 0, %0 ]
%7 = sext i8 %5 to i16
%8 = add nuw nsw i32 %6, 1
%9 = icmp eq i32 %6, 512
br i1 %9, label %32, label %10
10: ; preds = %4
%11 = tail call i64 @isalpha(i8 signext %5)
%12 = icmp eq i64 %11, 0
br i1 %12, label %26, label %13
13: ; preds = %10
%14 = tail call i64 @islower(i8 signext %5)
%15 = icmp eq i64 %14, 0
br i1 %15, label %21, label %16
16: ; preds = %13
%17 = add nsw i16 %7, -92
%18 = srem i16 %17, 26
%19 = trunc i16 %18 to i8
%20 = add nsw i8 %19, 97
br label %26
21: ; preds = %13
%22 = add nsw i16 %7, -60
%23 = srem i16 %22, 26
%24 = trunc i16 %23 to i8
%25 = add nsw i8 %24, 65
br label %26
26: ; preds = %10, %16, %21
%27 = phi i8 [ %20, %16 ], [ %25, %21 ], [ %5, %10 ]
%28 = tail call i32 @putchar(i8 signext %27)
%29 = tail call signext i8 (...) @getchar()
%30 = load i8, i8* @EOF
%31 = icmp eq i8 %29, %30
br i1 %31, label %32, label %4
32: ; preds = %4, %26, %0
%33 = tail call i32 @putchar(i8 signext 10)
ret i32 0
}