#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;

/* Variables and functions */
#define GL_FOG_COLOR 134
#define GL_FOG_COORD_SRC 133
#define GL_FOG_DENSITY 132
#define GL_FOG_END 131
#define GL_FOG_INDEX 130
#define GL_FOG_MODE 129
#define GL_FOG_START 128
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
const size_t gl_fogv_length(GLenum name) {
  switch (name) {
  case GL_FOG_MODE:
  case GL_FOG_DENSITY:
  case GL_FOG_START:
  case GL_FOG_END:
  case GL_FOG_INDEX:
  case GL_FOG_COORD_SRC:
    return 1;
  case GL_FOG_COLOR:
    return 4;
  default:
    fprintf(stderr, "libGL: warning: gl_fogv_length unknown pname 0x%x\n",
            name);
    return 1;
  }
}


x86 assembly (clang, -O0):
<gl_fogv_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
add    $0xffffff80,%eax
sub    $0x6,%eax
jb     1145 <gl_fogv_length+0x35>
jmp    1132 <gl_fogv_length+0x22>
mov    -0x10(%rbp),%eax
sub    $0x86,%eax
je     1152 <gl_fogv_length+0x42>
jmp    115f <gl_fogv_length+0x4f>
movq   $0x1,-0x8(%rbp)
jmp    117f <gl_fogv_length+0x6f>
movq   $0x4,-0x8(%rbp)
jmp    117f <gl_fogv_length+0x6f>
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
lea    0xe8e(%rip),%rsi
call   1030 <fprintf@plt>
movq   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gl_fogv_length>:
push   %rax
mov    %edi,%edx
lea    -0x80(%rdx),%eax
cmp    $0x7,%eax
jae    112a <gl_fogv_length+0x1a>
cltq
lea    0xf14(%rip),%rcx
mov    (%rcx,%rax,8),%rax
pop    %rcx
ret
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
lea    0xec6(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [51 x i8] c"libGL: warning: gl_fogv_length unknown pname 0x%x\0A\00"
define i64 @gl_fogv_length(i32 %0) {
%2 = alloca i64
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %7 [
i32 129, label %5
i32 132, label %5
i32 128, label %5
i32 131, label %5
i32 130, label %5
i32 133, label %5
i32 134, label %6
]
5: ; preds = %1, %1, %1, %1, %1, %1
store i64 1, i64* %2
br label %11
6: ; preds = %1
store i64 4, i64* %2
br label %11
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = load i32, i32* %3
%10 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 %9)
store i64 1, i64* %2
br label %11
11: ; preds = %7, %6, %5
%12 = load i64, i64* %2
ret i64 %12
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [51 x i8] c"libGL: warning: gl_fogv_length unknown pname 0x%x\0A\00"
@switch.table.gl_fogv_length = [7 x i64] [i64 1, i64 1, i64 1, i64 1, i64 1, i64 1, i64 4]
define i64 @gl_fogv_length(i32 %0) {
%2 = add i32 %0, -128
%3 = icmp ult i32 %2, 7
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %11
7: ; preds = %1
%8 = sext i32 %2 to i64
%9 = getelementptr inbounds [7 x i64], [7 x i64]* @switch.table.gl_fogv_length, i64 0, i64 %8
%10 = load i64, i64* %9
br label %11
11: ; preds = %7, %4
%12 = phi i64 [ 1, %4 ], [ %10, %7 ]
ret i64 %12
}