int get_road_length_value(int length) {
  if (length >= 24)
    return 7;
  else if (length >= 18)
    return 6;
  else if (length >= 13)
    return 5;
  else if (length >= 10)
    return 4;
  else if (length >= 7)
    return 3;
  else if (length >= 6)
    return 2;
  else if (length >= 4)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<get_road_length_value>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x18,-0x8(%rbp)
jl     111d <get_road_length_value+0x1d>
movl   $0x7,-0x4(%rbp)
jmp    11c6 <get_road_length_value+0xc6>
cmpl   $0x12,-0x8(%rbp)
jl     1133 <get_road_length_value+0x33>
movl   $0x6,-0x4(%rbp)
jmp    11c6 <get_road_length_value+0xc6>
cmpl   $0xd,-0x8(%rbp)
jl     1149 <get_road_length_value+0x49>
movl   $0x5,-0x4(%rbp)
jmp    11c6 <get_road_length_value+0xc6>
cmpl   $0xa,-0x8(%rbp)
jl     115f <get_road_length_value+0x5f>
movl   $0x4,-0x4(%rbp)
jmp    11c6 <get_road_length_value+0xc6>
cmpl   $0x7,-0x8(%rbp)
jl     1175 <get_road_length_value+0x75>
movl   $0x3,-0x4(%rbp)
jmp    11c6 <get_road_length_value+0xc6>
cmpl   $0x6,-0x8(%rbp)
jl     118b <get_road_length_value+0x8b>
movl   $0x2,-0x4(%rbp)
jmp    11c6 <get_road_length_value+0xc6>
cmpl   $0x4,-0x8(%rbp)
jl     11a1 <get_road_length_value+0xa1>
movl   $0x1,-0x4(%rbp)
jmp    11c6 <get_road_length_value+0xc6>
jmp    11a6 <get_road_length_value+0xa6>
jmp    11ab <get_road_length_value+0xab>
jmp    11b0 <get_road_length_value+0xb0>
jmp    11b5 <get_road_length_value+0xb5>
jmp    11ba <get_road_length_value+0xba>
jmp    11bf <get_road_length_value+0xbf>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_road_length_value>:
mov    $0x7,%eax
cmp    $0x17,%edi
jg     1141 <get_road_length_value+0x41>
mov    $0x6,%eax
cmp    $0x11,%edi
jg     1141 <get_road_length_value+0x41>
mov    $0x5,%eax
cmp    $0xc,%edi
jg     1141 <get_road_length_value+0x41>
mov    $0x4,%eax
cmp    $0x9,%edi
jg     1141 <get_road_length_value+0x41>
mov    $0x3,%eax
cmp    $0x6,%edi
jg     1141 <get_road_length_value+0x41>
mov    $0x2,%eax
je     1141 <get_road_length_value+0x41>
xor    %eax,%eax
cmp    $0x4,%edi
setge  %al
ret

LLVM IR (-O0):
define i32 @get_road_length_value(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 24
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 7, i32* %2
br label %38
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp sge i32 %8, 18
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 6, i32* %2
br label %38
11: ; preds = %7
%12 = load i32, i32* %3
%13 = icmp sge i32 %12, 13
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 5, i32* %2
br label %38
15: ; preds = %11
%16 = load i32, i32* %3
%17 = icmp sge i32 %16, 10
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 4, i32* %2
br label %38
19: ; preds = %15
%20 = load i32, i32* %3
%21 = icmp sge i32 %20, 7
br i1 %21, label %22, label %23
22: ; preds = %19
store i32 3, i32* %2
br label %38
23: ; preds = %19
%24 = load i32, i32* %3
%25 = icmp sge i32 %24, 6
br i1 %25, label %26, label %27
26: ; preds = %23
store i32 2, i32* %2
br label %38
27: ; preds = %23
%28 = load i32, i32* %3
%29 = icmp sge i32 %28, 4
br i1 %29, label %30, label %31
30: ; preds = %27
store i32 1, i32* %2
br label %38
31: ; preds = %27
br label %32
32: ; preds = %31
br label %33
33: ; preds = %32
br label %34
34: ; preds = %33
br label %35
35: ; preds = %34
br label %36
36: ; preds = %35
br label %37
37: ; preds = %36
store i32 0, i32* %2
br label %38
38: ; preds = %37, %30, %26, %22, %18, %14, %10, %6
%39 = load i32, i32* %2
ret i32 %39
}

LLVM IR (-O2):
define i32 @get_road_length_value(i32 %0) {
%2 = icmp sgt i32 %0, 23
br i1 %2, label %16, label %3
3: ; preds = %1
%4 = icmp sgt i32 %0, 17
br i1 %4, label %16, label %5
5: ; preds = %3
%6 = icmp sgt i32 %0, 12
br i1 %6, label %16, label %7
7: ; preds = %5
%8 = icmp sgt i32 %0, 9
br i1 %8, label %16, label %9
9: ; preds = %7
%10 = icmp sgt i32 %0, 6
br i1 %10, label %16, label %11
11: ; preds = %9
%12 = icmp eq i32 %0, 6
br i1 %12, label %16, label %13
13: ; preds = %11
%14 = icmp sgt i32 %0, 3
%15 = zext i1 %14 to i32
br label %16
16: ; preds = %13, %11, %9, %7, %5, %3, %1
%17 = phi i32 [ 7, %1 ], [ 6, %3 ], [ 5, %5 ], [ 4, %7 ], [ 3, %9 ], [ 2, %11 ], [ %15, %13 ]
ret i32 %17
}