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

/* Variables and functions */
int /*<<< orphan*/ GL_DEPTH_TEST;
int /*<<< orphan*/ GL_FOG;
int /*<<< orphan*/ GL_FOG_END;
int /*<<< orphan*/ GL_FOG_HINT;
int /*<<< orphan*/ GL_FOG_INDEX;
int /*<<< orphan*/ GL_FOG_MODE;
int /*<<< orphan*/ GL_FOG_START;
int GL_LINEAR;
int /*<<< orphan*/ GL_NICEST;
int /*<<< orphan*/ glClearIndex(int);
int /*<<< orphan*/ glEnable(int /*<<< orphan*/);
int /*<<< orphan*/ glFogf(int /*<<< orphan*/, double);
int /*<<< orphan*/ glFogi(int /*<<< orphan*/, int);
int /*<<< orphan*/ glHint(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ glutSetColor(int, int, int, int);
void fogindex_init(void) {
  int i;
  glEnable(GL_DEPTH_TEST);
  for (i = 0; i < 32; ++i) {
    GLfloat shade;
    shade = (GLfloat)(32 - i) / (GLfloat)32;
    glutSetColor(16 + i, shade, shade, shade);
  }
  glEnable(GL_FOG);
  glFogi(GL_FOG_MODE, GL_LINEAR);
  glFogi(GL_FOG_INDEX, 32);
  glFogf(GL_FOG_START, 1.0);
  glFogf(GL_FOG_END, 6.0);
  glHint(GL_FOG_HINT, GL_NICEST);
  glClearIndex((GLfloat)(32 + 16 - 1));
}


x86 assembly (clang, -O0):
<fogindex_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e31(%rip),%rax
mov    (%rax),%edi
call   1050 <glEnable@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x20,-0x4(%rbp)
jge    11bc <fogindex_init+0x5c>
mov    $0x20,%eax
sub    -0x4(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
add    $0x10,%edi
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x8(%rbp),%ecx
call   1080 <glutSetColor@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    117d <fogindex_init+0x1d>
mov    0x2df5(%rip),%rax
mov    (%rax),%edi
call   1050 <glEnable@plt>
mov    0x2def(%rip),%rax
mov    (%rax),%edi
mov    0x2dfe(%rip),%rax
mov    (%rax),%esi
call   1070 <glFogi@plt>
mov    0x2dc8(%rip),%rax
mov    (%rax),%edi
mov    $0x20,%esi
call   1070 <glFogi@plt>
mov    0x2de5(%rip),%rax
mov    (%rax),%edi
movsd  0xe03(%rip),%xmm0
call   1030 <glFogf@plt>
mov    0x2ddf(%rip),%rax
mov    (%rax),%edi
movsd  0xde5(%rip),%xmm0
call   1030 <glFogf@plt>
mov    0x2da1(%rip),%rax
mov    (%rax),%edi
mov    0x2d78(%rip),%rax
mov    (%rax),%esi
call   1060 <glHint@plt>
mov    $0x2f,%edi
call   1040 <glClearIndex@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fogindex_init>:
push   %rbp
push   %rbx
push   %rax
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
call   1050 <glEnable@plt>
mov    $0x20,%ebp
mov    $0x10,%ebx
nopl   0x0(%rax,%rax,1)
mov    %ebp,%ecx
shr    $0x5,%ecx
mov    %ebx,%edi
mov    %ecx,%esi
mov    %ecx,%edx
call   1080 <glutSetColor@plt>
add    $0x1,%ebx
add    $0xffffffff,%ebp
jne    1180 <fogindex_init+0x20>
mov    0x2e19(%rip),%rax
mov    (%rax),%edi
call   1050 <glEnable@plt>
mov    0x2e13(%rip),%rax
mov    (%rax),%edi
mov    0x2e22(%rip),%rax
mov    (%rax),%esi
call   1070 <glFogi@plt>
mov    0x2dec(%rip),%rax
mov    (%rax),%edi
mov    $0x20,%esi
call   1070 <glFogi@plt>
mov    0x2e09(%rip),%rax
mov    (%rax),%edi
movsd  0xe1f(%rip),%xmm0
call   1030 <glFogf@plt>
mov    0x2e03(%rip),%rax
mov    (%rax),%edi
movsd  0xe11(%rip),%xmm0
call   1030 <glFogf@plt>
mov    0x2dc5(%rip),%rax
mov    (%rax),%edi
mov    0x2d9c(%rip),%rax
mov    (%rax),%esi
call   1060 <glHint@plt>
mov    $0x2f,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <glClearIndex@plt>

LLVM IR (-O0):
@GL_DEPTH_TEST = global i32 0
@GL_FOG = global i32 0
@GL_FOG_MODE = global i32 0
@GL_LINEAR = global i32 0
@GL_FOG_INDEX = global i32 0
@GL_FOG_START = global i32 0
@GL_FOG_END = global i32 0
@GL_FOG_HINT = global i32 0
@GL_NICEST = global i32 0
define void @fogindex_init() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* @GL_DEPTH_TEST
%4 = call i32 @glEnable(i32 %3)
store i32 0, i32* %1
br label %5
5: ; preds = %18, %0
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 32
br i1 %7, label %8, label %21
8: ; preds = %5
%9 = load i32, i32* %1
%10 = sub nsw i32 32, %9
%11 = sdiv i32 %10, 32
store i32 %11, i32* %2
%12 = load i32, i32* %1
%13 = add nsw i32 16, %12
%14 = load i32, i32* %2
%15 = load i32, i32* %2
%16 = load i32, i32* %2
%17 = call i32 @glutSetColor(i32 %13, i32 %14, i32 %15, i32 %16)
br label %18
18: ; preds = %8
%19 = load i32, i32* %1
%20 = add nsw i32 %19, 1
store i32 %20, i32* %1
br label %5
21: ; preds = %5
%22 = load i32, i32* @GL_FOG
%23 = call i32 @glEnable(i32 %22)
%24 = load i32, i32* @GL_FOG_MODE
%25 = load i32, i32* @GL_LINEAR
%26 = call i32 @glFogi(i32 %24, i32 %25)
%27 = load i32, i32* @GL_FOG_INDEX
%28 = call i32 @glFogi(i32 %27, i32 32)
%29 = load i32, i32* @GL_FOG_START
%30 = call i32 @glFogf(i32 %29, double 1.000000e+00)
%31 = load i32, i32* @GL_FOG_END
%32 = call i32 @glFogf(i32 %31, double 6.000000e+00)
%33 = load i32, i32* @GL_FOG_HINT
%34 = load i32, i32* @GL_NICEST
%35 = call i32 @glHint(i32 %33, i32 %34)
%36 = call i32 @glClearIndex(i32 47)
ret void
}

LLVM IR (-O2):
@GL_DEPTH_TEST = global i32 0
@GL_FOG = global i32 0
@GL_FOG_MODE = global i32 0
@GL_LINEAR = global i32 0
@GL_FOG_INDEX = global i32 0
@GL_FOG_START = global i32 0
@GL_FOG_END = global i32 0
@GL_FOG_HINT = global i32 0
@GL_NICEST = global i32 0
define void @fogindex_init() {
%1 = load i32, i32* @GL_DEPTH_TEST
%2 = tail call i32 @glEnable(i32 %1)
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 0, %0 ], [ %9, %3 ]
%5 = sub nuw nsw i32 32, %4
%6 = lshr i32 %5, 5
%7 = add nuw nsw i32 %4, 16
%8 = tail call i32 @glutSetColor(i32 %7, i32 %6, i32 %6, i32 %6)
%9 = add nuw nsw i32 %4, 1
%10 = icmp eq i32 %9, 32
br i1 %10, label %11, label %3
11: ; preds = %3
%12 = load i32, i32* @GL_FOG
%13 = tail call i32 @glEnable(i32 %12)
%14 = load i32, i32* @GL_FOG_MODE
%15 = load i32, i32* @GL_LINEAR
%16 = tail call i32 @glFogi(i32 %14, i32 %15)
%17 = load i32, i32* @GL_FOG_INDEX
%18 = tail call i32 @glFogi(i32 %17, i32 32)
%19 = load i32, i32* @GL_FOG_START
%20 = tail call i32 @glFogf(i32 %19, double 1.000000e+00)
%21 = load i32, i32* @GL_FOG_END
%22 = tail call i32 @glFogf(i32 %21, double 6.000000e+00)
%23 = load i32, i32* @GL_FOG_HINT
%24 = load i32, i32* @GL_NICEST
%25 = tail call i32 @glHint(i32 %23, i32 %24)
%26 = tail call i32 @glClearIndex(i32 47)
ret void
}