int overflow_binary_search(double in) {
  int eee = 16;
  if (in < 1e-8 || in > 1e23) {
    return 0;
  } else {
    static const double ins[] = {1e-8, 1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1,
                                 1e0,  1e1,  1e2,  1e3,  1e4,  1e5,  1e6,  1e7,
                                 1e8,  1e9,  1e10, 1e11, 1e12, 1e13, 1e14, 1e15,
                                 1e16, 1e17, 1e18, 1e19, 1e20, 1e21, 1e22};
    if (in < ins[eee]) {
      eee -= 8;
    } else {
      eee += 8;
    }
    if (in < ins[eee]) {
      eee -= 4;
    } else {
      eee += 4;
    }
    if (in < ins[eee]) {
      eee -= 2;
    } else {
      eee += 2;
    }
    if (in < ins[eee]) {
      eee -= 1;
    } else {
      eee += 1;
    }
    if (in < ins[eee]) {
      eee -= 1;
    }
  }
  return eee;
}


x86 assembly (clang, -O0):
<overflow_binary_search>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movl   $0x10,-0x14(%rbp)
movsd  0xee8(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
ja     113a <overflow_binary_search+0x3a>
movsd  -0x10(%rbp),%xmm0
movsd  0xed8(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1146 <overflow_binary_search+0x46>
movl   $0x0,-0x4(%rbp)
jmp    1251 <overflow_binary_search+0x151>
movsd  -0x10(%rbp),%xmm1
movslq -0x14(%rbp),%rcx
lea    0xeba(%rip),%rax
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    1173 <overflow_binary_search+0x73>
mov    -0x14(%rbp),%eax
sub    $0x8,%eax
mov    %eax,-0x14(%rbp)
jmp    117c <overflow_binary_search+0x7c>
mov    -0x14(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x14(%rbp)
movsd  -0x10(%rbp),%xmm1
movslq -0x14(%rbp),%rcx
lea    0xe84(%rip),%rax
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    11a9 <overflow_binary_search+0xa9>
mov    -0x14(%rbp),%eax
sub    $0x4,%eax
mov    %eax,-0x14(%rbp)
jmp    11b2 <overflow_binary_search+0xb2>
mov    -0x14(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x14(%rbp)
movsd  -0x10(%rbp),%xmm1
movslq -0x14(%rbp),%rcx
lea    0xe4e(%rip),%rax
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    11df <overflow_binary_search+0xdf>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x14(%rbp)
jmp    11e8 <overflow_binary_search+0xe8>
mov    -0x14(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x14(%rbp)
movsd  -0x10(%rbp),%xmm1
movslq -0x14(%rbp),%rcx
lea    0xe18(%rip),%rax
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    1215 <overflow_binary_search+0x115>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    121e <overflow_binary_search+0x11e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
movsd  -0x10(%rbp),%xmm1
movslq -0x14(%rbp),%rcx
lea    0xde2(%rip),%rax
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    1246 <overflow_binary_search+0x146>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    124b <overflow_binary_search+0x14b>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<overflow_binary_search>:
xor    %eax,%eax
movsd  0xef6(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     1182 <overflow_binary_search+0x82>
ucomisd 0xef0(%rip),%xmm0
ja     1182 <overflow_binary_search+0x82>
movsd  0xeee(%rip),%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
setbe  %al
shl    $0x4,%eax
lea    0x8(%rax),%ecx
lea    0xee8(%rip),%rdx
movsd  (%rdx,%rcx,8),%xmm1
xor    %ecx,%ecx
ucomisd %xmm0,%xmm1
setbe  %cl
lea    (%rax,%rcx,8),%esi
lea    (%rax,%rcx,8),%eax
add    $0x4,%eax
movsd  (%rdx,%rax,8),%xmm1
ucomisd %xmm0,%xmm1
cmovbe %eax,%esi
lea    0x2(%rsi),%eax
movsd  (%rdx,%rax,8),%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
setbe  %al
lea    (%rsi,%rax,2),%eax
add    $0x1,%eax
movsd  (%rdx,%rax,8),%xmm1
xor    %ecx,%ecx
ucomisd %xmm0,%xmm1
seta   %cl
sub    %ecx,%eax
ret

LLVM IR (-O0):
@overflow_binary_search.ins = internal constant [31 x double] [double 1.000000e-08, 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, double 1.000000e+01, double 1.000000e+02, double 1.000000e+03, double 1.000000e+04, double 1.000000e+05, double 1.000000e+06, double 1.000000e+07, double 1.000000e+08, double 1.000000e+09, double 1.000000e+10, double 1.000000e+11, double 1.000000e+12, double 1.000000e+13, double 1.000000e+14, double 1.000000e+15, double 1.000000e+16, double 1.000000e+17, double 1.000000e+18, double 1.000000e+19, double 1.000000e+20, double 1.000000e+21, double 1.000000e+22]
define i32 @overflow_binary_search(double %0) {
%2 = alloca i32
%3 = alloca double
%4 = alloca i32
store double %0, double* %3
store i32 16, i32* %4
%5 = load double, double* %3
%6 = fcmp olt double %5, 1.000000e-08
br i1 %6, label %10, label %7
7: ; preds = %1
%8 = load double, double* %3
%9 = fcmp ogt double %8, 0x44B52D02C7E14AF6
br i1 %9, label %10, label %11
10: ; preds = %7, %1
store i32 0, i32* %2
br label %76
11: ; preds = %7
%12 = load double, double* %3
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [31 x double], [31 x double]* @overflow_binary_search.ins, i64 0, i64 %14
%16 = load double, double* %15
%17 = fcmp olt double %12, %16
br i1 %17, label %18, label %21
18: ; preds = %11
%19 = load i32, i32* %4
%20 = sub nsw i32 %19, 8
store i32 %20, i32* %4
br label %24
21: ; preds = %11
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 8
store i32 %23, i32* %4
br label %24
24: ; preds = %21, %18
%25 = load double, double* %3
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [31 x double], [31 x double]* @overflow_binary_search.ins, i64 0, i64 %27
%29 = load double, double* %28
%30 = fcmp olt double %25, %29
br i1 %30, label %31, label %34
31: ; preds = %24
%32 = load i32, i32* %4
%33 = sub nsw i32 %32, 4
store i32 %33, i32* %4
br label %37
34: ; preds = %24
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 4
store i32 %36, i32* %4
br label %37
37: ; preds = %34, %31
%38 = load double, double* %3
%39 = load i32, i32* %4
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [31 x double], [31 x double]* @overflow_binary_search.ins, i64 0, i64 %40
%42 = load double, double* %41
%43 = fcmp olt double %38, %42
br i1 %43, label %44, label %47
44: ; preds = %37
%45 = load i32, i32* %4
%46 = sub nsw i32 %45, 2
store i32 %46, i32* %4
br label %50
47: ; preds = %37
%48 = load i32, i32* %4
%49 = add nsw i32 %48, 2
store i32 %49, i32* %4
br label %50
50: ; preds = %47, %44
%51 = load double, double* %3
%52 = load i32, i32* %4
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [31 x double], [31 x double]* @overflow_binary_search.ins, i64 0, i64 %53
%55 = load double, double* %54
%56 = fcmp olt double %51, %55
br i1 %56, label %57, label %60
57: ; preds = %50
%58 = load i32, i32* %4
%59 = sub nsw i32 %58, 1
store i32 %59, i32* %4
br label %63
60: ; preds = %50
%61 = load i32, i32* %4
%62 = add nsw i32 %61, 1
store i32 %62, i32* %4
br label %63
63: ; preds = %60, %57
%64 = load double, double* %3
%65 = load i32, i32* %4
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [31 x double], [31 x double]* @overflow_binary_search.ins, i64 0, i64 %66
%68 = load double, double* %67
%69 = fcmp olt double %64, %68
br i1 %69, label %70, label %73
70: ; preds = %63
%71 = load i32, i32* %4
%72 = sub nsw i32 %71, 1
store i32 %72, i32* %4
br label %73
73: ; preds = %70, %63
br label %74
74: ; preds = %73
%75 = load i32, i32* %4
store i32 %75, i32* %2
br label %76
76: ; preds = %74, %10
%77 = load i32, i32* %2
ret i32 %77
}

LLVM IR (-O2):
@overflow_binary_search.ins = internal unnamed_addr constant [31 x double] [double 1.000000e-08, 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, double 1.000000e+01, double 1.000000e+02, double 1.000000e+03, double 1.000000e+04, double 1.000000e+05, double 1.000000e+06, double 1.000000e+07, double 1.000000e+08, double 1.000000e+09, double 1.000000e+10, double 1.000000e+11, double 1.000000e+12, double 1.000000e+13, double 1.000000e+14, double 1.000000e+15, double 1.000000e+16, double 1.000000e+17, double 1.000000e+18, double 1.000000e+19, double 1.000000e+20, double 1.000000e+21, double 1.000000e+22]
define i32 @overflow_binary_search(double %0) {
%2 = fcmp olt double %0, 1.000000e-08
%3 = fcmp ogt double %0, 0x44B52D02C7E14AF6
%4 = or i1 %2, %3
br i1 %4, label %35, label %5
5: ; preds = %1
%6 = fcmp olt double %0, 1.000000e+08
%7 = select i1 %6, i32 8, i32 24
%8 = zext i32 %7 to i64
%9 = getelementptr inbounds [31 x double], [31 x double]* @overflow_binary_search.ins, i64 0, i64 %8
%10 = load double, double* %9
%11 = fcmp ogt double %10, %0
%12 = add nsw i32 %7, -4
%13 = or i32 %7, 4
%14 = select i1 %11, i32 %12, i32 %13
%15 = zext i32 %14 to i64
%16 = getelementptr inbounds [31 x double], [31 x double]* @overflow_binary_search.ins, i64 0, i64 %15
%17 = load double, double* %16
%18 = fcmp ogt double %17, %0
%19 = add nsw i32 %14, -2
%20 = or i32 %14, 2
%21 = select i1 %18, i32 %19, i32 %20
%22 = zext i32 %21 to i64
%23 = getelementptr inbounds [31 x double], [31 x double]* @overflow_binary_search.ins, i64 0, i64 %22
%24 = load double, double* %23
%25 = fcmp ogt double %24, %0
%26 = add nsw i32 %21, -1
%27 = or i32 %21, 1
%28 = select i1 %25, i32 %26, i32 %27
%29 = zext i32 %28 to i64
%30 = getelementptr inbounds [31 x double], [31 x double]* @overflow_binary_search.ins, i64 0, i64 %29
%31 = load double, double* %30
%32 = fcmp ogt double %31, %0
%33 = sext i1 %32 to i32
%34 = add nsw i32 %28, %33
br label %35
35: ; preds = %1, %5
%36 = phi i32 [ %34, %5 ], [ 0, %1 ]
ret i32 %36
}