int single_digit_constraint_value(const double c) {
  const double limits[9] = {0, 1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1, 1};
  int i;
  for (i = 0; i < 9; ++i)
    if (c <= limits[i])
      return i;
  return 9;
}


x86 assembly (clang, -O0):
<single_digit_constraint_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x10(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xed8(%rip),%rsi
mov    $0x48,%edx
call   1030 <memcpy@plt>
movl   $0x0,-0x64(%rbp)
cmpl   $0x9,-0x64(%rbp)
jge    117a <single_digit_constraint_value+0x6a>
movsd  -0x10(%rbp),%xmm1
movslq -0x64(%rbp),%rax
movsd  -0x60(%rbp,%rax,8),%xmm0
ucomisd %xmm1,%xmm0
jb     1167 <single_digit_constraint_value+0x57>
mov    -0x64(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1181 <single_digit_constraint_value+0x71>
jmp    116c <single_digit_constraint_value+0x5c>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1139 <single_digit_constraint_value+0x29>
movl   $0x9,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<single_digit_constraint_value>:
xor    %eax,%eax
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jae    11b1 <single_digit_constraint_value+0xb1>
mov    $0x1,%eax
movsd  0xee3(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    11b1 <single_digit_constraint_value+0xb1>
mov    $0x2,%eax
movsd  0xed4(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    11b1 <single_digit_constraint_value+0xb1>
mov    $0x3,%eax
movsd  0xec9(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    11b1 <single_digit_constraint_value+0xb1>
mov    $0x4,%eax
movsd  0xebe(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    11b1 <single_digit_constraint_value+0xb1>
mov    $0x5,%eax
movsd  0xeb3(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    11b1 <single_digit_constraint_value+0xb1>
mov    $0x6,%eax
movsd  0xea8(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    11b1 <single_digit_constraint_value+0xb1>
mov    $0x7,%eax
movsd  0xe9d(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    11b1 <single_digit_constraint_value+0xb1>
mov    $0x8,%eax
movsd  0xe92(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    11b1 <single_digit_constraint_value+0xb1>
mov    $0x9,%eax
ret

LLVM IR (-O0):
@__const.single_digit_constraint_value.limits = [9 x double] [double 0.000000e+00, double 0x3E7AD7F29ABCAF48, double 0x3EB0C6F7A0B5ED8D, double 1.000000e-05, double 1.000000e-04, double 1.000000e-03, double 1.000000e-02, double 1.000000e-01, double 1.000000e+00]
define i32 @single_digit_constraint_value(double %0) {
%2 = alloca i32
%3 = alloca double
%4 = alloca [9 x double]
%5 = alloca i32
store double %0, double* %3
%6 = bitcast [9 x double]* %4 to i8*
store i32 0, i32* %5
br label %7
7: ; preds = %20, %1
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 9
br i1 %9, label %10, label %23
10: ; preds = %7
%11 = load double, double* %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [9 x double], [9 x double]* %4, i64 0, i64 %13
%15 = load double, double* %14
%16 = fcmp ole double %11, %15
br i1 %16, label %17, label %19
17: ; preds = %10
%18 = load i32, i32* %5
store i32 %18, i32* %2
br label %24
19: ; preds = %10
br label %20
20: ; preds = %19
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
br label %7
23: ; preds = %7
store i32 9, i32* %2
br label %24
24: ; preds = %23, %17
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
define i32 @single_digit_constraint_value(double %0) {
%2 = fcmp ugt double %0, 0.000000e+00
br i1 %2, label %3, label %20
3: ; preds = %1
%4 = fcmp ugt double %0, 0x3E7AD7F29ABCAF48
br i1 %4, label %5, label %20
5: ; preds = %3
%6 = fcmp ugt double %0, 0x3EB0C6F7A0B5ED8D
br i1 %6, label %7, label %20
7: ; preds = %5
%8 = fcmp ugt double %0, 1.000000e-05
br i1 %8, label %9, label %20
9: ; preds = %7
%10 = fcmp ugt double %0, 1.000000e-04
br i1 %10, label %11, label %20
11: ; preds = %9
%12 = fcmp ugt double %0, 1.000000e-03
br i1 %12, label %13, label %20
13: ; preds = %11
%14 = fcmp ugt double %0, 1.000000e-02
br i1 %14, label %15, label %20
15: ; preds = %13
%16 = fcmp ugt double %0, 1.000000e-01
br i1 %16, label %17, label %20
17: ; preds = %15
%18 = fcmp ugt double %0, 1.000000e+00
br i1 %18, label %19, label %20
19: ; preds = %17
br label %20
20: ; preds = %19, %17, %15, %13, %11, %9, %7, %5, %3, %1
%21 = phi i32 [ 0, %1 ], [ 1, %3 ], [ 2, %5 ], [ 3, %7 ], [ 4, %9 ], [ 5, %11 ], [ 6, %13 ], [ 7, %15 ], [ 8, %17 ], [ 9, %19 ]
ret i32 %21
}