#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 */
int /*<<< orphan*/ GL_LIGHTING;
int /*<<< orphan*/ glDisable(int /*<<< orphan*/);
int /*<<< orphan*/ glEnable(int /*<<< orphan*/);
int /*<<< orphan*/ glutPostRedisplay();
int /*<<< orphan*/ printf(char *);
void menu(int value) {
  switch (value) {
  case 1:
    glEnable(GL_LIGHTING);
    printf("enable\n");
    break;
  case 2:
    glDisable(GL_LIGHTING);
    printf("disable\n");
    break;
  }
  glutPostRedisplay();
}


x86 assembly (clang, -O0):
<menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x1,%eax
je     1170 <menu+0x30>
jmp    115f <menu+0x1f>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
je     118f <menu+0x4f>
jmp    11a9 <menu+0x69>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
call   1040 <glEnable@plt>
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
jmp    11a9 <menu+0x69>
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
call   1060 <glDisable@plt>
lea    0xe64(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <glutPostRedisplay@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu>:
push   %rax
cmp    $0x2,%edi
je     1162 <menu+0x22>
cmp    $0x1,%edi
jne    117c <menu+0x3c>
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
call   1040 <glEnable@plt>
lea    0xea8(%rip),%rdi
jmp    1177 <menu+0x37>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
call   1060 <glDisable@plt>
lea    0xe89(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <glutPostRedisplay@plt>

LLVM IR (-O0):
@GL_LIGHTING = global i32 0
@.str = [8 x i8] c"enable\0A\00"
@.str.1 = [9 x i8] c"disable\0A\00"
define void @menu(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %12 [
i32 1, label %4
i32 2, label %8
]
4: ; preds = %1
%5 = load i32, i32* @GL_LIGHTING
%6 = call i32 @glEnable(i32 %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %12
8: ; preds = %1
%9 = load i32, i32* @GL_LIGHTING
%10 = call i32 @glDisable(i32 %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %1, %8, %4
%13 = call i32 (...) @glutPostRedisplay()
ret void
}

LLVM IR (-O2):
@GL_LIGHTING = global i32 0
@str = [8 x i8] c"disable\00"
@str.2 = [7 x i8] c"enable\00"
define void @menu(i32 %0) {
switch i32 %0, label %11 [
i32 1, label %2
i32 2, label %5
]
2: ; preds = %1
%3 = load i32, i32* @GL_LIGHTING
%4 = tail call i32 @glEnable(i32 %3)
br label %8
5: ; preds = %1
%6 = load i32, i32* @GL_LIGHTING
%7 = tail call i32 @glDisable(i32 %6)
br label %8
8: ; preds = %2, %5
%9 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0), %5 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @str.2, i64 0, i64 0), %2 ]
%10 = tail call i32 @puts(i8* dereferenceable(1) %9)
br label %11
11: ; preds = %8, %1
%12 = tail call i32 (...) @glutPostRedisplay()
ret void
}