#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*/ GLUT_TRANSPARENT_INDEX;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ glClearIndex(int);
int /*<<< orphan*/ glIndexi(int);
int /*<<< orphan*/ glutEstablishOverlay();
int glutLayerGet(int /*<<< orphan*/);
int /*<<< orphan*/ glutRemoveOverlay();
int /*<<< orphan*/ glutSetColor(int, double, double, double);
void s2_menu(int option) {
  int transP;
  switch (option) {
  case 1:
    glutRemoveOverlay();
    break;
  case 2:
    glutEstablishOverlay();
    transP = glutLayerGet(GLUT_TRANSPARENT_INDEX);
    glClearIndex(transP);
    glutSetColor((transP + 1) % 2, 0.0, 0.25, 0.0);
    glIndexi((transP + 1) % 2);
    break;
  case 666:
    exit(0);
    break;
  }
}


x86 assembly (clang, -O0):
<s2_menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x1,%eax
je     11b3 <s2_menu+0x43>
jmp    118f <s2_menu+0x1f>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     11bf <s2_menu+0x4f>
jmp    11a0 <s2_menu+0x30>
mov    -0xc(%rbp),%eax
sub    $0x29a,%eax
je     121c <s2_menu+0xac>
jmp    1223 <s2_menu+0xb3>
mov    $0x0,%al
call   1060 <glutRemoveOverlay@plt>
jmp    1223 <s2_menu+0xb3>
mov    $0x0,%al
call   1040 <glutEstablishOverlay@plt>
mov    0x2e1b(%rip),%rax
mov    (%rax),%edi
call   1070 <glutLayerGet@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <glClearIndex@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
xorps  %xmm2,%xmm2
movsd  0xe06(%rip),%xmm1
movaps %xmm2,%xmm0
call   1090 <glutSetColor@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1050 <glIndexi@plt>
jmp    1223 <s2_menu+0xb3>
xor    %edi,%edi
call   1080 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s2_menu>:
push   %rbx
cmp    $0x1,%edi
je     1185 <s2_menu+0x15>
cmp    $0x2,%edi
je     118d <s2_menu+0x1d>
cmp    $0x29a,%edi
je     11df <s2_menu+0x6f>
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
jmp    1060 <glutRemoveOverlay@plt>
xor    %eax,%eax
call   1040 <glutEstablishOverlay@plt>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
call   1070 <glutLayerGet@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1030 <glClearIndex@plt>
mov    %ebx,%eax
add    $0x1,%eax
shr    $0x1f,%eax
add    %ebx,%eax
add    $0x1,%eax
and    $0xfffffffe,%eax
neg    %eax
add    %eax,%ebx
add    $0x1,%ebx
movsd  0xe36(%rip),%xmm1
xorps  %xmm0,%xmm0
xorps  %xmm2,%xmm2
mov    %ebx,%edi
call   1090 <glutSetColor@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1050 <glIndexi@plt>
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@GLUT_TRANSPARENT_INDEX = global i32 0
define void @s2_menu(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
switch i32 %4, label %23 [
i32 1, label %5
i32 2, label %7
i32 666, label %21
]
5: ; preds = %1
%6 = call i32 (...) @glutRemoveOverlay()
br label %23
7: ; preds = %1
%8 = call i32 (...) @glutEstablishOverlay()
%9 = load i32, i32* @GLUT_TRANSPARENT_INDEX
%10 = call i32 @glutLayerGet(i32 %9)
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = call i32 @glClearIndex(i32 %11)
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
%15 = srem i32 %14, 2
%16 = call i32 @glutSetColor(i32 %15, double 0.000000e+00, double 2.500000e-01, double 0.000000e+00)
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
%19 = srem i32 %18, 2
%20 = call i32 @glIndexi(i32 %19)
br label %23
21: ; preds = %1
%22 = call i32 @exit(i32 0)
unreachable
23: ; preds = %1, %7, %5
ret void
}

LLVM IR (-O2):
@GLUT_TRANSPARENT_INDEX = global i32 0
define void @s2_menu(i32 %0) {
switch i32 %0, label %15 [
i32 1, label %2
i32 2, label %4
i32 666, label %13
]
2: ; preds = %1
%3 = tail call i32 (...) @glutRemoveOverlay()
br label %15
4: ; preds = %1
%5 = tail call i32 (...) @glutEstablishOverlay()
%6 = load i32, i32* @GLUT_TRANSPARENT_INDEX
%7 = tail call i32 @glutLayerGet(i32 %6)
%8 = tail call i32 @glClearIndex(i32 %7)
%9 = add nsw i32 %7, 1
%10 = srem i32 %9, 2
%11 = tail call i32 @glutSetColor(i32 %10, double 0.000000e+00, double 2.500000e-01, double 0.000000e+00)
%12 = tail call i32 @glIndexi(i32 %10)
br label %15
13: ; preds = %1
%14 = tail call i32 @exit(i32 0)
unreachable
15: ; preds = %1, %4, %2
ret void
}