int inclass(c)
char c;
{
  switch (c) {
  case ' ':
  case '\t':
    return 0;
  case '.':
  case '!':
  case '?':
    return 1;
  case '\n':
  case '\r':
  case '\0':
    return 2;
  default:
    if (c < ' ' || c > '~')
      return 2;
    else
      return 3;
  }
}


x86 assembly (clang, -O0):
<inclass>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     11ad <inclass+0xad>
jmp    111e <inclass+0x1e>
mov    -0xc(%rbp),%eax
sub    $0x9,%eax
je     1195 <inclass+0x95>
jmp    112f <inclass+0x2f>
mov    -0xc(%rbp),%eax
sub    $0xa,%eax
je     11ad <inclass+0xad>
jmp    1140 <inclass+0x40>
mov    -0xc(%rbp),%eax
sub    $0xd,%eax
je     11ad <inclass+0xad>
jmp    1151 <inclass+0x51>
mov    -0xc(%rbp),%eax
sub    $0x20,%eax
je     1195 <inclass+0x95>
jmp    1162 <inclass+0x62>
mov    -0xc(%rbp),%eax
sub    $0x21,%eax
je     11a1 <inclass+0xa1>
jmp    1173 <inclass+0x73>
mov    -0xc(%rbp),%eax
sub    $0x2e,%eax
je     11a1 <inclass+0xa1>
jmp    1184 <inclass+0x84>
mov    -0xc(%rbp),%eax
sub    $0x3f,%eax
je     11a1 <inclass+0xa1>
jmp    11b9 <inclass+0xb9>
movl   $0x0,-0x4(%rbp)
jmp    11e6 <inclass+0xe6>
movl   $0x1,-0x4(%rbp)
jmp    11e6 <inclass+0xe6>
movl   $0x2,-0x4(%rbp)
jmp    11e6 <inclass+0xe6>
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
jl     11d3 <inclass+0xd3>
movsbl -0x5(%rbp),%eax
cmp    $0x7e,%eax
jle    11df <inclass+0xdf>
movl   $0x2,-0x4(%rbp)
jmp    11e6 <inclass+0xe6>
movl   $0x3,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inclass>:
movsbl %dil,%ecx
cmp    $0x3f,%ecx
ja     1144 <inclass+0x44>
mov    $0x2401,%eax
bt     %rcx,%rax
jb     112a <inclass+0x2a>
movabs $0x8000400200000000,%rax
bt     %rcx,%rax
jae    1131 <inclass+0x31>
mov    $0x1,%eax
ret
mov    $0x2,%eax
jmp    1143 <inclass+0x43>
xor    %eax,%eax
movabs $0x100000200,%rdx
bt     %rcx,%rdx
jae    1144 <inclass+0x44>
ret
shl    $0x18,%edi
add    $0x81ffffff,%edi
cmp    $0xa1ffffff,%edi
mov    $0x3,%eax
sbb    $0x0,%eax
ret

LLVM IR (-O0):
define i32 @inclass(i32 %0) {
%2 = alloca i32
%3 = alloca i8
%4 = trunc i32 %0 to i8
store i8 %4, i8* %3
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
switch i32 %6, label %10 [
i32 32, label %7
i32 9, label %7
i32 46, label %8
i32 33, label %8
i32 63, label %8
i32 10, label %9
i32 13, label %9
i32 0, label %9
]
7: ; preds = %1, %1
store i32 0, i32* %2
br label %20
8: ; preds = %1, %1, %1
store i32 1, i32* %2
br label %20
9: ; preds = %1, %1, %1
store i32 2, i32* %2
br label %20
10: ; preds = %1
%11 = load i8, i8* %3
%12 = sext i8 %11 to i32
%13 = icmp slt i32 %12, 32
br i1 %13, label %18, label %14
14: ; preds = %10
%15 = load i8, i8* %3
%16 = sext i8 %15 to i32
%17 = icmp sgt i32 %16, 126
br i1 %17, label %18, label %19
18: ; preds = %14, %10
store i32 2, i32* %2
br label %20
19: ; preds = %14
store i32 3, i32* %2
br label %20
20: ; preds = %19, %18, %9, %8, %7
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
define i32 @inclass(i32 %0) {
%2 = shl i32 %0, 24
%3 = ashr exact i32 %2, 24
switch i32 %3, label %6 [
i32 32, label %10
i32 9, label %10
i32 46, label %4
i32 33, label %4
i32 63, label %4
i32 10, label %5
i32 13, label %5
i32 0, label %5
]
4: ; preds = %1, %1, %1
br label %10
5: ; preds = %1, %1, %1
br label %10
6: ; preds = %1
%7 = add i32 %2, -2113929217
%8 = icmp ult i32 %7, -1577058305
%9 = select i1 %8, i32 2, i32 3
br label %10
10: ; preds = %6, %1, %1, %5, %4
%11 = phi i32 [ 2, %5 ], [ 1, %4 ], [ 0, %1 ], [ 0, %1 ], [ %9, %6 ]
ret i32 %11
}