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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
call   1030 <fgetc@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2e96(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1192 <main+0x72>
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     1179 <main+0x59>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jg     1179 <main+0x59>
movsbl -0x5(%rbp),%eax
add    $0xffffffe0,%eax
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
mov    0x2e4d(%rip),%rcx
mov    (%rcx),%esi
movsbl %al,%edi
call   1040 <fputc@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    0x2ebc(%rip),%r14
mov    (%r14),%edi
call   1030 <fgetc@plt>
mov    0x2ea5(%rip),%r15
cmp    (%r15),%al
je     1179 <main+0x59>
mov    0x2e89(%rip),%rbx
nopw   0x0(%rax,%rax,1)
lea    -0x61(%rax),%ecx
lea    -0x20(%rax),%edx
cmp    $0x1a,%cl
movzbl %al,%eax
movzbl %dl,%ecx
cmovae %eax,%ecx
mov    (%rbx),%esi
movsbl %cl,%edi
call   1040 <fputc@plt>
mov    (%r14),%edi
call   1030 <fgetc@plt>
cmp    (%r15),%al
jne    1150 <main+0x30>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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 = %23, %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 %27
10: ; preds = %3
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp sge i32 %12, 97
br i1 %13, label %14, label %23
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 122
br i1 %17, label %18, label %23
18: ; preds = %14
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = add nsw i32 %20, -32
%22 = trunc i32 %21 to i8
store i8 %22, i8* %2
br label %23
23: ; preds = %18, %14, %10
%24 = load i8, i8* %2
%25 = load i32, i32* @stdout
%26 = call i32 @fputc(i8 signext %24, i32 %25)
br label %3
27: ; 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 %17, label %5
5: ; preds = %0, %5
%6 = phi i8 [ %14, %5 ], [ %2, %0 ]
%7 = add i8 %6, -97
%8 = icmp ult i8 %7, 26
%9 = add i8 %6, -32
%10 = select i1 %8, i8 %9, i8 %6
%11 = load i32, i32* @stdout
%12 = tail call i32 @fputc(i8 signext %10, i32 %11)
%13 = load i32, i32* @stdin
%14 = tail call signext i8 @fgetc(i32 %13)
%15 = load i8, i8* @EOF
%16 = icmp eq i8 %14, %15
br i1 %16, label %17, label %5
17: ; preds = %5, %0
ret i32 0
}