#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 /*<<< orphan*/ GL_LESS;
int GL_LINEAR;
int /*<<< orphan*/ GL_NICEST;
int /*<<< orphan*/ glClearIndex(int);
int /*<<< orphan*/ glDepthFunc(int /*<<< orphan*/);
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 myinit(void) {
  int i;
  glEnable(GL_DEPTH_TEST);
  glDepthFunc(GL_LESS);
  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, 0.0);
  glFogf(GL_FOG_END, 4.0);
  glHint(GL_FOG_HINT, GL_NICEST);
  glClearIndex((GLfloat)(32 + 16 - 1));
}


x86 assembly (clang, -O0):
<myinit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e21(%rip),%rax
mov    (%rax),%edi
call   1050 <glEnable@plt>
mov    0x2e03(%rip),%rax
mov    (%rax),%edi
call   1060 <glDepthFunc@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x20,-0x4(%rbp)
jge    11da <myinit+0x6a>
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   1090 <glutSetColor@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    119b <myinit+0x2b>
mov    0x2dd7(%rip),%rax
mov    (%rax),%edi
call   1050 <glEnable@plt>
mov    0x2dd1(%rip),%rax
mov    (%rax),%edi
mov    0x2de0(%rip),%rax
mov    (%rax),%esi
call   1080 <glFogi@plt>
mov    0x2daa(%rip),%rax
mov    (%rax),%edi
mov    $0x20,%esi
call   1080 <glFogi@plt>
mov    0x2dc7(%rip),%rax
mov    (%rax),%edi
xorps  %xmm0,%xmm0
call   1030 <glFogf@plt>
mov    0x2dc6(%rip),%rax
mov    (%rax),%edi
movsd  0xdcc(%rip),%xmm0
call   1030 <glFogf@plt>
mov    0x2d88(%rip),%rax
mov    (%rax),%edi
mov    0x2d5f(%rip),%rax
mov    (%rax),%esi
call   1070 <glHint@plt>
mov    $0x2f,%edi
call   1040 <glClearIndex@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myinit>:
push   %rbp
push   %rbx
push   %rax
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
call   1050 <glEnable@plt>
mov    0x2e08(%rip),%rax
mov    (%rax),%edi
call   1060 <glDepthFunc@plt>
mov    $0x20,%ebp
mov    $0x10,%ebx
nopl   0x0(%rax)
mov    %ebp,%ecx
shr    $0x5,%ecx
mov    %ebx,%edi
mov    %ecx,%esi
mov    %ecx,%edx
call   1090 <glutSetColor@plt>
add    $0x1,%ebx
add    $0xffffffff,%ebp
jne    11a0 <myinit+0x30>
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
call   1050 <glEnable@plt>
mov    0x2df3(%rip),%rax
mov    (%rax),%edi
mov    0x2e02(%rip),%rax
mov    (%rax),%esi
call   1080 <glFogi@plt>
mov    0x2dcc(%rip),%rax
mov    (%rax),%edi
mov    $0x20,%esi
call   1080 <glFogi@plt>
mov    0x2de9(%rip),%rax
mov    (%rax),%edi
xorps  %xmm0,%xmm0
call   1030 <glFogf@plt>
mov    0x2de8(%rip),%rax
mov    (%rax),%edi
movsd  0xdee(%rip),%xmm0
call   1030 <glFogf@plt>
mov    0x2daa(%rip),%rax
mov    (%rax),%edi
mov    0x2d81(%rip),%rax
mov    (%rax),%esi
call   1070 <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_LESS = 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 @myinit() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* @GL_DEPTH_TEST
%4 = call i32 @glEnable(i32 %3)
%5 = load i32, i32* @GL_LESS
%6 = call i32 @glDepthFunc(i32 %5)
store i32 0, i32* %1
br label %7
7: ; preds = %20, %0
%8 = load i32, i32* %1
%9 = icmp slt i32 %8, 32
br i1 %9, label %10, label %23
10: ; preds = %7
%11 = load i32, i32* %1
%12 = sub nsw i32 32, %11
%13 = sdiv i32 %12, 32
store i32 %13, i32* %2
%14 = load i32, i32* %1
%15 = add nsw i32 16, %14
%16 = load i32, i32* %2
%17 = load i32, i32* %2
%18 = load i32, i32* %2
%19 = call i32 @glutSetColor(i32 %15, i32 %16, i32 %17, i32 %18)
br label %20
20: ; preds = %10
%21 = load i32, i32* %1
%22 = add nsw i32 %21, 1
store i32 %22, i32* %1
br label %7
23: ; preds = %7
%24 = load i32, i32* @GL_FOG
%25 = call i32 @glEnable(i32 %24)
%26 = load i32, i32* @GL_FOG_MODE
%27 = load i32, i32* @GL_LINEAR
%28 = call i32 @glFogi(i32 %26, i32 %27)
%29 = load i32, i32* @GL_FOG_INDEX
%30 = call i32 @glFogi(i32 %29, i32 32)
%31 = load i32, i32* @GL_FOG_START
%32 = call i32 @glFogf(i32 %31, double 0.000000e+00)
%33 = load i32, i32* @GL_FOG_END
%34 = call i32 @glFogf(i32 %33, double 4.000000e+00)
%35 = load i32, i32* @GL_FOG_HINT
%36 = load i32, i32* @GL_NICEST
%37 = call i32 @glHint(i32 %35, i32 %36)
%38 = call i32 @glClearIndex(i32 47)
ret void
}

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