#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 utf8_isalnum(unsigned int);
int utf8_isalpha(unsigned int);
int utf8_iscntrl(unsigned int);
int utf8_isdigit(unsigned int);
int utf8_isgraph(unsigned int);
int utf8_islower(unsigned int);
int utf8_ispunct(unsigned int);
int utf8_isspace(unsigned int);
int utf8_isupper(unsigned int);
int utf8_isxdigit(unsigned int);
int utf8_tolower(unsigned int);
int match_class(unsigned c, unsigned cl) {
  int res;
  switch (utf8_tolower(cl)) {
  case 'a':
    res = utf8_isalpha(c);
    break;
  case 'c':
    res = utf8_iscntrl(c);
    break;
  case 'd':
    res = utf8_isdigit(c);
    break;
  case 'g':
    res = utf8_isgraph(c);
    break;
  case 'l':
    res = utf8_islower(c);
    break;
  case 'p':
    res = utf8_ispunct(c);
    break;
  case 's':
    res = utf8_isspace(c);
    break;
  case 'u':
    res = utf8_isupper(c);
    break;
  case 'w':
    res = utf8_isalnum(c);
    break;
  case 'x':
    res = utf8_isxdigit(c);
    break;
  case 'z':
    res = (c == 0);
    break;
  default:
    return (cl == c);
  }
  return (utf8_islower(cl) ? res : !res);
}


x86 assembly (clang, -O0):
<match_class>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <utf8_tolower@plt>
add    $0xffffff9f,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x19,%eax
ja     12a0 <match_class+0xf0>
mov    -0x18(%rbp),%rax
lea    0xe1d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%edi
call   1030 <utf8_isalpha@plt>
mov    %eax,-0x10(%rbp)
jmp    12b6 <match_class+0x106>
mov    -0x8(%rbp),%edi
call   1060 <utf8_iscntrl@plt>
mov    %eax,-0x10(%rbp)
jmp    12b6 <match_class+0x106>
mov    -0x8(%rbp),%edi
call   1080 <utf8_isdigit@plt>
mov    %eax,-0x10(%rbp)
jmp    12b6 <match_class+0x106>
mov    -0x8(%rbp),%edi
call   1070 <utf8_isgraph@plt>
mov    %eax,-0x10(%rbp)
jmp    12b6 <match_class+0x106>
mov    -0x8(%rbp),%edi
call   10d0 <utf8_islower@plt>
mov    %eax,-0x10(%rbp)
jmp    12b6 <match_class+0x106>
mov    -0x8(%rbp),%edi
call   10b0 <utf8_ispunct@plt>
mov    %eax,-0x10(%rbp)
jmp    12b6 <match_class+0x106>
mov    -0x8(%rbp),%edi
call   10c0 <utf8_isspace@plt>
mov    %eax,-0x10(%rbp)
jmp    12b6 <match_class+0x106>
mov    -0x8(%rbp),%edi
call   1050 <utf8_isupper@plt>
mov    %eax,-0x10(%rbp)
jmp    12b6 <match_class+0x106>
mov    -0x8(%rbp),%edi
call   10a0 <utf8_isalnum@plt>
mov    %eax,-0x10(%rbp)
jmp    12b6 <match_class+0x106>
mov    -0x8(%rbp),%edi
call   1090 <utf8_isxdigit@plt>
mov    %eax,-0x10(%rbp)
jmp    12b6 <match_class+0x106>
cmpl   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
jmp    12b6 <match_class+0x106>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    12e9 <match_class+0x139>
mov    -0xc(%rbp),%edi
call   10d0 <utf8_islower@plt>
cmp    $0x0,%eax
je     12d2 <match_class+0x122>
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    12e3 <match_class+0x133>
cmpl   $0x0,-0x10(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<match_class>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebx
mov    %esi,%edi
call   1040 <utf8_tolower@plt>
add    $0xffffff9f,%eax
cmp    $0x19,%eax
ja     11e1 <match_class+0x31>
lea    0xe31(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %ebx,%edi
call   1030 <utf8_isalpha@plt>
jmp    123a <match_class+0x8a>
xor    %eax,%eax
cmp    %ebx,%r14d
sete   %al
jmp    1252 <match_class+0xa2>
mov    %ebx,%edi
call   1060 <utf8_iscntrl@plt>
jmp    123a <match_class+0x8a>
mov    %ebx,%edi
call   1080 <utf8_isdigit@plt>
jmp    123a <match_class+0x8a>
mov    %ebx,%edi
call   1070 <utf8_isgraph@plt>
jmp    123a <match_class+0x8a>
mov    %ebx,%edi
call   10d0 <utf8_islower@plt>
jmp    123a <match_class+0x8a>
mov    %ebx,%edi
call   10b0 <utf8_ispunct@plt>
jmp    123a <match_class+0x8a>
mov    %ebx,%edi
call   10c0 <utf8_isspace@plt>
jmp    123a <match_class+0x8a>
mov    %ebx,%edi
call   1050 <utf8_isupper@plt>
jmp    123a <match_class+0x8a>
mov    %ebx,%edi
call   10a0 <utf8_isalnum@plt>
jmp    123a <match_class+0x8a>
mov    %ebx,%edi
call   1090 <utf8_isxdigit@plt>
mov    %eax,%ebp
mov    %r14d,%edi
call   10d0 <utf8_islower@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ebp,%ebp
sete   %al
test   %ecx,%ecx
cmovne %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
xor    %ebp,%ebp
test   %ebx,%ebx
sete   %bpl
jmp    123c <match_class+0x8c>

LLVM IR (-O0):
define i32 @match_class(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = load i32, i32* %5
%8 = call i32 @utf8_tolower(i32 %7)
switch i32 %8, label %43 [
i32 97, label %9
i32 99, label %12
i32 100, label %15
i32 103, label %18
i32 108, label %21
i32 112, label %24
i32 115, label %27
i32 117, label %30
i32 119, label %33
i32 120, label %36
i32 122, label %39
]
9: ; preds = %2
%10 = load i32, i32* %4
%11 = call i32 @utf8_isalpha(i32 %10)
store i32 %11, i32* %6
br label %48
12: ; preds = %2
%13 = load i32, i32* %4
%14 = call i32 @utf8_iscntrl(i32 %13)
store i32 %14, i32* %6
br label %48
15: ; preds = %2
%16 = load i32, i32* %4
%17 = call i32 @utf8_isdigit(i32 %16)
store i32 %17, i32* %6
br label %48
18: ; preds = %2
%19 = load i32, i32* %4
%20 = call i32 @utf8_isgraph(i32 %19)
store i32 %20, i32* %6
br label %48
21: ; preds = %2
%22 = load i32, i32* %4
%23 = call i32 @utf8_islower(i32 %22)
store i32 %23, i32* %6
br label %48
24: ; preds = %2
%25 = load i32, i32* %4
%26 = call i32 @utf8_ispunct(i32 %25)
store i32 %26, i32* %6
br label %48
27: ; preds = %2
%28 = load i32, i32* %4
%29 = call i32 @utf8_isspace(i32 %28)
store i32 %29, i32* %6
br label %48
30: ; preds = %2
%31 = load i32, i32* %4
%32 = call i32 @utf8_isupper(i32 %31)
store i32 %32, i32* %6
br label %48
33: ; preds = %2
%34 = load i32, i32* %4
%35 = call i32 @utf8_isalnum(i32 %34)
store i32 %35, i32* %6
br label %48
36: ; preds = %2
%37 = load i32, i32* %4
%38 = call i32 @utf8_isxdigit(i32 %37)
store i32 %38, i32* %6
br label %48
39: ; preds = %2
%40 = load i32, i32* %4
%41 = icmp eq i32 %40, 0
%42 = zext i1 %41 to i32
store i32 %42, i32* %6
br label %48
43: ; preds = %2
%44 = load i32, i32* %5
%45 = load i32, i32* %4
%46 = icmp eq i32 %44, %45
%47 = zext i1 %46 to i32
store i32 %47, i32* %3
br label %61
48: ; preds = %39, %36, %33, %30, %27, %24, %21, %18, %15, %12, %9
%49 = load i32, i32* %5
%50 = call i32 @utf8_islower(i32 %49)
%51 = icmp ne i32 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %48
%53 = load i32, i32* %6
br label %59
54: ; preds = %48
%55 = load i32, i32* %6
%56 = icmp ne i32 %55, 0
%57 = xor i1 %56, true
%58 = zext i1 %57 to i32
br label %59
59: ; preds = %54, %52
%60 = phi i32 [ %53, %52 ], [ %58, %54 ]
store i32 %60, i32* %3
br label %61
61: ; preds = %59, %43
%62 = load i32, i32* %3
ret i32 %62
}

LLVM IR (-O2):
define i32 @match_class(i32 %0, i32 %1) {
%3 = tail call i32 @utf8_tolower(i32 %1)
switch i32 %3, label %27 [
i32 97, label %4
i32 99, label %6
i32 100, label %8
i32 103, label %10
i32 108, label %12
i32 112, label %14
i32 115, label %16
i32 117, label %18
i32 119, label %20
i32 120, label %22
i32 122, label %24
]
4: ; preds = %2
%5 = tail call i32 @utf8_isalpha(i32 %0)
br label %30
6: ; preds = %2
%7 = tail call i32 @utf8_iscntrl(i32 %0)
br label %30
8: ; preds = %2
%9 = tail call i32 @utf8_isdigit(i32 %0)
br label %30
10: ; preds = %2
%11 = tail call i32 @utf8_isgraph(i32 %0)
br label %30
12: ; preds = %2
%13 = tail call i32 @utf8_islower(i32 %0)
br label %30
14: ; preds = %2
%15 = tail call i32 @utf8_ispunct(i32 %0)
br label %30
16: ; preds = %2
%17 = tail call i32 @utf8_isspace(i32 %0)
br label %30
18: ; preds = %2
%19 = tail call i32 @utf8_isupper(i32 %0)
br label %30
20: ; preds = %2
%21 = tail call i32 @utf8_isalnum(i32 %0)
br label %30
22: ; preds = %2
%23 = tail call i32 @utf8_isxdigit(i32 %0)
br label %30
24: ; preds = %2
%25 = icmp eq i32 %0, 0
%26 = zext i1 %25 to i32
br label %30
27: ; preds = %2
%28 = icmp eq i32 %1, %0
%29 = zext i1 %28 to i32
br label %37
30: ; preds = %24, %22, %20, %18, %16, %14, %12, %10, %8, %6, %4
%31 = phi i32 [ %26, %24 ], [ %23, %22 ], [ %21, %20 ], [ %19, %18 ], [ %17, %16 ], [ %15, %14 ], [ %13, %12 ], [ %11, %10 ], [ %9, %8 ], [ %7, %6 ], [ %5, %4 ]
%32 = tail call i32 @utf8_islower(i32 %1)
%33 = icmp eq i32 %32, 0
%34 = icmp eq i32 %31, 0
%35 = zext i1 %34 to i32
%36 = select i1 %33, i32 %35, i32 %31
br label %37
37: ; preds = %30, %27
%38 = phi i32 [ %29, %27 ], [ %36, %30 ]
ret i32 %38
}