#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 */
typedef char wint_t;
typedef int wctype_t;

/* Variables and functions */
int iswalnum(char);
int iswalpha(char);
int iswcntrl(char);
int iswdigit(char);
int iswgraph(char);
int iswprint(char);
int iswpunct(char);
int iswspace(char);
int iswupper(char);
int iswxdigit(char);
int iswctype(wint_t c, wctype_t char_type) {
  switch (char_type) {
  case 1:
    return iswalnum(c);
  case 2:
    return iswalpha(c);
  case 3:
    return c == ' ' || c == '\t';
  case 4:
    return iswcntrl(c);
  case 5:
    return iswdigit(c);
  case 6:
    return iswgraph(c);
  case 7:
    return iswgraph(c);
  case 8:
    return iswprint(c);
  case 9:
    return iswpunct(c);
  case 10:
    return iswspace(c);
  case 11:
    return iswupper(c);
  case 12:
    return iswxdigit(c);
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<iswctype>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0xb,%eax
ja     12c4 <iswctype+0x124>
mov    -0x18(%rbp),%rax
lea    0xe2f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsbl -0x5(%rbp),%edi
call   1090 <iswalnum@plt>
mov    %eax,-0x4(%rbp)
jmp    12cb <iswctype+0x12b>
movsbl -0x5(%rbp),%edi
call   10b0 <iswalpha@plt>
mov    %eax,-0x4(%rbp)
jmp    12cb <iswctype+0x12b>
movsbl -0x5(%rbp),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x19(%rbp)
je     121b <iswctype+0x7b>
movsbl -0x5(%rbp),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    12cb <iswctype+0x12b>
movsbl -0x5(%rbp),%edi
call   1040 <iswcntrl@plt>
mov    %eax,-0x4(%rbp)
jmp    12cb <iswctype+0x12b>
movsbl -0x5(%rbp),%edi
call   1060 <iswdigit@plt>
mov    %eax,-0x4(%rbp)
jmp    12cb <iswctype+0x12b>
movsbl -0x5(%rbp),%edi
call   1070 <iswgraph@plt>
mov    %eax,-0x4(%rbp)
jmp    12cb <iswctype+0x12b>
movsbl -0x5(%rbp),%edi
call   1070 <iswgraph@plt>
mov    %eax,-0x4(%rbp)
jmp    12cb <iswctype+0x12b>
movsbl -0x5(%rbp),%edi
call   10c0 <iswprint@plt>
mov    %eax,-0x4(%rbp)
jmp    12cb <iswctype+0x12b>
movsbl -0x5(%rbp),%edi
call   1030 <iswpunct@plt>
mov    %eax,-0x4(%rbp)
jmp    12cb <iswctype+0x12b>
movsbl -0x5(%rbp),%edi
call   10a0 <iswspace@plt>
mov    %eax,-0x4(%rbp)
jmp    12cb <iswctype+0x12b>
movsbl -0x5(%rbp),%edi
call   1080 <iswupper@plt>
mov    %eax,-0x4(%rbp)
jmp    12cb <iswctype+0x12b>
movsbl -0x5(%rbp),%edi
call   1050 <iswxdigit@plt>
mov    %eax,-0x4(%rbp)
jmp    12cb <iswctype+0x12b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iswctype>:
add    $0xffffffff,%esi
cmp    $0xb,%esi
ja     1226 <iswctype+0x86>
lea    0xe51(%rip),%rax
movslq (%rax,%rsi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
movsbl %dil,%edi
jmp    1070 <iswgraph@plt>
movsbl %dil,%edi
jmp    1090 <iswalnum@plt>
movsbl %dil,%edi
jmp    10b0 <iswalpha@plt>
cmp    $0x20,%dil
sete   %al
cmp    $0x9,%dil
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret
movsbl %dil,%edi
jmp    1040 <iswcntrl@plt>
movsbl %dil,%edi
jmp    1060 <iswdigit@plt>
movsbl %dil,%edi
jmp    10c0 <iswprint@plt>
movsbl %dil,%edi
jmp    1030 <iswpunct@plt>
movsbl %dil,%edi
jmp    10a0 <iswspace@plt>
movsbl %dil,%edi
jmp    1080 <iswupper@plt>
movsbl %dil,%edi
jmp    1050 <iswxdigit@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @iswctype(i8 signext %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8
%5 = alloca i32
store i8 %0, i8* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
switch i32 %6, label %51 [
i32 1, label %7
i32 2, label %10
i32 3, label %13
i32 4, label %24
i32 5, label %27
i32 6, label %30
i32 7, label %33
i32 8, label %36
i32 9, label %39
i32 10, label %42
i32 11, label %45
i32 12, label %48
]
7: ; preds = %2
%8 = load i8, i8* %4
%9 = call i32 @iswalnum(i8 signext %8)
store i32 %9, i32* %3
br label %52
10: ; preds = %2
%11 = load i8, i8* %4
%12 = call i32 @iswalpha(i8 signext %11)
store i32 %12, i32* %3
br label %52
13: ; preds = %2
%14 = load i8, i8* %4
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 32
br i1 %16, label %21, label %17
17: ; preds = %13
%18 = load i8, i8* %4
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 9
br label %21
21: ; preds = %17, %13
%22 = phi i1 [ true, %13 ], [ %20, %17 ]
%23 = zext i1 %22 to i32
store i32 %23, i32* %3
br label %52
24: ; preds = %2
%25 = load i8, i8* %4
%26 = call i32 @iswcntrl(i8 signext %25)
store i32 %26, i32* %3
br label %52
27: ; preds = %2
%28 = load i8, i8* %4
%29 = call i32 @iswdigit(i8 signext %28)
store i32 %29, i32* %3
br label %52
30: ; preds = %2
%31 = load i8, i8* %4
%32 = call i32 @iswgraph(i8 signext %31)
store i32 %32, i32* %3
br label %52
33: ; preds = %2
%34 = load i8, i8* %4
%35 = call i32 @iswgraph(i8 signext %34)
store i32 %35, i32* %3
br label %52
36: ; preds = %2
%37 = load i8, i8* %4
%38 = call i32 @iswprint(i8 signext %37)
store i32 %38, i32* %3
br label %52
39: ; preds = %2
%40 = load i8, i8* %4
%41 = call i32 @iswpunct(i8 signext %40)
store i32 %41, i32* %3
br label %52
42: ; preds = %2
%43 = load i8, i8* %4
%44 = call i32 @iswspace(i8 signext %43)
store i32 %44, i32* %3
br label %52
45: ; preds = %2
%46 = load i8, i8* %4
%47 = call i32 @iswupper(i8 signext %46)
store i32 %47, i32* %3
br label %52
48: ; preds = %2
%49 = load i8, i8* %4
%50 = call i32 @iswxdigit(i8 signext %49)
store i32 %50, i32* %3
br label %52
51: ; preds = %2
store i32 0, i32* %3
br label %52
52: ; preds = %51, %48, %45, %42, %39, %36, %33, %30, %27, %24, %21, %10, %7
%53 = load i32, i32* %3
ret i32 %53
}

LLVM IR (-O2):
define i32 @iswctype(i8 signext %0, i32 %1) {
switch i32 %1, label %30 [
i32 1, label %3
i32 2, label %5
i32 3, label %7
i32 4, label %12
i32 5, label %14
i32 6, label %16
i32 7, label %18
i32 8, label %20
i32 9, label %22
i32 10, label %24
i32 11, label %26
i32 12, label %28
]
3: ; preds = %2
%4 = tail call i32 @iswalnum(i8 signext %0)
br label %30
5: ; preds = %2
%6 = tail call i32 @iswalpha(i8 signext %0)
br label %30
7: ; preds = %2
%8 = icmp eq i8 %0, 32
%9 = icmp eq i8 %0, 9
%10 = or i1 %8, %9
%11 = zext i1 %10 to i32
br label %30
12: ; preds = %2
%13 = tail call i32 @iswcntrl(i8 signext %0)
br label %30
14: ; preds = %2
%15 = tail call i32 @iswdigit(i8 signext %0)
br label %30
16: ; preds = %2
%17 = tail call i32 @iswgraph(i8 signext %0)
br label %30
18: ; preds = %2
%19 = tail call i32 @iswgraph(i8 signext %0)
br label %30
20: ; preds = %2
%21 = tail call i32 @iswprint(i8 signext %0)
br label %30
22: ; preds = %2
%23 = tail call i32 @iswpunct(i8 signext %0)
br label %30
24: ; preds = %2
%25 = tail call i32 @iswspace(i8 signext %0)
br label %30
26: ; preds = %2
%27 = tail call i32 @iswupper(i8 signext %0)
br label %30
28: ; preds = %2
%29 = tail call i32 @iswxdigit(i8 signext %0)
br label %30
30: ; preds = %2, %28, %26, %24, %22, %20, %18, %16, %14, %12, %7, %5, %3
%31 = phi i32 [ %29, %28 ], [ %27, %26 ], [ %25, %24 ], [ %23, %22 ], [ %21, %20 ], [ %19, %18 ], [ %17, %16 ], [ %15, %14 ], [ %13, %12 ], [ %11, %7 ], [ %6, %5 ], [ %4, %3 ], [ 0, %2 ]
ret i32 %31
}