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

/* Variables and functions */
#define GL_DEPTH_BUFFER_BIT 146
#define GL_DEPTH_CLEAR_VALUE 145
#define GL_DEPTH_FUNC 144
#define GL_DEPTH_TEST 143
#define GL_DEPTH_WRITEMASK 142
#define GL_FOG 141
#define GL_FOG_BIT 140
#define GL_FOG_COLOR 139
#define GL_FOG_DENSITY 138
#define GL_FOG_END 137
#define GL_FOG_INDEX 136
#define GL_FOG_MODE 135
#define GL_FOG_START 134
#define GL_LINE_BIT 133
#define GL_LINE_SMOOTH 132
#define GL_LINE_STIPPLE 131
#define GL_LINE_STIPPLE_PATTERN 130
#define GL_LINE_STIPPLE_REPEAT 129
#define GL_LINE_WIDTH 128
int /*<<< orphan*/ PrintState(int, scalar_t__ const);
int /*<<< orphan*/ printf(char *);
void PrintAttribState(GLbitfield attrib) {
  static const GLenum depth_buffer_enums[] = {
      GL_DEPTH_FUNC, GL_DEPTH_CLEAR_VALUE, GL_DEPTH_TEST, GL_DEPTH_WRITEMASK,
      0};
  static const GLenum fog_enums[] = {
      GL_FOG,     GL_FOG_COLOR, GL_FOG_DENSITY, GL_FOG_START,
      GL_FOG_END, GL_FOG_INDEX, GL_FOG_MODE,    0};
  static const GLenum line_enums[] = {
      GL_LINE_SMOOTH,         GL_LINE_STIPPLE, GL_LINE_STIPPLE_PATTERN,
      GL_LINE_STIPPLE_REPEAT, GL_LINE_WIDTH,   0};
  const GLenum *enumList = NULL;
  switch (attrib) {
  case GL_DEPTH_BUFFER_BIT:
    enumList = depth_buffer_enums;
    printf("GL_DEPTH_BUFFER_BIT state:\n");
    break;
  case GL_FOG_BIT:
    enumList = fog_enums;
    printf("GL_FOG_BIT state:\n");
    break;
  case GL_LINE_BIT:
    enumList = line_enums;
    printf("GL_LINE_BIT state:\n");
    break;
  default:
    printf("Bad value in PrintAttribState()\n");
  }
  if (enumList) {
    int i;
    for (i = 0; enumList[i]; i++)
      PrintState(3, enumList[i]);
  }
}


x86 assembly (clang, -O0):
<PrintAttribState>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x85,%eax
je     11a7 <PrintAttribState+0x87>
jmp    1149 <PrintAttribState+0x29>
mov    -0x18(%rbp),%eax
sub    $0x8c,%eax
je     118b <PrintAttribState+0x6b>
jmp    115c <PrintAttribState+0x3c>
mov    -0x18(%rbp),%eax
sub    $0x92,%eax
jne    11c3 <PrintAttribState+0xa3>
jmp    116f <PrintAttribState+0x4f>
lea    0xe8a(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xf1f(%rip),%rdi
call   1030 <printf@plt>
jmp    11cf <PrintAttribState+0xaf>
lea    0xe9e(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xf1f(%rip),%rdi
call   1030 <printf@plt>
jmp    11cf <PrintAttribState+0xaf>
lea    0xec2(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xf16(%rip),%rdi
call   1030 <printf@plt>
jmp    11cf <PrintAttribState+0xaf>
lea    0xf19(%rip),%rdi
call   1030 <printf@plt>
cmpq   $0x0,-0x10(%rbp)
je     121d <PrintAttribState+0xfd>
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1218 <PrintAttribState+0xf8>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    $0x3,%edi
call   1040 <PrintState@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e1 <PrintAttribState+0xc1>
jmp    121d <PrintAttribState+0xfd>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintAttribState>:
push   %rbx
cmp    $0x85,%edi
je     1149 <PrintAttribState+0x29>
cmp    $0x92,%edi
je     1159 <PrintAttribState+0x39>
cmp    $0x8c,%edi
jne    1198 <PrintAttribState+0x78>
lea    0xef0(%rip),%rbx
lea    0xf6c(%rip),%rdi
jmp    1167 <PrintAttribState+0x47>
lea    0xf20(%rip),%rbx
lea    0xf49(%rip),%rdi
jmp    1167 <PrintAttribState+0x47>
lea    0xea0(%rip),%rbx
lea    0xf5e(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%rsi
test   %rsi,%rsi
je     1196 <PrintAttribState+0x76>
add    $0x8,%rbx
nopl   0x0(%rax,%rax,1)
mov    $0x3,%edi
call   1040 <PrintState@plt>
mov    (%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1180 <PrintAttribState+0x60>
pop    %rbx
ret
lea    0xf41(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@PrintAttribState.depth_buffer_enums = internal constant [5 x i64] [i64 144, i64 145, i64 143, i64 142, i64 0]
@PrintAttribState.fog_enums = internal constant [8 x i64] [i64 141, i64 139, i64 138, i64 134, i64 137, i64 136, i64 135, i64 0]
@PrintAttribState.line_enums = internal constant [6 x i64] [i64 132, i64 131, i64 130, i64 129, i64 128, i64 0]
@.str = [28 x i8] c"GL_DEPTH_BUFFER_BIT state:\0A\00"
@.str.1 = [19 x i8] c"GL_FOG_BIT state:\0A\00"
@.str.2 = [20 x i8] c"GL_LINE_BIT state:\0A\00"
@.str.3 = [33 x i8] c"Bad value in PrintAttribState()\0A\00"
define void @PrintAttribState(i32 %0) {
%2 = alloca i32
%3 = alloca i64*
%4 = alloca i32
store i32 %0, i32* %2
store i64* null, i64** %3
%5 = load i32, i32* %2
switch i32 %5, label %12 [
i32 146, label %6
i32 140, label %8
i32 133, label %10
]
6: ; preds = %1
store i64* getelementptr inbounds ([5 x i64], [5 x i64]* @PrintAttribState.depth_buffer_enums, i64 0, i64 0), i64** %3
%7 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %14
8: ; preds = %1
store i64* getelementptr inbounds ([8 x i64], [8 x i64]* @PrintAttribState.fog_enums, i64 0, i64 0), i64** %3
%9 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %14
10: ; preds = %1
store i64* getelementptr inbounds ([6 x i64], [6 x i64]* @PrintAttribState.line_enums, i64 0, i64 0), i64** %3
%11 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %14
12: ; preds = %1
%13 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
br label %14
14: ; preds = %12, %10, %8, %6
%15 = load i64*, i64** %3
%16 = icmp ne i64* %15, null
br i1 %16, label %17, label %36
17: ; preds = %14
store i32 0, i32* %4
br label %18
18: ; preds = %32, %17
%19 = load i64*, i64** %3
%20 = load i32, i32* %4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i64, i64* %19, i64 %21
%23 = load i64, i64* %22
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %35
25: ; preds = %18
%26 = load i64*, i64** %3
%27 = load i32, i32* %4
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i64, i64* %26, i64 %28
%30 = load i64, i64* %29
%31 = call i32 @PrintState(i32 3, i64 %30)
br label %32
32: ; preds = %25
%33 = load i32, i32* %4
%34 = add nsw i32 %33, 1
store i32 %34, i32* %4
br label %18
35: ; preds = %18
br label %36
36: ; preds = %35, %14
ret void
}

LLVM IR (-O2):
@PrintAttribState.depth_buffer_enums = internal unnamed_addr constant [5 x i64] [i64 144, i64 145, i64 143, i64 142, i64 0]
@PrintAttribState.fog_enums = internal unnamed_addr constant [8 x i64] [i64 141, i64 139, i64 138, i64 134, i64 137, i64 136, i64 135, i64 0]
@PrintAttribState.line_enums = internal unnamed_addr constant [6 x i64] [i64 132, i64 131, i64 130, i64 129, i64 128, i64 0]
@str = [19 x i8] c"GL_LINE_BIT state:\00"
@str.4 = [18 x i8] c"GL_FOG_BIT state:\00"
@str.5 = [27 x i8] c"GL_DEPTH_BUFFER_BIT state:\00"
@str.6 = [32 x i8] c"Bad value in PrintAttribState()\00"
define void @PrintAttribState(i32 %0) {
switch i32 %0, label %4 [
i32 146, label %6
i32 140, label %2
i32 133, label %3
]
2: ; preds = %1
br label %6
3: ; preds = %1
br label %6
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.6, i64 0, i64 0))
br label %20
6: ; preds = %1, %3, %2
%7 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0), %3 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @str.4, i64 0, i64 0), %2 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @str.5, i64 0, i64 0), %1 ]
%8 = phi i64* [ getelementptr inbounds ([6 x i64], [6 x i64]* @PrintAttribState.line_enums, i64 0, i64 0), %3 ], [ getelementptr inbounds ([8 x i64], [8 x i64]* @PrintAttribState.fog_enums, i64 0, i64 0), %2 ], [ getelementptr inbounds ([5 x i64], [5 x i64]* @PrintAttribState.depth_buffer_enums, i64 0, i64 0), %1 ]
%9 = tail call i32 @puts(i8* dereferenceable(1) %7)
%10 = load i64, i64* %8
%11 = icmp eq i64 %10, 0
br i1 %11, label %20, label %12
12: ; preds = %6, %12
%13 = phi i64 [ %16, %12 ], [ 0, %6 ]
%14 = phi i64 [ %18, %12 ], [ %10, %6 ]
%15 = tail call i32 @PrintState(i32 3, i64 %14)
%16 = add nuw i64 %13, 1
%17 = getelementptr inbounds i64, i64* %8, i64 %16
%18 = load i64, i64* %17
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %12
20: ; preds = %12, %6, %4
ret void
}