int GetPossibleCharacterSet(unsigned char C) {
  if (C <= '\x1f')
    return 1;
  if (C >= '0' && C <= '9')
    return (1 + 2 + 4);
  if (C == (unsigned char)(128))
    return (1 + 2 + 4 + 64);
  if (C == (unsigned char)(131))
    return (1 | 2 | 128);
  if (C >= '\x60' && C <= '\x7f')
    return 2;
  return 1 + 2;
}


x86 assembly (clang, -O0):
<GetPossibleCharacterSet>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
cmp    $0x1f,%eax
jg     1123 <GetPossibleCharacterSet+0x23>
movl   $0x1,-0x4(%rbp)
jmp    11ac <GetPossibleCharacterSet+0xac>
movzbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1149 <GetPossibleCharacterSet+0x49>
movzbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     1149 <GetPossibleCharacterSet+0x49>
movl   $0x7,-0x4(%rbp)
jmp    11ac <GetPossibleCharacterSet+0xac>
movzbl -0x5(%rbp),%eax
cmp    $0x80,%eax
jne    1164 <GetPossibleCharacterSet+0x64>
movl   $0x47,-0x4(%rbp)
jmp    11ac <GetPossibleCharacterSet+0xac>
movzbl -0x5(%rbp),%eax
cmp    $0x83,%eax
jne    117f <GetPossibleCharacterSet+0x7f>
movl   $0x83,-0x4(%rbp)
jmp    11ac <GetPossibleCharacterSet+0xac>
movzbl -0x5(%rbp),%eax
cmp    $0x60,%eax
jl     11a5 <GetPossibleCharacterSet+0xa5>
movzbl -0x5(%rbp),%eax
cmp    $0x7f,%eax
jg     11a5 <GetPossibleCharacterSet+0xa5>
movl   $0x2,-0x4(%rbp)
jmp    11ac <GetPossibleCharacterSet+0xac>
movl   $0x3,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetPossibleCharacterSet>:
mov    $0x1,%eax
cmp    $0x20,%dil
jb     113c <GetPossibleCharacterSet+0x3c>
lea    -0x30(%rdi),%ecx
mov    $0x7,%eax
cmp    $0xa,%cl
jb     113c <GetPossibleCharacterSet+0x3c>
cmp    $0x80,%dil
je     112a <GetPossibleCharacterSet+0x2a>
cmp    $0x83,%dil
jne    1130 <GetPossibleCharacterSet+0x30>
mov    $0x83,%eax
ret
mov    $0x47,%eax
ret
xor    %eax,%eax
cmp    $0x60,%dil
setge  %al
xor    $0x3,%eax
ret

LLVM IR (-O0):
define i32 @GetPossibleCharacterSet(i8 zeroext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = icmp sle i32 %5, 31
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1, i32* %2
br label %37
8: ; preds = %1
%9 = load i8, i8* %3
%10 = zext i8 %9 to i32
%11 = icmp sge i32 %10, 48
br i1 %11, label %12, label %17
12: ; preds = %8
%13 = load i8, i8* %3
%14 = zext i8 %13 to i32
%15 = icmp sle i32 %14, 57
br i1 %15, label %16, label %17
16: ; preds = %12
store i32 7, i32* %2
br label %37
17: ; preds = %12, %8
%18 = load i8, i8* %3
%19 = zext i8 %18 to i32
%20 = icmp eq i32 %19, 128
br i1 %20, label %21, label %22
21: ; preds = %17
store i32 71, i32* %2
br label %37
22: ; preds = %17
%23 = load i8, i8* %3
%24 = zext i8 %23 to i32
%25 = icmp eq i32 %24, 131
br i1 %25, label %26, label %27
26: ; preds = %22
store i32 131, i32* %2
br label %37
27: ; preds = %22
%28 = load i8, i8* %3
%29 = zext i8 %28 to i32
%30 = icmp sge i32 %29, 96
br i1 %30, label %31, label %36
31: ; preds = %27
%32 = load i8, i8* %3
%33 = zext i8 %32 to i32
%34 = icmp sle i32 %33, 127
br i1 %34, label %35, label %36
35: ; preds = %31
store i32 2, i32* %2
br label %37
36: ; preds = %31, %27
store i32 3, i32* %2
br label %37
37: ; preds = %36, %35, %26, %21, %16, %7
%38 = load i32, i32* %2
ret i32 %38
}

LLVM IR (-O2):
define i32 @GetPossibleCharacterSet(i8 zeroext %0) {
%2 = icmp ult i8 %0, 32
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = add i8 %0, -48
%5 = icmp ult i8 %4, 10
br i1 %5, label %11, label %6
6: ; preds = %3
switch i8 %0, label %8 [
i8 -128, label %11
i8 -125, label %7
]
7: ; preds = %6
br label %11
8: ; preds = %6
%9 = icmp sgt i8 %0, 95
%10 = select i1 %9, i32 2, i32 3
br label %11
11: ; preds = %8, %6, %3, %1, %7
%12 = phi i32 [ 131, %7 ], [ 1, %1 ], [ 7, %3 ], [ 71, %6 ], [ %10, %8 ]
ret i32 %12
}