#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 /*<<< orphan*/ assert(int /*<<< orphan*/);
int error_kind(int error_code) {
  static struct {
    int error_code;
    int kind;
  } kinds[] = {{1, 1},  {2, 1},  {3, 1},  {4, 1},  {5, 1},  {6, 1},
               {7, 1},  {8, 1},  {9, 1},  {10, 1}, {11, 0}, {12, 0},
               {13, 0}, {14, 0}, {15, 1}, {16, 1}, {17, 1}, {18, 1},
               {19, 1}, {20, 1}, {21, 0}, {-1, -1}};
  int i;
  for (i = 0; kinds[i].error_code >= 0; ++i)
    if (kinds[i].error_code == error_code)
      return kinds[i].kind;
  assert(0);
  return -1;
}


x86 assembly (clang, -O0):
<error_kind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movslq -0xc(%rbp),%rcx
lea    0x2f03(%rip),%rax
cmpl   $0x0,(%rax,%rcx,8)
jl     1178 <error_kind+0x68>
movslq -0xc(%rbp),%rcx
lea    0x2eee(%rip),%rax
mov    (%rax,%rcx,8),%eax
cmp    -0x8(%rbp),%eax
jne    1165 <error_kind+0x55>
movslq -0xc(%rbp),%rcx
lea    0x2ed7(%rip),%rax
mov    0x4(%rax,%rcx,8),%eax
mov    %eax,-0x4(%rbp)
jmp    1186 <error_kind+0x76>
jmp    116a <error_kind+0x5a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1122 <error_kind+0x12>
xor    %edi,%edi
call   1030 <assert@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<error_kind>:
push   %rax
add    $0xffffffff,%edi
cmp    $0x14,%edi
ja     1128 <error_kind+0x18>
mov    %edi,%eax
lea    0xede(%rip),%rcx
mov    0x4(%rcx,%rax,8),%eax
pop    %rcx
ret
xor    %edi,%edi
call   1030 <assert@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.anon = type { i32, i32 }
@error_kind.kinds = internal global [22 x %struct.anon] [%struct.anon { i32 1, i32 1 }, %struct.anon { i32 2, i32 1 }, %struct.anon { i32 3, i32 1 }, %struct.anon { i32 4, i32 1 }, %struct.anon { i32 5, i32 1 }, %struct.anon { i32 6, i32 1 }, %struct.anon { i32 7, i32 1 }, %struct.anon { i32 8, i32 1 }, %struct.anon { i32 9, i32 1 }, %struct.anon { i32 10, i32 1 }, %struct.anon { i32 11, i32 0 }, %struct.anon { i32 12, i32 0 }, %struct.anon { i32 13, i32 0 }, %struct.anon { i32 14, i32 0 }, %struct.anon { i32 15, i32 1 }, %struct.anon { i32 16, i32 1 }, %struct.anon { i32 17, i32 1 }, %struct.anon { i32 18, i32 1 }, %struct.anon { i32 19, i32 1 }, %struct.anon { i32 20, i32 1 }, %struct.anon { i32 21, i32 0 }, %struct.anon { i32 -1, i32 -1 }]
define i32 @error_kind(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %27, %1
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [22 x %struct.anon], [22 x %struct.anon]* @error_kind.kinds, i64 0, i64 %7
%9 = getelementptr inbounds %struct.anon, %struct.anon* %8, i32 0, i32 0
%10 = load i32, i32* %9
%11 = icmp sge i32 %10, 0
br i1 %11, label %12, label %30
12: ; preds = %5
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [22 x %struct.anon], [22 x %struct.anon]* @error_kind.kinds, i64 0, i64 %14
%16 = getelementptr inbounds %struct.anon, %struct.anon* %15, i32 0, i32 0
%17 = load i32, i32* %16
%18 = load i32, i32* %3
%19 = icmp eq i32 %17, %18
br i1 %19, label %20, label %26
20: ; preds = %12
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [22 x %struct.anon], [22 x %struct.anon]* @error_kind.kinds, i64 0, i64 %22
%24 = getelementptr inbounds %struct.anon, %struct.anon* %23, i32 0, i32 1
%25 = load i32, i32* %24
store i32 %25, i32* %2
br label %32
26: ; preds = %12
br label %27
27: ; preds = %26
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %5
30: ; preds = %5
%31 = call i32 @assert(i32 0)
store i32 -1, i32* %2
br label %32
32: ; preds = %30, %20
%33 = load i32, i32* %2
ret i32 %33
}

LLVM IR (-O2):
%struct.anon = type { i32, i32 }
@error_kind.kinds = internal unnamed_addr constant [22 x %struct.anon] [%struct.anon { i32 1, i32 1 }, %struct.anon { i32 2, i32 1 }, %struct.anon { i32 3, i32 1 }, %struct.anon { i32 4, i32 1 }, %struct.anon { i32 5, i32 1 }, %struct.anon { i32 6, i32 1 }, %struct.anon { i32 7, i32 1 }, %struct.anon { i32 8, i32 1 }, %struct.anon { i32 9, i32 1 }, %struct.anon { i32 10, i32 1 }, %struct.anon { i32 11, i32 0 }, %struct.anon { i32 12, i32 0 }, %struct.anon { i32 13, i32 0 }, %struct.anon { i32 14, i32 0 }, %struct.anon { i32 15, i32 1 }, %struct.anon { i32 16, i32 1 }, %struct.anon { i32 17, i32 1 }, %struct.anon { i32 18, i32 1 }, %struct.anon { i32 19, i32 1 }, %struct.anon { i32 20, i32 1 }, %struct.anon { i32 21, i32 0 }, %struct.anon { i32 -1, i32 -1 }]
define i32 @error_kind(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 21
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = zext i32 %2 to i64
%6 = getelementptr inbounds [22 x %struct.anon], [22 x %struct.anon]* @error_kind.kinds, i64 0, i64 %5, i32 1
%7 = load i32, i32* %6
br label %10
8: ; preds = %1
%9 = tail call i32 @assert(i32 0)
br label %10
10: ; preds = %8, %4
%11 = phi i32 [ %7, %4 ], [ -1, %8 ]
ret i32 %11
}