int uraindex(double value) {
  static const double ura_eph[] = {2.4,    3.4,    4.85,   6.85,  9.65,  13.65,
                                   24.0,   48.0,   96.0,   192.0, 384.0, 768.0,
                                   1536.0, 3072.0, 6144.0, 0.0};
  int i;
  for (i = 0; i < 15; i++)
    if (ura_eph[i] >= value)
      break;
  return i;
}


x86 assembly (clang, -O0):
<uraindex>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xf,-0xc(%rbp)
jge    114d <uraindex+0x4d>
movslq -0xc(%rbp),%rcx
lea    0xedb(%rip),%rax
movsd  (%rax,%rcx,8),%xmm0
ucomisd -0x8(%rbp),%xmm0
jb     113a <uraindex+0x3a>
jmp    114d <uraindex+0x4d>
jmp    113f <uraindex+0x3f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1110 <uraindex+0x10>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uraindex>:
xor    %eax,%eax
movsd  0xef6(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    123f <uraindex+0x13f>
mov    $0x1,%eax
movsd  0xee7(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    123f <uraindex+0x13f>
mov    $0x2,%eax
movsd  0xed8(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    123f <uraindex+0x13f>
mov    $0x3,%eax
movsd  0xec9(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    123f <uraindex+0x13f>
mov    $0x4,%eax
movsd  0xeba(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    123f <uraindex+0x13f>
mov    $0x5,%eax
movsd  0xeab(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    123f <uraindex+0x13f>
mov    $0x6,%eax
movsd  0xe9c(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    123f <uraindex+0x13f>
mov    $0x7,%eax
movsd  0xe8d(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    123f <uraindex+0x13f>
mov    $0x8,%eax
movsd  0xe7e(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    123f <uraindex+0x13f>
mov    $0x9,%eax
movsd  0xe73(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    123f <uraindex+0x13f>
mov    $0xa,%eax
movsd  0xe68(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    123f <uraindex+0x13f>
mov    $0xb,%eax
movsd  0xe5d(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    123f <uraindex+0x13f>
mov    $0xc,%eax
movsd  0xe52(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    123f <uraindex+0x13f>
mov    $0xd,%eax
movsd  0xe47(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    123f <uraindex+0x13f>
mov    $0xe,%eax
movsd  0xe3c(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    123f <uraindex+0x13f>
mov    $0xf,%eax
ret

LLVM IR (-O0):
@uraindex.ura_eph = internal constant [16 x double] [double 2.400000e+00, double 3.400000e+00, double 4.850000e+00, double 6.850000e+00, double 9.650000e+00, double 1.365000e+01, double 2.400000e+01, double 4.800000e+01, double 9.600000e+01, double 1.920000e+02, double 3.840000e+02, double 7.680000e+02, double 1.536000e+03, double 3.072000e+03, double 6.144000e+03, double 0.000000e+00]
define i32 @uraindex(double %0) {
%2 = alloca double
%3 = alloca i32
store double %0, double* %2
store i32 0, i32* %3
br label %4
4: ; preds = %16, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 15
br i1 %6, label %7, label %19
7: ; preds = %4
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [16 x double], [16 x double]* @uraindex.ura_eph, i64 0, i64 %9
%11 = load double, double* %10
%12 = load double, double* %2
%13 = fcmp oge double %11, %12
br i1 %13, label %14, label %15
14: ; preds = %7
br label %19
15: ; preds = %7
br label %16
16: ; preds = %15
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %4
19: ; preds = %14, %4
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
define i32 @uraindex(double %0) {
%2 = fcmp ugt double %0, 2.400000e+00
br i1 %2, label %3, label %32
3: ; preds = %1
%4 = fcmp ugt double %0, 3.400000e+00
br i1 %4, label %5, label %32
5: ; preds = %3
%6 = fcmp ugt double %0, 4.850000e+00
br i1 %6, label %7, label %32
7: ; preds = %5
%8 = fcmp ugt double %0, 6.850000e+00
br i1 %8, label %9, label %32
9: ; preds = %7
%10 = fcmp ugt double %0, 9.650000e+00
br i1 %10, label %11, label %32
11: ; preds = %9
%12 = fcmp ugt double %0, 1.365000e+01
br i1 %12, label %13, label %32
13: ; preds = %11
%14 = fcmp ugt double %0, 2.400000e+01
br i1 %14, label %15, label %32
15: ; preds = %13
%16 = fcmp ugt double %0, 4.800000e+01
br i1 %16, label %17, label %32
17: ; preds = %15
%18 = fcmp ugt double %0, 9.600000e+01
br i1 %18, label %19, label %32
19: ; preds = %17
%20 = fcmp ugt double %0, 1.920000e+02
br i1 %20, label %21, label %32
21: ; preds = %19
%22 = fcmp ugt double %0, 3.840000e+02
br i1 %22, label %23, label %32
23: ; preds = %21
%24 = fcmp ugt double %0, 7.680000e+02
br i1 %24, label %25, label %32
25: ; preds = %23
%26 = fcmp ugt double %0, 1.536000e+03
br i1 %26, label %27, label %32
27: ; preds = %25
%28 = fcmp ugt double %0, 3.072000e+03
br i1 %28, label %29, label %32
29: ; preds = %27
%30 = fcmp ugt double %0, 6.144000e+03
br i1 %30, label %31, label %32
31: ; preds = %29
br label %32
32: ; preds = %31, %29, %27, %25, %23, %21, %19, %17, %15, %13, %11, %9, %7, %5, %3, %1
%33 = phi i32 [ 0, %1 ], [ 1, %3 ], [ 2, %5 ], [ 3, %7 ], [ 4, %9 ], [ 5, %11 ], [ 6, %13 ], [ 7, %15 ], [ 8, %17 ], [ 9, %19 ], [ 10, %21 ], [ 11, %23 ], [ 12, %25 ], [ 13, %27 ], [ 14, %29 ], [ 15, %31 ]
ret i32 %33
}