#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;
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
char getchar();
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ stdout;
int main() {
  char c;
  while ((c = getchar()) != EOF) {
    if (c >= 'a' && c <= 'z') {
      putchar(c - ('z' - 'Z'));
    } else {
      putchar(c);
      if (c == '\n')
        fflush(stdout);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2e95(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11ba <main+0x8a>
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     118c <main+0x5c>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jg     118c <main+0x5c>
movsbl -0x5(%rbp),%eax
sub    $0x20,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    11b5 <main+0x85>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
jne    11b0 <main+0x80>
mov    0x2e2f(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
jmp    11b5 <main+0x85>
jmp    113f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2ea5(%rip),%r14
cmp    (%r14),%al
jne    1150 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret
mov    %eax,%ebx
mov    0x2e7f(%rip),%r15
jmp    1179 <main+0x49>
nopl   0x0(%rax,%rax,1)
add    $0xe0,%bl
movsbl %bl,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
cmp    (%r14),%al
je     1148 <main+0x18>
lea    -0x61(%rbx),%eax
cmp    $0x19,%al
jbe    1160 <main+0x30>
movsbl %bl,%edi
call   1030 <putchar@plt>
cmp    $0xa,%bl
jne    116b <main+0x3b>
mov    (%r15),%edi
call   1050 <fflush@plt>
jmp    116b <main+0x3b>

LLVM IR (-O0):
@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 = %33, %0
%4 = call signext i8 (...) @getchar()
store i8 %4, i8* %2
%5 = sext i8 %4 to i32
%6 = load i8, i8* @EOF
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %5, %7
br i1 %8, label %9, label %34
9: ; preds = %3
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
%12 = icmp sge i32 %11, 97
br i1 %12, label %13, label %23
13: ; preds = %9
%14 = load i8, i8* %2
%15 = sext i8 %14 to i32
%16 = icmp sle i32 %15, 122
br i1 %16, label %17, label %23
17: ; preds = %13
%18 = load i8, i8* %2
%19 = sext i8 %18 to i32
%20 = sub nsw i32 %19, 32
%21 = trunc i32 %20 to i8
%22 = call i32 @putchar(i8 signext %21)
br label %33
23: ; preds = %13, %9
%24 = load i8, i8* %2
%25 = call i32 @putchar(i8 signext %24)
%26 = load i8, i8* %2
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 10
br i1 %28, label %29, label %32
29: ; preds = %23
%30 = load i32, i32* @stdout
%31 = call i32 @fflush(i32 %30)
br label %32
32: ; preds = %29, %23
br label %33
33: ; preds = %32, %17
br label %3
34: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@EOF = global i8 0
@stdout = global i32 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 %21, label %4
4: ; preds = %0, %17
%5 = phi i8 [ %18, %17 ], [ %1, %0 ]
%6 = add i8 %5, -97
%7 = icmp ult i8 %6, 26
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = add nsw i8 %5, -32
%10 = tail call i32 @putchar(i8 signext %9)
br label %17
11: ; preds = %4
%12 = tail call i32 @putchar(i8 signext %5)
%13 = icmp eq i8 %5, 10
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = load i32, i32* @stdout
%16 = tail call i32 @fflush(i32 %15)
br label %17
17: ; preds = %11, %14, %8
%18 = tail call signext i8 (...) @getchar()
%19 = load i8, i8* @EOF
%20 = icmp eq i8 %18, %19
br i1 %20, label %21, label %4
21: ; preds = %17, %0
ret i32 0
}