#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 */

/* Variables and functions */
#define GL_EXP 130
#define GL_EXP2 129
int /*<<< orphan*/ GL_FOG_END;
int /*<<< orphan*/ GL_FOG_MODE;
int /*<<< orphan*/ GL_FOG_START;
#define GL_LINEAR 128
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ glFogf(int /*<<< orphan*/, double);
int /*<<< orphan*/ glFogi(int /*<<< orphan*/, int);
int /*<<< orphan*/ glutPostRedisplay();
void selectFog(int mode) {
  switch (mode) {
  case GL_LINEAR:
    glFogf(GL_FOG_START, 1.0);
    glFogf(GL_FOG_END, 5.0);
  case GL_EXP2:
  case GL_EXP:
    glFogi(GL_FOG_MODE, mode);
    glutPostRedisplay();
    break;
  case 0:
    exit(0);
  }
}


x86 assembly (clang, -O0):
<selectFog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
test   %eax,%eax
je     11d0 <selectFog+0x90>
jmp    115e <selectFog+0x1e>
mov    -0x8(%rbp),%eax
sub    $0x80,%eax
je     1187 <selectFog+0x47>
jmp    1171 <selectFog+0x31>
mov    -0x8(%rbp),%eax
add    $0xffffff7f,%eax
sub    $0x2,%eax
jb     11b3 <selectFog+0x73>
jmp    11d7 <selectFog+0x97>
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
movsd  0xe70(%rip),%xmm0
call   1030 <glFogf@plt>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
movsd  0xe52(%rip),%xmm0
call   1030 <glFogf@plt>
mov    0x2e16(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
call   1050 <glFogi@plt>
mov    $0x0,%al
call   1040 <glutPostRedisplay@plt>
jmp    11d7 <selectFog+0x97>
xor    %edi,%edi
call   1060 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<selectFog>:
push   %rbx
mov    %edi,%ebx
lea    -0x81(%rbx),%eax
cmp    $0x2,%eax
jb     1188 <selectFog+0x48>
cmp    $0x80,%ebx
je     115c <selectFog+0x1c>
test   %ebx,%ebx
je     11a0 <selectFog+0x60>
pop    %rbx
ret
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
movsd  0xe93(%rip),%xmm0
call   1030 <glFogf@plt>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
movsd  0xe85(%rip),%xmm0
call   1030 <glFogf@plt>
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
mov    %ebx,%esi
call   1050 <glFogi@plt>
xor    %eax,%eax
pop    %rbx
jmp    1040 <glutPostRedisplay@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@GL_FOG_START = global i32 0
@GL_FOG_END = global i32 0
@GL_FOG_MODE = global i32 0
define void @selectFog(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %16 [
i32 128, label %4
i32 129, label %9
i32 130, label %9
i32 0, label %14
]
4: ; preds = %1
%5 = load i32, i32* @GL_FOG_START
%6 = call i32 @glFogf(i32 %5, double 1.000000e+00)
%7 = load i32, i32* @GL_FOG_END
%8 = call i32 @glFogf(i32 %7, double 5.000000e+00)
br label %9
9: ; preds = %1, %1, %4
%10 = load i32, i32* @GL_FOG_MODE
%11 = load i32, i32* %2
%12 = call i32 @glFogi(i32 %10, i32 %11)
%13 = call i32 (...) @glutPostRedisplay()
br label %16
14: ; preds = %1
%15 = call i32 @exit(i32 0)
unreachable
16: ; preds = %1, %9
ret void
}

LLVM IR (-O2):
@GL_FOG_START = global i32 0
@GL_FOG_END = global i32 0
@GL_FOG_MODE = global i32 0
define void @selectFog(i32 %0) {
switch i32 %0, label %13 [
i32 128, label %2
i32 129, label %7
i32 130, label %7
i32 0, label %11
]
2: ; preds = %1
%3 = load i32, i32* @GL_FOG_START
%4 = tail call i32 @glFogf(i32 %3, double 1.000000e+00)
%5 = load i32, i32* @GL_FOG_END
%6 = tail call i32 @glFogf(i32 %5, double 5.000000e+00)
br label %7
7: ; preds = %1, %1, %2
%8 = load i32, i32* @GL_FOG_MODE
%9 = tail call i32 @glFogi(i32 %8, i32 %0)
%10 = tail call i32 (...) @glutPostRedisplay()
br label %13
11: ; preds = %1
%12 = tail call i32 @exit(i32 0)
unreachable
13: ; preds = %1, %7
ret void
}