#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 GLenum;
typedef int /*<<< orphan*/ GLboolean;

/* Variables and functions */
#define GL_BITMAP 147
#define GL_BYTE 146
int /*<<< orphan*/ GL_FALSE;
#define GL_FLOAT 145
#define GL_INT 144
#define GL_SHORT 143
int /*<<< orphan*/ GL_TRUE;
#define GL_UNSIGNED_BYTE 142
#define GL_UNSIGNED_BYTE_2_3_3_REV 141
#define GL_UNSIGNED_BYTE_3_3_2 140
#define GL_UNSIGNED_INT 139
#define GL_UNSIGNED_INT_10_10_10_2 138
#define GL_UNSIGNED_INT_2_10_10_10_REV 137
#define GL_UNSIGNED_INT_8_8_8_8 136
#define GL_UNSIGNED_INT_8_8_8_8_REV 135
#define GL_UNSIGNED_SHORT 134
#define GL_UNSIGNED_SHORT_1_5_5_5_REV 133
#define GL_UNSIGNED_SHORT_4_4_4_4 132
#define GL_UNSIGNED_SHORT_4_4_4_4_REV 131
#define GL_UNSIGNED_SHORT_5_5_5_1 130
#define GL_UNSIGNED_SHORT_5_6_5 129
#define GL_UNSIGNED_SHORT_5_6_5_REV 128
GLboolean legalType(GLenum type) {
  switch (type) {
  case GL_BITMAP:
  case GL_BYTE:
  case GL_UNSIGNED_BYTE:
  case GL_SHORT:
  case GL_UNSIGNED_SHORT:
  case GL_INT:
  case GL_UNSIGNED_INT:
  case GL_FLOAT:
  case GL_UNSIGNED_BYTE_3_3_2:
  case GL_UNSIGNED_BYTE_2_3_3_REV:
  case GL_UNSIGNED_SHORT_5_6_5:
  case GL_UNSIGNED_SHORT_5_6_5_REV:
  case GL_UNSIGNED_SHORT_4_4_4_4:
  case GL_UNSIGNED_SHORT_4_4_4_4_REV:
  case GL_UNSIGNED_SHORT_5_5_5_1:
  case GL_UNSIGNED_SHORT_1_5_5_5_REV:
  case GL_UNSIGNED_INT_8_8_8_8:
  case GL_UNSIGNED_INT_8_8_8_8_REV:
  case GL_UNSIGNED_INT_10_10_10_2:
  case GL_UNSIGNED_INT_2_10_10_10_REV:
    return GL_TRUE;
  default:
    return GL_FALSE;
  }
}


x86 assembly (clang, -O0):
<legalType>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffff80,%eax
sub    $0x13,%eax
ja     112c <legalType+0x2c>
jmp    111b <legalType+0x1b>
mov    0x2eb6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1138 <legalType+0x38>
mov    0x2eb5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<legalType>:
add    $0xffffff80,%edi
cmp    $0x14,%edi
jae    1112 <legalType+0x12>
mov    0x2ec9(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2ecf(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@GL_TRUE = global i32 0
@GL_FALSE = global i32 0
define i32 @legalType(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %7 [
i32 147, label %5
i32 146, label %5
i32 142, label %5
i32 143, label %5
i32 134, label %5
i32 144, label %5
i32 139, label %5
i32 145, label %5
i32 140, label %5
i32 141, label %5
i32 129, label %5
i32 128, label %5
i32 132, label %5
i32 131, label %5
i32 130, label %5
i32 133, label %5
i32 136, label %5
i32 135, label %5
i32 138, label %5
i32 137, label %5
]
5: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1
%6 = load i32, i32* @GL_TRUE
store i32 %6, i32* %2
br label %9
7: ; preds = %1
%8 = load i32, i32* @GL_FALSE
store i32 %8, i32* %2
br label %9
9: ; preds = %7, %5
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
@GL_TRUE = global i32 0
@GL_FALSE = global i32 0
define i32 @legalType(i32 %0) {
%2 = add i32 %0, -128
%3 = icmp ult i32 %2, 20
%4 = load i32, i32* @GL_TRUE
%5 = load i32, i32* @GL_FALSE
%6 = select i1 %3, i32 %4, i32 %5
ret i32 %6
}