#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*/ glColor3f(double, double, double);
int /*<<< orphan*/ glutPostRedisplay();
void selectColor(int color) {
  switch (color) {
  case 1:
    glColor3f(0.0, 1.0, 0.0);
    break;
  case 2:
    glColor3f(1.0, 0.0, 0.0);
    break;
  case 3:
    glColor3f(1.0, 1.0, 1.0);
    break;
  }
  glutPostRedisplay();
}


x86 assembly (clang, -O0):
<selectColor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x1,%eax
je     1161 <selectColor+0x41>
jmp    113f <selectColor+0x1f>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
je     1179 <selectColor+0x59>
jmp    1150 <selectColor+0x30>
mov    -0x8(%rbp),%eax
sub    $0x3,%eax
je     1191 <selectColor+0x71>
jmp    11a4 <selectColor+0x84>
xorps  %xmm2,%xmm2
movsd  0xe94(%rip),%xmm1
movaps %xmm2,%xmm0
call   1030 <glColor3f@plt>
jmp    11a4 <selectColor+0x84>
movsd  0xe7f(%rip),%xmm0
xorps  %xmm2,%xmm2
movaps %xmm2,%xmm1
call   1030 <glColor3f@plt>
jmp    11a4 <selectColor+0x84>
movsd  0xe67(%rip),%xmm2
movaps %xmm2,%xmm0
movaps %xmm2,%xmm1
call   1030 <glColor3f@plt>
mov    $0x0,%al
call   1040 <glutPostRedisplay@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<selectColor>:
push   %rax
cmp    $0x3,%edi
je     113d <selectColor+0x1d>
cmp    $0x2,%edi
je     114d <selectColor+0x2d>
cmp    $0x1,%edi
jne    1160 <selectColor+0x40>
movsd  0xec8(%rip),%xmm1
xorps  %xmm0,%xmm0
jmp    1158 <selectColor+0x38>
movsd  0xebb(%rip),%xmm0
movaps %xmm0,%xmm1
movaps %xmm0,%xmm2
jmp    115b <selectColor+0x3b>
movsd  0xeab(%rip),%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
call   1030 <glColor3f@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <glutPostRedisplay@plt>

LLVM IR (-O0):
define void @selectColor(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %10 [
i32 1, label %4
i32 2, label %6
i32 3, label %8
]
4: ; preds = %1
%5 = call i32 @glColor3f(double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
br label %10
6: ; preds = %1
%7 = call i32 @glColor3f(double 1.000000e+00, double 0.000000e+00, double 0.000000e+00)
br label %10
8: ; preds = %1
%9 = call i32 @glColor3f(double 1.000000e+00, double 1.000000e+00, double 1.000000e+00)
br label %10
10: ; preds = %1, %8, %6, %4
%11 = call i32 (...) @glutPostRedisplay()
ret void
}

LLVM IR (-O2):
define void @selectColor(i32 %0) {
switch i32 %0, label %8 [
i32 1, label %2
i32 2, label %4
i32 3, label %6
]
2: ; preds = %1
%3 = tail call i32 @glColor3f(double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
br label %8
4: ; preds = %1
%5 = tail call i32 @glColor3f(double 1.000000e+00, double 0.000000e+00, double 0.000000e+00)
br label %8
6: ; preds = %1
%7 = tail call i32 @glColor3f(double 1.000000e+00, double 1.000000e+00, double 1.000000e+00)
br label %8
8: ; preds = %1, %6, %4, %2
%9 = tail call i32 (...) @glutPostRedisplay()
ret void
}