int determine_switch_selection(int analog_value) {
  if (analog_value >= 552 && analog_value <= 599) {
    return 1;
  } else if (analog_value > 599 && analog_value <= 639) {
    return 2;
  } else if (analog_value > 639 && analog_value <= 678) {
    return 3;
  } else if (analog_value > 678 && analog_value <= 718) {
    return 4;
  } else if (analog_value > 718 && analog_value <= 757) {
    return 5;
  } else if (analog_value > 757 && analog_value <= 797) {
    return 6;
  } else if (analog_value > 797 && analog_value <= 838) {
    return 7;
  } else if (analog_value > 828 && analog_value <= 878) {
    return 8;
  } else if (analog_value > 878 && analog_value <= 920) {
    return 9;
  } else if (analog_value > 920 && analog_value <= 960) {
    return 10;
  } else if (analog_value > 960 && analog_value <= 1001) {
    return 11;
  } else if (analog_value > 1001 && analog_value <= 1023) {
    return 12;
  }
  return 0;
}


x86 assembly (clang, -O0):
<determine_switch_selection>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x228,-0x8(%rbp)
jl     112d <determine_switch_selection+0x2d>
cmpl   $0x257,-0x8(%rbp)
jg     112d <determine_switch_selection+0x2d>
movl   $0x1,-0x4(%rbp)
jmp    130d <determine_switch_selection+0x20d>
cmpl   $0x257,-0x8(%rbp)
jle    1153 <determine_switch_selection+0x53>
cmpl   $0x27f,-0x8(%rbp)
jg     1153 <determine_switch_selection+0x53>
movl   $0x2,-0x4(%rbp)
jmp    130d <determine_switch_selection+0x20d>
cmpl   $0x27f,-0x8(%rbp)
jle    1179 <determine_switch_selection+0x79>
cmpl   $0x2a6,-0x8(%rbp)
jg     1179 <determine_switch_selection+0x79>
movl   $0x3,-0x4(%rbp)
jmp    130d <determine_switch_selection+0x20d>
cmpl   $0x2a6,-0x8(%rbp)
jle    119f <determine_switch_selection+0x9f>
cmpl   $0x2ce,-0x8(%rbp)
jg     119f <determine_switch_selection+0x9f>
movl   $0x4,-0x4(%rbp)
jmp    130d <determine_switch_selection+0x20d>
cmpl   $0x2ce,-0x8(%rbp)
jle    11c5 <determine_switch_selection+0xc5>
cmpl   $0x2f5,-0x8(%rbp)
jg     11c5 <determine_switch_selection+0xc5>
movl   $0x5,-0x4(%rbp)
jmp    130d <determine_switch_selection+0x20d>
cmpl   $0x2f5,-0x8(%rbp)
jle    11eb <determine_switch_selection+0xeb>
cmpl   $0x31d,-0x8(%rbp)
jg     11eb <determine_switch_selection+0xeb>
movl   $0x6,-0x4(%rbp)
jmp    130d <determine_switch_selection+0x20d>
cmpl   $0x31d,-0x8(%rbp)
jle    1211 <determine_switch_selection+0x111>
cmpl   $0x346,-0x8(%rbp)
jg     1211 <determine_switch_selection+0x111>
movl   $0x7,-0x4(%rbp)
jmp    130d <determine_switch_selection+0x20d>
cmpl   $0x33c,-0x8(%rbp)
jle    1237 <determine_switch_selection+0x137>
cmpl   $0x36e,-0x8(%rbp)
jg     1237 <determine_switch_selection+0x137>
movl   $0x8,-0x4(%rbp)
jmp    130d <determine_switch_selection+0x20d>
cmpl   $0x36e,-0x8(%rbp)
jle    125d <determine_switch_selection+0x15d>
cmpl   $0x398,-0x8(%rbp)
jg     125d <determine_switch_selection+0x15d>
movl   $0x9,-0x4(%rbp)
jmp    130d <determine_switch_selection+0x20d>
cmpl   $0x398,-0x8(%rbp)
jle    1283 <determine_switch_selection+0x183>
cmpl   $0x3c0,-0x8(%rbp)
jg     1283 <determine_switch_selection+0x183>
movl   $0xa,-0x4(%rbp)
jmp    130d <determine_switch_selection+0x20d>
cmpl   $0x3c0,-0x8(%rbp)
jle    12a9 <determine_switch_selection+0x1a9>
cmpl   $0x3e9,-0x8(%rbp)
jg     12a9 <determine_switch_selection+0x1a9>
movl   $0xb,-0x4(%rbp)
jmp    130d <determine_switch_selection+0x20d>
cmpl   $0x3e9,-0x8(%rbp)
jle    12cf <determine_switch_selection+0x1cf>
cmpl   $0x3ff,-0x8(%rbp)
jg     12cf <determine_switch_selection+0x1cf>
movl   $0xc,-0x4(%rbp)
jmp    130d <determine_switch_selection+0x20d>
jmp    12d4 <determine_switch_selection+0x1d4>
jmp    12d9 <determine_switch_selection+0x1d9>
jmp    12de <determine_switch_selection+0x1de>
jmp    12e3 <determine_switch_selection+0x1e3>
jmp    12e8 <determine_switch_selection+0x1e8>
jmp    12ed <determine_switch_selection+0x1ed>
jmp    12f2 <determine_switch_selection+0x1f2>
jmp    12f7 <determine_switch_selection+0x1f7>
jmp    12fc <determine_switch_selection+0x1fc>
jmp    1301 <determine_switch_selection+0x201>
jmp    1306 <determine_switch_selection+0x206>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<determine_switch_selection>:
lea    -0x228(%rdi),%ecx
mov    $0x1,%eax
cmp    $0x30,%ecx
jb     11d3 <determine_switch_selection+0xd3>
lea    -0x258(%rdi),%ecx
mov    $0x2,%eax
cmp    $0x28,%ecx
jb     11d3 <determine_switch_selection+0xd3>
lea    -0x280(%rdi),%ecx
mov    $0x3,%eax
cmp    $0x27,%ecx
jb     11d3 <determine_switch_selection+0xd3>
lea    -0x2a7(%rdi),%ecx
mov    $0x4,%eax
cmp    $0x28,%ecx
jb     11d3 <determine_switch_selection+0xd3>
lea    -0x2cf(%rdi),%ecx
mov    $0x5,%eax
cmp    $0x27,%ecx
jb     11d3 <determine_switch_selection+0xd3>
lea    -0x2f6(%rdi),%ecx
mov    $0x6,%eax
cmp    $0x28,%ecx
jb     11d3 <determine_switch_selection+0xd3>
lea    -0x31e(%rdi),%ecx
mov    $0x7,%eax
cmp    $0x29,%ecx
jb     11d3 <determine_switch_selection+0xd3>
lea    -0x33d(%rdi),%ecx
mov    $0x8,%eax
cmp    $0x32,%ecx
jb     11d3 <determine_switch_selection+0xd3>
lea    -0x36f(%rdi),%ecx
mov    $0x9,%eax
cmp    $0x2a,%ecx
jb     11d3 <determine_switch_selection+0xd3>
lea    -0x399(%rdi),%ecx
mov    $0xa,%eax
cmp    $0x28,%ecx
jb     11d3 <determine_switch_selection+0xd3>
lea    -0x3c1(%rdi),%ecx
mov    $0xb,%eax
cmp    $0x29,%ecx
jb     11d3 <determine_switch_selection+0xd3>
add    $0xfffffc16,%edi
xor    %ecx,%ecx
cmp    $0x16,%edi
mov    $0xc,%eax
cmovae %ecx,%eax
ret

LLVM IR (-O0):
define i32 @determine_switch_selection(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 552
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 599
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 1, i32* %2
br label %99
10: ; preds = %6, %1
%11 = load i32, i32* %3
%12 = icmp sgt i32 %11, 599
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = load i32, i32* %3
%15 = icmp sle i32 %14, 639
br i1 %15, label %16, label %17
16: ; preds = %13
store i32 2, i32* %2
br label %99
17: ; preds = %13, %10
%18 = load i32, i32* %3
%19 = icmp sgt i32 %18, 639
br i1 %19, label %20, label %24
20: ; preds = %17
%21 = load i32, i32* %3
%22 = icmp sle i32 %21, 678
br i1 %22, label %23, label %24
23: ; preds = %20
store i32 3, i32* %2
br label %99
24: ; preds = %20, %17
%25 = load i32, i32* %3
%26 = icmp sgt i32 %25, 678
br i1 %26, label %27, label %31
27: ; preds = %24
%28 = load i32, i32* %3
%29 = icmp sle i32 %28, 718
br i1 %29, label %30, label %31
30: ; preds = %27
store i32 4, i32* %2
br label %99
31: ; preds = %27, %24
%32 = load i32, i32* %3
%33 = icmp sgt i32 %32, 718
br i1 %33, label %34, label %38
34: ; preds = %31
%35 = load i32, i32* %3
%36 = icmp sle i32 %35, 757
br i1 %36, label %37, label %38
37: ; preds = %34
store i32 5, i32* %2
br label %99
38: ; preds = %34, %31
%39 = load i32, i32* %3
%40 = icmp sgt i32 %39, 757
br i1 %40, label %41, label %45
41: ; preds = %38
%42 = load i32, i32* %3
%43 = icmp sle i32 %42, 797
br i1 %43, label %44, label %45
44: ; preds = %41
store i32 6, i32* %2
br label %99
45: ; preds = %41, %38
%46 = load i32, i32* %3
%47 = icmp sgt i32 %46, 797
br i1 %47, label %48, label %52
48: ; preds = %45
%49 = load i32, i32* %3
%50 = icmp sle i32 %49, 838
br i1 %50, label %51, label %52
51: ; preds = %48
store i32 7, i32* %2
br label %99
52: ; preds = %48, %45
%53 = load i32, i32* %3
%54 = icmp sgt i32 %53, 828
br i1 %54, label %55, label %59
55: ; preds = %52
%56 = load i32, i32* %3
%57 = icmp sle i32 %56, 878
br i1 %57, label %58, label %59
58: ; preds = %55
store i32 8, i32* %2
br label %99
59: ; preds = %55, %52
%60 = load i32, i32* %3
%61 = icmp sgt i32 %60, 878
br i1 %61, label %62, label %66
62: ; preds = %59
%63 = load i32, i32* %3
%64 = icmp sle i32 %63, 920
br i1 %64, label %65, label %66
65: ; preds = %62
store i32 9, i32* %2
br label %99
66: ; preds = %62, %59
%67 = load i32, i32* %3
%68 = icmp sgt i32 %67, 920
br i1 %68, label %69, label %73
69: ; preds = %66
%70 = load i32, i32* %3
%71 = icmp sle i32 %70, 960
br i1 %71, label %72, label %73
72: ; preds = %69
store i32 10, i32* %2
br label %99
73: ; preds = %69, %66
%74 = load i32, i32* %3
%75 = icmp sgt i32 %74, 960
br i1 %75, label %76, label %80
76: ; preds = %73
%77 = load i32, i32* %3
%78 = icmp sle i32 %77, 1001
br i1 %78, label %79, label %80
79: ; preds = %76
store i32 11, i32* %2
br label %99
80: ; preds = %76, %73
%81 = load i32, i32* %3
%82 = icmp sgt i32 %81, 1001
br i1 %82, label %83, label %87
83: ; preds = %80
%84 = load i32, i32* %3
%85 = icmp sle i32 %84, 1023
br i1 %85, label %86, label %87
86: ; preds = %83
store i32 12, i32* %2
br label %99
87: ; preds = %83, %80
br label %88
88: ; preds = %87
br label %89
89: ; preds = %88
br label %90
90: ; preds = %89
br label %91
91: ; preds = %90
br label %92
92: ; preds = %91
br label %93
93: ; preds = %92
br label %94
94: ; preds = %93
br label %95
95: ; preds = %94
br label %96
96: ; preds = %95
br label %97
97: ; preds = %96
br label %98
98: ; preds = %97
store i32 0, i32* %2
br label %99
99: ; preds = %98, %86, %79, %72, %65, %58, %51, %44, %37, %30, %23, %16, %9
%100 = load i32, i32* %2
ret i32 %100
}

LLVM IR (-O2):
define i32 @determine_switch_selection(i32 %0) {
%2 = add i32 %0, -552
%3 = icmp ult i32 %2, 48
br i1 %3, label %38, label %4
4: ; preds = %1
%5 = add i32 %0, -600
%6 = icmp ult i32 %5, 40
br i1 %6, label %38, label %7
7: ; preds = %4
%8 = add i32 %0, -640
%9 = icmp ult i32 %8, 39
br i1 %9, label %38, label %10
10: ; preds = %7
%11 = add i32 %0, -679
%12 = icmp ult i32 %11, 40
br i1 %12, label %38, label %13
13: ; preds = %10
%14 = add i32 %0, -719
%15 = icmp ult i32 %14, 39
br i1 %15, label %38, label %16
16: ; preds = %13
%17 = add i32 %0, -758
%18 = icmp ult i32 %17, 40
br i1 %18, label %38, label %19
19: ; preds = %16
%20 = add i32 %0, -798
%21 = icmp ult i32 %20, 41
br i1 %21, label %38, label %22
22: ; preds = %19
%23 = add i32 %0, -829
%24 = icmp ult i32 %23, 50
br i1 %24, label %38, label %25
25: ; preds = %22
%26 = add i32 %0, -879
%27 = icmp ult i32 %26, 42
br i1 %27, label %38, label %28
28: ; preds = %25
%29 = add i32 %0, -921
%30 = icmp ult i32 %29, 40
br i1 %30, label %38, label %31
31: ; preds = %28
%32 = add i32 %0, -961
%33 = icmp ult i32 %32, 41
br i1 %33, label %38, label %34
34: ; preds = %31
%35 = add i32 %0, -1002
%36 = icmp ult i32 %35, 22
%37 = select i1 %36, i32 12, i32 0
br label %38
38: ; preds = %34, %31, %28, %25, %22, %19, %16, %13, %10, %7, %4, %1
%39 = phi i32 [ 1, %1 ], [ 2, %4 ], [ 3, %7 ], [ 4, %10 ], [ 5, %13 ], [ 6, %16 ], [ 7, %19 ], [ 8, %22 ], [ 9, %25 ], [ 10, %28 ], [ 11, %31 ], [ %37, %34 ]
ret i32 %39
}