double dist_id(int dist) {
  double result;
  if (300 <= dist && dist < 600) {
    result = 0.12;
  } else if (600 <= dist && dist < 700) {
    result = 0.84;
  } else if (700 <= dist && dist < 800) {
    result = 0.02;
  } else if (800 <= dist && dist < 900) {
    result = 0.01;
  } else if (900 <= dist && dist < 1000) {
    result = 0.01;
  } else if (1000 <= dist && dist < 1100) {
    result = 0.01;
  } else {
    result = 0.000000000000000001;
  }
  return result;
}


x86 assembly (clang, -O0):
<dist_id>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x12c,%eax
cmp    -0x4(%rbp),%eax
jg     1134 <dist_id+0x34>
cmpl   $0x258,-0x4(%rbp)
jge    1134 <dist_id+0x34>
movsd  0xef6(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    123b <dist_id+0x13b>
mov    $0x258,%eax
cmp    -0x4(%rbp),%eax
jg     1161 <dist_id+0x61>
cmpl   $0x2bc,-0x4(%rbp)
jge    1161 <dist_id+0x61>
movsd  0xec1(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1236 <dist_id+0x136>
mov    $0x2bc,%eax
cmp    -0x4(%rbp),%eax
jg     118e <dist_id+0x8e>
cmpl   $0x320,-0x4(%rbp)
jge    118e <dist_id+0x8e>
movsd  0xe8c(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1231 <dist_id+0x131>
mov    $0x320,%eax
cmp    -0x4(%rbp),%eax
jg     11bb <dist_id+0xbb>
cmpl   $0x384,-0x4(%rbp)
jge    11bb <dist_id+0xbb>
movsd  0xe57(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    122c <dist_id+0x12c>
mov    $0x384,%eax
cmp    -0x4(%rbp),%eax
jg     11e8 <dist_id+0xe8>
cmpl   $0x3e8,-0x4(%rbp)
jge    11e8 <dist_id+0xe8>
movsd  0xe2a(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1227 <dist_id+0x127>
mov    $0x3e8,%eax
cmp    -0x4(%rbp),%eax
jg     1215 <dist_id+0x115>
cmpl   $0x44c,-0x4(%rbp)
jge    1215 <dist_id+0x115>
movsd  0xdfd(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1222 <dist_id+0x122>
movsd  0xde3(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1227 <dist_id+0x127>
jmp    122c <dist_id+0x12c>
jmp    1231 <dist_id+0x131>
jmp    1236 <dist_id+0x136>
jmp    123b <dist_id+0x13b>
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dist_id>:
lea    -0x12c(%rdi),%eax
cmp    $0x12c,%eax
jae    1116 <dist_id+0x16>
movsd  0xeeb(%rip),%xmm0
ret
lea    -0x258(%rdi),%eax
cmp    $0x64,%eax
jae    112a <dist_id+0x2a>
movsd  0xedf(%rip),%xmm0
ret
lea    -0x2bc(%rdi),%eax
cmp    $0x64,%eax
jae    113e <dist_id+0x3e>
movsd  0xed3(%rip),%xmm0
ret
lea    -0x320(%rdi),%eax
cmp    $0xc8,%eax
jae    1154 <dist_id+0x54>
movsd  0xec5(%rip),%xmm0
ret
add    $0xfffffc18,%edi
xor    %eax,%eax
cmp    $0x64,%edi
setb   %al
lea    0xeb7(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm0
ret

LLVM IR (-O0):
define double @dist_id(i32 %0) {
%2 = alloca i32
%3 = alloca double
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp sle i32 300, %4
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 600
br i1 %8, label %9, label %10
9: ; preds = %6
store double 1.200000e-01, double* %3
br label %51
10: ; preds = %6, %1
%11 = load i32, i32* %2
%12 = icmp sle i32 600, %11
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = load i32, i32* %2
%15 = icmp slt i32 %14, 700
br i1 %15, label %16, label %17
16: ; preds = %13
store double 8.400000e-01, double* %3
br label %50
17: ; preds = %13, %10
%18 = load i32, i32* %2
%19 = icmp sle i32 700, %18
br i1 %19, label %20, label %24
20: ; preds = %17
%21 = load i32, i32* %2
%22 = icmp slt i32 %21, 800
br i1 %22, label %23, label %24
23: ; preds = %20
store double 2.000000e-02, double* %3
br label %49
24: ; preds = %20, %17
%25 = load i32, i32* %2
%26 = icmp sle i32 800, %25
br i1 %26, label %27, label %31
27: ; preds = %24
%28 = load i32, i32* %2
%29 = icmp slt i32 %28, 900
br i1 %29, label %30, label %31
30: ; preds = %27
store double 1.000000e-02, double* %3
br label %48
31: ; preds = %27, %24
%32 = load i32, i32* %2
%33 = icmp sle i32 900, %32
br i1 %33, label %34, label %38
34: ; preds = %31
%35 = load i32, i32* %2
%36 = icmp slt i32 %35, 1000
br i1 %36, label %37, label %38
37: ; preds = %34
store double 1.000000e-02, double* %3
br label %47
38: ; preds = %34, %31
%39 = load i32, i32* %2
%40 = icmp sle i32 1000, %39
br i1 %40, label %41, label %45
41: ; preds = %38
%42 = load i32, i32* %2
%43 = icmp slt i32 %42, 1100
br i1 %43, label %44, label %45
44: ; preds = %41
store double 1.000000e-02, double* %3
br label %46
45: ; preds = %41, %38
store double 1.000000e-18, double* %3
br label %46
46: ; preds = %45, %44
br label %47
47: ; preds = %46, %37
br label %48
48: ; preds = %47, %30
br label %49
49: ; preds = %48, %23
br label %50
50: ; preds = %49, %16
br label %51
51: ; preds = %50, %9
%52 = load double, double* %3
ret double %52
}

LLVM IR (-O2):
define double @dist_id(i32 %0) {
%2 = add i32 %0, -300
%3 = icmp ult i32 %2, 300
br i1 %3, label %17, label %4
4: ; preds = %1
%5 = add i32 %0, -600
%6 = icmp ult i32 %5, 100
br i1 %6, label %17, label %7
7: ; preds = %4
%8 = add i32 %0, -700
%9 = icmp ult i32 %8, 100
br i1 %9, label %17, label %10
10: ; preds = %7
%11 = add i32 %0, -800
%12 = icmp ult i32 %11, 200
br i1 %12, label %17, label %13
13: ; preds = %10
%14 = add i32 %0, -1000
%15 = icmp ult i32 %14, 100
%16 = select i1 %15, double 1.000000e-02, double 1.000000e-18
br label %17
17: ; preds = %13, %10, %7, %4, %1
%18 = phi double [ 1.200000e-01, %1 ], [ 8.400000e-01, %4 ], [ 2.000000e-02, %7 ], [ 1.000000e-02, %10 ], [ %16, %13 ]
ret double %18
}