#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 GLuint;
typedef int GLenum;

/* Variables and functions */
#define GL_BYTE 135
#define GL_DOUBLE 134
#define GL_FLOAT 133
#define GL_INT 132
#define GL_SHORT 131
#define GL_UNSIGNED_BYTE 130
#define GL_UNSIGNED_INT 129
#define GL_UNSIGNED_SHORT 128
int /*<<< orphan*/ printf(char *, int);
const GLuint gl_max_value(GLenum type) {
  switch (type) {
  case GL_DOUBLE:
  case GL_FLOAT:
    return 1;
  case GL_BYTE:
    return 127;
  case GL_UNSIGNED_BYTE:
    return 255;
  case GL_SHORT:
    return 32767;
  case GL_UNSIGNED_SHORT:
    return 65535;
  case GL_INT:
    return 2147483647;
  case GL_UNSIGNED_INT:
    return 4294967295;
  }
  printf("gl_max_value(): Unknown GL type 0x%x\n", type);
  return 0;
}


x86 assembly (clang, -O0):
<gl_max_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x7,%eax
ja     1198 <gl_max_value+0x88>
mov    -0x10(%rbp),%rax
lea    0xec5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x4(%rbp)
jmp    11ae <gl_max_value+0x9e>
movl   $0x7f,-0x4(%rbp)
jmp    11ae <gl_max_value+0x9e>
movl   $0xff,-0x4(%rbp)
jmp    11ae <gl_max_value+0x9e>
movl   $0x7fff,-0x4(%rbp)
jmp    11ae <gl_max_value+0x9e>
movl   $0xffff,-0x4(%rbp)
jmp    11ae <gl_max_value+0x9e>
movl   $0x7fffffff,-0x4(%rbp)
jmp    11ae <gl_max_value+0x9e>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ae <gl_max_value+0x9e>
mov    -0x8(%rbp),%esi
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gl_max_value>:
push   %rax
mov    %edi,%esi
lea    -0x80(%rsi),%eax
cmp    $0x8,%eax
jae    1129 <gl_max_value+0x19>
cltq
lea    0xf04(%rip),%rcx
mov    (%rcx,%rax,4),%eax
pop    %rcx
ret
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"gl_max_value(): Unknown GL type 0x%x\0A\00"
define i32 @gl_max_value(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %12 [
i32 134, label %5
i32 133, label %5
i32 135, label %6
i32 130, label %7
i32 131, label %8
i32 128, label %9
i32 132, label %10
i32 129, label %11
]
5: ; preds = %1, %1
store i32 1, i32* %2
br label %15
6: ; preds = %1
store i32 127, i32* %2
br label %15
7: ; preds = %1
store i32 255, i32* %2
br label %15
8: ; preds = %1
store i32 32767, i32* %2
br label %15
9: ; preds = %1
store i32 65535, i32* %2
br label %15
10: ; preds = %1
store i32 2147483647, i32* %2
br label %15
11: ; preds = %1
store i32 -1, i32* %2
br label %15
12: ; preds = %1
%13 = load i32, i32* %3
%14 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %13)
store i32 0, i32* %2
br label %15
15: ; preds = %12, %11, %10, %9, %8, %7, %6, %5
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
@.str = [38 x i8] c"gl_max_value(): Unknown GL type 0x%x\0A\00"
@switch.table.gl_max_value = [8 x i32] [i32 65535, i32 -1, i32 255, i32 32767, i32 2147483647, i32 1, i32 1, i32 127]
define i32 @gl_max_value(i32 %0) {
%2 = add i32 %0, -128
%3 = icmp ult i32 %2, 8
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %10
6: ; preds = %1
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds [8 x i32], [8 x i32]* @switch.table.gl_max_value, i64 0, i64 %7
%9 = load i32, i32* %8
br label %10
10: ; preds = %6, %4
%11 = phi i32 [ 0, %4 ], [ %9, %6 ]
ret i32 %11
}