#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 getchar();
int /*<<< orphan*/ puts(char *);
int main(void) {
  char array[1024] = {};
  int i = 0;
  while ('\n' != (array[i] = getchar()))
    i++;
  array[i] = '\0';
  for (i = 0; array[i] != '\0'; i++) {
    switch (array[i]) {
    case 'Z':
      array[i] = 'A';
      break;
    case 'z':
      array[i] = 'a';
      break;
    default:
      array[i] = array[i] + 1;
      break;
    }
  }
  puts(array);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1040 <memset@plt>
movl   $0x0,-0x414(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
movslq -0x414(%rbp),%rcx
mov    %al,-0x410(%rbp,%rcx,1)
movsbl %al,%ecx
mov    $0xa,%eax
cmp    %ecx,%eax
je     1198 <main+0x68>
mov    -0x414(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x414(%rbp)
jmp    115f <main+0x2f>
movslq -0x414(%rbp),%rax
movb   $0x0,-0x410(%rbp,%rax,1)
movl   $0x0,-0x414(%rbp)
movslq -0x414(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     1263 <main+0x133>
movslq -0x414(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%eax
ff
mov    %eax,-0x418(%rbp)
sub    $0x5a,%eax
je     1200 <main+0xd0>
jmp    11ec <main+0xbc>
mov    -0x418(%rbp),%eax
sub    $0x7a,%eax
je     1214 <main+0xe4>
jmp    1228 <main+0xf8>
movslq -0x414(%rbp),%rax
movb   $0x41,-0x410(%rbp,%rax,1)
41
jmp    124a <main+0x11a>
movslq -0x414(%rbp),%rax
movb   $0x61,-0x410(%rbp,%rax,1)
61
jmp    124a <main+0x11a>
movslq -0x414(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%eax
ff
add    $0x1,%eax
mov    %al,%cl
movslq -0x414(%rbp),%rax
mov    %cl,-0x410(%rbp,%rax,1)
jmp    124f <main+0x11f>
mov    -0x414(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x414(%rbp)
jmp    11b1 <main+0x81>
lea    -0x410(%rbp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x400,%rsp
mov    %rsp,%rdi
mov    $0x400,%edx
xor    %esi,%esi
call   1040 <memset@plt>
mov    $0xffffffffffffffff,%rbx
xchg   %ax,%ax
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %al,0x1(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0xa,%al
jne    1150 <main+0x20>
mov    %ebx,%eax
movb   $0x0,(%rsp,%rax,1)
mov    (%rsp),%al
test   %al,%al
je     11b4 <main+0x84>
lea    0x1(%rsp),%rcx
jmp    1190 <main+0x60>
nopw   0x0(%rax,%rax,1)
add    $0x1,%al
mov    %al,-0x1(%rcx)
movzbl (%rcx),%eax
add    $0x1,%rcx
test   %al,%al
je     11b4 <main+0x84>
movsbl %al,%edx
cmp    $0x5a,%edx
je     11b0 <main+0x80>
cmp    $0x7a,%edx
jne    1180 <main+0x50>
mov    $0x61,%al
jmp    1182 <main+0x52>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x41,%al
jmp    1182 <main+0x52>
mov    %rsp,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [1024 x i8]* %2 to i8*
store i32 0, i32* %3
br label %5
5: ; preds = %12, %0
%6 = call signext i8 (...) @getchar()
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %8
store i8 %6, i8* %9
%10 = sext i8 %6 to i32
%11 = icmp ne i32 10, %10
br i1 %11, label %12, label %15
12: ; preds = %5
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %5
15: ; preds = %5
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %17
store i8 0, i8* %18
store i32 0, i32* %3
br label %19
19: ; preds = %52, %15
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %55
26: ; preds = %19
%27 = load i32, i32* %3
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
switch i32 %31, label %40 [
i32 90, label %32
i32 122, label %36
]
32: ; preds = %26
%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
store i8 65, i8* %35
br label %51
36: ; preds = %26
%37 = load i32, i32* %3
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %38
store i8 97, i8* %39
br label %51
40: ; preds = %26
%41 = load i32, i32* %3
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %42
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = add nsw i32 %45, 1
%47 = trunc i32 %46 to i8
%48 = load i32, i32* %3
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %49
store i8 %47, i8* %50
br label %51
51: ; preds = %40, %36, %32
br label %52
52: ; preds = %51
%53 = load i32, i32* %3
%54 = add nsw i32 %53, 1
store i32 %54, i32* %3
br label %19
55: ; preds = %19
%56 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%57 = call i32 @puts(i8* %56)
ret i32 0
}

LLVM IR (-O2):
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 = %3, %0
%4 = phi i64 [ %8, %3 ], [ 0, %0 ]
%5 = tail call signext i8 (...) @getchar()
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %4
store i8 %5, i8* %6
%7 = icmp eq i8 %5, 10
%8 = add nuw i64 %4, 1
br i1 %7, label %9, label %3
9: ; preds = %3
%10 = and i64 %4, 4294967295
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %10
store i8 0, i8* %11
%12 = load i8, i8* %2
%13 = icmp eq i8 %12, 0
br i1 %13, label %28, label %14
14: ; preds = %9, %22
%15 = phi i64 [ %24, %22 ], [ 0, %9 ]
%16 = phi i8 [ %26, %22 ], [ %12, %9 ]
%17 = phi i8* [ %25, %22 ], [ %2, %9 ]
%18 = sext i8 %16 to i32
switch i32 %18, label %20 [
i32 90, label %22
i32 122, label %19
]
19: ; preds = %14
br label %22
20: ; preds = %14
%21 = add i8 %16, 1
br label %22
22: ; preds = %14, %19, %20
%23 = phi i8 [ 97, %19 ], [ %21, %20 ], [ 65, %14 ]
store i8 %23, i8* %17
%24 = add nuw i64 %15, 1
%25 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = icmp eq i8 %26, 0
br i1 %27, label %28, label %14
28: ; preds = %22, %9
%29 = call i32 @puts(i8* %2)
ret i32 0
}