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

/* Variables and functions */
int iswalnum(int /*<<< orphan*/);
int iswalpha(int /*<<< orphan*/);
int iswblank(int /*<<< orphan*/);
int iswcntrl(int /*<<< orphan*/);
int iswdigit(int /*<<< orphan*/);
int iswgraph(int /*<<< orphan*/);
int iswlower(int /*<<< orphan*/);
int iswprint(int /*<<< orphan*/);
int iswpunct(int /*<<< orphan*/);
int iswspace(int /*<<< orphan*/);
int iswupper(int /*<<< orphan*/);
int iswxdigit(int /*<<< orphan*/);
int iswctype(wint_t wc, wctype_t type) {
  switch (type) {
  case 1:
    return iswalnum(wc);
  case 2:
    return iswalpha(wc);
  case 3:
    return iswblank(wc);
  case 4:
    return iswcntrl(wc);
  case 5:
    return iswdigit(wc);
  case 6:
    return iswgraph(wc);
  case 7:
    return iswlower(wc);
  case 8:
    return iswprint(wc);
  case 9:
    return iswpunct(wc);
  case 10:
    return iswspace(wc);
  case 11:
    return iswupper(wc);
  case 12:
    return iswxdigit(wc);
  }
  return 0;
}


x86 assembly (clang, -O0):
<iswctype>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0xb,%eax
ja     12b7 <iswctype+0xf7>
mov    -0x18(%rbp),%rax
lea    0xe12(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%edi
call   10b0 <iswalnum@plt>
mov    %eax,-0x4(%rbp)
jmp    12be <iswctype+0xfe>
mov    -0x8(%rbp),%edi
call   10d0 <iswalpha@plt>
mov    %eax,-0x4(%rbp)
jmp    12be <iswctype+0xfe>
mov    -0x8(%rbp),%edi
call   1080 <iswblank@plt>
mov    %eax,-0x4(%rbp)
jmp    12be <iswctype+0xfe>
mov    -0x8(%rbp),%edi
call   1050 <iswcntrl@plt>
mov    %eax,-0x4(%rbp)
jmp    12be <iswctype+0xfe>
mov    -0x8(%rbp),%edi
call   1070 <iswdigit@plt>
mov    %eax,-0x4(%rbp)
jmp    12be <iswctype+0xfe>
mov    -0x8(%rbp),%edi
call   1090 <iswgraph@plt>
mov    %eax,-0x4(%rbp)
jmp    12be <iswctype+0xfe>
mov    -0x8(%rbp),%edi
call   1030 <iswlower@plt>
mov    %eax,-0x4(%rbp)
jmp    12be <iswctype+0xfe>
mov    -0x8(%rbp),%edi
call   10e0 <iswprint@plt>
mov    %eax,-0x4(%rbp)
jmp    12be <iswctype+0xfe>
mov    -0x8(%rbp),%edi
call   1040 <iswpunct@plt>
mov    %eax,-0x4(%rbp)
jmp    12be <iswctype+0xfe>
mov    -0x8(%rbp),%edi
call   10c0 <iswspace@plt>
mov    %eax,-0x4(%rbp)
jmp    12be <iswctype+0xfe>
mov    -0x8(%rbp),%edi
call   10a0 <iswupper@plt>
mov    %eax,-0x4(%rbp)
jmp    12be <iswctype+0xfe>
mov    -0x8(%rbp),%edi
call   1060 <iswxdigit@plt>
mov    %eax,-0x4(%rbp)
jmp    12be <iswctype+0xfe>
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     1214 <iswctype+0x54>
lea    0xe31(%rip),%rax
movslq (%rax,%rsi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
jmp    10b0 <iswalnum@plt>
jmp    10d0 <iswalpha@plt>
jmp    1080 <iswblank@plt>
jmp    1050 <iswcntrl@plt>
jmp    1070 <iswdigit@plt>
jmp    1090 <iswgraph@plt>
jmp    1030 <iswlower@plt>
jmp    10e0 <iswprint@plt>
jmp    1040 <iswpunct@plt>
jmp    10c0 <iswspace@plt>
jmp    10a0 <iswupper@plt>
jmp    1060 <iswxdigit@plt>
xor    %eax,%eax
ret

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

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