#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);
void setColor(const int color) {
  switch (color) {
  case 0:
    glColor3f(1.0, 0.0, 0.0);
    break;
  case 1:
    glColor3f(0.0, 1.0, 0.0);
    break;
  case 2:
    glColor3f(1.0, 1.0, 0.0);
    break;
  case 3:
    glColor3f(0.0, 1.0, 1.0);
    break;
  case 4:
    glColor3f(1.0, 0.0, 1.0);
    break;
  case 5:
    glColor3f(0.0, 0.0, 0.0);
    break;
  }
}


x86 assembly (clang, -O0):
<setColor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x5,%rax
ja     11c6 <setColor+0xb6>
mov    -0x10(%rbp),%rax
lea    0xed1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsd  0xeb8(%rip),%xmm0
xorps  %xmm2,%xmm2
movaps %xmm2,%xmm1
call   1030 <glColor3f@plt>
jmp    11c6 <setColor+0xb6>
xorps  %xmm2,%xmm2
movsd  0xe9d(%rip),%xmm1
movaps %xmm2,%xmm0
call   1030 <glColor3f@plt>
jmp    11c6 <setColor+0xb6>
movsd  0xe88(%rip),%xmm1
xorps  %xmm2,%xmm2
movaps %xmm1,%xmm0
call   1030 <glColor3f@plt>
jmp    11c6 <setColor+0xb6>
xorps  %xmm0,%xmm0
movsd  0xe6d(%rip),%xmm2
movaps %xmm2,%xmm1
call   1030 <glColor3f@plt>
jmp    11c6 <setColor+0xb6>
movsd  0xe58(%rip),%xmm2
xorps  %xmm1,%xmm1
movaps %xmm2,%xmm0
call   1030 <glColor3f@plt>
jmp    11c6 <setColor+0xb6>
xorps  %xmm2,%xmm2
movaps %xmm2,%xmm0
movaps %xmm2,%xmm1
call   1030 <glColor3f@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setColor>:
cmp    $0x5,%edi
ja     1131 <setColor+0x21>
mov    %edi,%eax
lea    0xeea(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsd  0xed1(%rip),%xmm0
jmp    1181 <setColor+0x71>
ret
movsd  0xec6(%rip),%xmm1
xorps  %xmm0,%xmm0
xorps  %xmm2,%xmm2
jmp    1030 <glColor3f@plt>
movsd  0xeb3(%rip),%xmm0
xorps  %xmm2,%xmm2
movaps %xmm0,%xmm1
jmp    1030 <glColor3f@plt>
movsd  0xea0(%rip),%xmm1
xorps  %xmm0,%xmm0
movaps %xmm1,%xmm2
jmp    1030 <glColor3f@plt>
movsd  0xe8d(%rip),%xmm0
xorps  %xmm1,%xmm1
movaps %xmm0,%xmm2
jmp    1030 <glColor3f@plt>
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
jmp    1030 <glColor3f@plt>

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

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