#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 */
int read(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ write(int, char *, int);
int main() {
  char buf[1];
  while (read(0, buf, 1) == 1) {
    if ((buf[0] >= 'A' && buf[0] <= 'Z') || (buf[0] >= 'a' && buf[0] <= 'z') ||
        (buf[0] >= '0' && buf[0] <= '9')) {
      write(1, buf, 1);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x5(%rbp),%rsi
xor    %edi,%edi
mov    $0x1,%edx
call   1040 <read@plt>
cmp    $0x1,%eax
jne    11ab <main+0x8b>
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     1162 <main+0x42>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jle    1196 <main+0x76>
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     117c <main+0x5c>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jle    1196 <main+0x76>
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     11a6 <main+0x86>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     11a6 <main+0x86>
lea    -0x5(%rbp),%rsi
mov    $0x1,%edx
mov    %edx,%edi
call   1030 <write@plt>
jmp    112f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xf(%rsp),%rsi
xor    %edi,%edi
mov    $0x1,%edx
call   1040 <read@plt>
cmp    $0x1,%eax
jne    1190 <main+0x70>
lea    0xf(%rsp),%rbx
jmp    1176 <main+0x56>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x1,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1040 <read@plt>
cmp    $0x1,%eax
jne    1190 <main+0x70>
movzbl 0xf(%rsp),%eax
mov    %eax,%ecx
and    $0xdf,%cl
add    $0xbf,%cl
cmp    $0x1a,%cl
jb     1150 <main+0x30>
add    $0xd0,%al
cmp    $0x9,%al
ja     1162 <main+0x42>
jmp    1150 <main+0x30>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [1 x i8]
store i32 0, i32* %1
br label %3
3: ; preds = %40, %0
%4 = getelementptr inbounds [1 x i8], [1 x i8]* %2, i64 0, i64 0
%5 = call i32 @read(i32 0, i8* %4, i32 1)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %41
7: ; preds = %3
%8 = getelementptr inbounds [1 x i8], [1 x i8]* %2, i64 0, i64 0
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp sge i32 %10, 65
br i1 %11, label %12, label %17
12: ; preds = %7
%13 = getelementptr inbounds [1 x i8], [1 x i8]* %2, i64 0, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp sle i32 %15, 90
br i1 %16, label %37, label %17
17: ; preds = %12, %7
%18 = getelementptr inbounds [1 x i8], [1 x i8]* %2, i64 0, i64 0
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp sge i32 %20, 97
br i1 %21, label %22, label %27
22: ; preds = %17
%23 = getelementptr inbounds [1 x i8], [1 x i8]* %2, i64 0, i64 0
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp sle i32 %25, 122
br i1 %26, label %37, label %27
27: ; preds = %22, %17
%28 = getelementptr inbounds [1 x i8], [1 x i8]* %2, i64 0, i64 0
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp sge i32 %30, 48
br i1 %31, label %32, label %40
32: ; preds = %27
%33 = getelementptr inbounds [1 x i8], [1 x i8]* %2, i64 0, i64 0
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp sle i32 %35, 57
br i1 %36, label %37, label %40
37: ; preds = %32, %22, %12
%38 = getelementptr inbounds [1 x i8], [1 x i8]* %2, i64 0, i64 0
%39 = call i32 @write(i32 1, i8* %38, i32 1)
br label %40
40: ; preds = %37, %32, %27
br label %3
41: ; preds = %3
%42 = load i32, i32* %1
ret i32 %42
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [1 x i8]
%2 = getelementptr inbounds [1 x i8], [1 x i8]* %1, i64 0, i64 0
%3 = call i32 @read(i32 0, i8* %2, i32 1)
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %18
5: ; preds = %0, %15
%6 = load i8, i8* %2
%7 = and i8 %6, -33
%8 = add i8 %7, -65
%9 = icmp ult i8 %8, 26
%10 = add i8 %6, -48
%11 = icmp ult i8 %10, 10
%12 = select i1 %9, i1 true, i1 %11
br i1 %12, label %13, label %15
13: ; preds = %5
%14 = call i32 @write(i32 1, i8* %2, i32 1)
br label %15
15: ; preds = %5, %13
%16 = call i32 @read(i32 0, i8* %2, i32 1)
%17 = icmp eq i32 %16, 1
br i1 %17, label %5, label %18
18: ; preds = %15, %0
ret i32 0
}