void select_grey(int level, int *r, int *g, int *b) {
  if (level > 66) {
    *r = 90;
    *g = 88;
    *b = 85;
  } else if (level > 35) {
    *r = 43;
    *g = 43;
    *b = 45;
  } else if (level > 21) {
    *r = 25;
    *g = 25;
    *b = 33;
  } else if (level > 15) {
    *r = 15;
    *g = 16;
    *b = 18;
  } else if (level > 11) {
    *r = 14;
    *g = 14;
    *b = 18;
  } else if (level > 6) {
    *r = 6;
    *g = 7;
    *b = 8;
  } else {
    *r = 4;
    *g = 4;
    *b = 6;
  }
}


x86 assembly (clang, -O0):
<select_grey>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpl   $0x42,-0x4(%rbp)
jle    1140 <select_grey+0x40>
mov    -0x10(%rbp),%rax
movl   $0x5a,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x58,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x55,(%rax)
jmp    1258 <select_grey+0x158>
cmpl   $0x23,-0x4(%rbp)
jle    116d <select_grey+0x6d>
mov    -0x10(%rbp),%rax
movl   $0x2b,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x2b,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x2d,(%rax)
jmp    1253 <select_grey+0x153>
cmpl   $0x15,-0x4(%rbp)
jle    119a <select_grey+0x9a>
mov    -0x10(%rbp),%rax
movl   $0x19,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x19,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x21,(%rax)
jmp    124e <select_grey+0x14e>
cmpl   $0xf,-0x4(%rbp)
jle    11c7 <select_grey+0xc7>
mov    -0x10(%rbp),%rax
movl   $0xf,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x10,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x12,(%rax)
jmp    1249 <select_grey+0x149>
cmpl   $0xb,-0x4(%rbp)
jle    11f4 <select_grey+0xf4>
mov    -0x10(%rbp),%rax
movl   $0xe,(%rax)
mov    -0x18(%rbp),%rax
movl   $0xe,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x12,(%rax)
jmp    1244 <select_grey+0x144>
cmpl   $0x6,-0x4(%rbp)
jle    1221 <select_grey+0x121>
mov    -0x10(%rbp),%rax
movl   $0x6,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x7,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x8,(%rax)
jmp    123f <select_grey+0x13f>
mov    -0x10(%rbp),%rax
movl   $0x4,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x4,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x6,(%rax)
jmp    1244 <select_grey+0x144>
jmp    1249 <select_grey+0x149>
jmp    124e <select_grey+0x14e>
jmp    1253 <select_grey+0x153>
jmp    1258 <select_grey+0x158>
pop    %rbp
ret

x86 assembly (clang, -O2):
<select_grey>:
cmp    $0x42,%edi
jle    1118 <select_grey+0x18>
mov    $0x55,%r8d
mov    $0x58,%eax
mov    $0x5a,%r9d
jmp    1190 <select_grey+0x90>
cmp    $0x23,%edi
jle    1130 <select_grey+0x30>
mov    $0x2d,%r8d
mov    $0x2b,%r9d
mov    $0x2b,%eax
jmp    1190 <select_grey+0x90>
cmp    $0x15,%edi
jle    1148 <select_grey+0x48>
mov    $0x21,%r8d
mov    $0x19,%r9d
mov    $0x19,%eax
jmp    1190 <select_grey+0x90>
mov    $0x12,%r8d
cmp    $0xf,%edi
jle    1160 <select_grey+0x60>
mov    $0x10,%eax
mov    $0xf,%r9d
jmp    1190 <select_grey+0x90>
mov    $0xe,%r9d
mov    $0xe,%eax
cmp    $0xb,%edi
jg     1190 <select_grey+0x90>
xor    %r8d,%r8d
cmp    $0x7,%edi
setge  %r8b
lea    (%r8,%r8,1),%r9d
add    $0x4,%r9d
lea    (%r8,%r8,2),%eax
or     $0x4,%eax
add    %r8d,%r8d
add    $0x6,%r8d
mov    %r9d,(%rsi)
mov    %eax,(%rdx)
mov    %r8d,(%rcx)
ret

LLVM IR (-O0):
define void @select_grey(i32 %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%9 = load i32, i32* %5
%10 = icmp sgt i32 %9, 66
br i1 %10, label %11, label %15
11: ; preds = %4
%12 = load i32*, i32** %6
store i32 90, i32* %12
%13 = load i32*, i32** %7
store i32 88, i32* %13
%14 = load i32*, i32** %8
store i32 85, i32* %14
br label %59
15: ; preds = %4
%16 = load i32, i32* %5
%17 = icmp sgt i32 %16, 35
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = load i32*, i32** %6
store i32 43, i32* %19
%20 = load i32*, i32** %7
store i32 43, i32* %20
%21 = load i32*, i32** %8
store i32 45, i32* %21
br label %58
22: ; preds = %15
%23 = load i32, i32* %5
%24 = icmp sgt i32 %23, 21
br i1 %24, label %25, label %29
25: ; preds = %22
%26 = load i32*, i32** %6
store i32 25, i32* %26
%27 = load i32*, i32** %7
store i32 25, i32* %27
%28 = load i32*, i32** %8
store i32 33, i32* %28
br label %57
29: ; preds = %22
%30 = load i32, i32* %5
%31 = icmp sgt i32 %30, 15
br i1 %31, label %32, label %36
32: ; preds = %29
%33 = load i32*, i32** %6
store i32 15, i32* %33
%34 = load i32*, i32** %7
store i32 16, i32* %34
%35 = load i32*, i32** %8
store i32 18, i32* %35
br label %56
36: ; preds = %29
%37 = load i32, i32* %5
%38 = icmp sgt i32 %37, 11
br i1 %38, label %39, label %43
39: ; preds = %36
%40 = load i32*, i32** %6
store i32 14, i32* %40
%41 = load i32*, i32** %7
store i32 14, i32* %41
%42 = load i32*, i32** %8
store i32 18, i32* %42
br label %55
43: ; preds = %36
%44 = load i32, i32* %5
%45 = icmp sgt i32 %44, 6
br i1 %45, label %46, label %50
46: ; preds = %43
%47 = load i32*, i32** %6
store i32 6, i32* %47
%48 = load i32*, i32** %7
store i32 7, i32* %48
%49 = load i32*, i32** %8
store i32 8, i32* %49
br label %54
50: ; preds = %43
%51 = load i32*, i32** %6
store i32 4, i32* %51
%52 = load i32*, i32** %7
store i32 4, i32* %52
%53 = load i32*, i32** %8
store i32 6, i32* %53
br label %54
54: ; preds = %50, %46
br label %55
55: ; preds = %54, %39
br label %56
56: ; preds = %55, %32
br label %57
57: ; preds = %56, %25
br label %58
58: ; preds = %57, %18
br label %59
59: ; preds = %58, %11
ret void
}

LLVM IR (-O2):
define void @select_grey(i32 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3) {
%5 = icmp sgt i32 %0, 66
br i1 %5, label %19, label %6
6: ; preds = %4
%7 = icmp sgt i32 %0, 35
br i1 %7, label %19, label %8
8: ; preds = %6
%9 = icmp sgt i32 %0, 21
br i1 %9, label %19, label %10
10: ; preds = %8
%11 = icmp sgt i32 %0, 15
br i1 %11, label %19, label %12
12: ; preds = %10
%13 = icmp sgt i32 %0, 11
br i1 %13, label %19, label %14
14: ; preds = %12
%15 = icmp sgt i32 %0, 6
%16 = select i1 %15, i32 6, i32 4
%17 = select i1 %15, i32 7, i32 4
%18 = select i1 %15, i32 8, i32 6
br label %19
19: ; preds = %14, %12, %10, %8, %6, %4
%20 = phi i32 [ 90, %4 ], [ 43, %6 ], [ 25, %8 ], [ 15, %10 ], [ 14, %12 ], [ %16, %14 ]
%21 = phi i32 [ 88, %4 ], [ 43, %6 ], [ 25, %8 ], [ 16, %10 ], [ 14, %12 ], [ %17, %14 ]
%22 = phi i32 [ 85, %4 ], [ 45, %6 ], [ 33, %8 ], [ 18, %10 ], [ 18, %12 ], [ %18, %14 ]
store i32 %20, i32* %1
store i32 %21, i32* %2
store i32 %22, i32* %3
ret void
}