double pw10(int x) {
  double xi, ex, y;
  if (x > 38.0)
    return (1.7014117331926443e38);
  if (x < -38.0)
    return (0.0);
  xi = x;
  ex = 1.0;
  while (xi > 1.0) {
    ex *= 10.0;
    xi--;
  }
  while (xi < 0.0) {
    ex *= 0.1;
    xi++;
  }
  y = ((((((.00093264267 * xi + .00255491796) * xi + .01742111988) * xi +
          .07295173666) *
             xi +
         .25439357484) *
            xi +
        .66273088429) *
           xi +
       1.15129277603) *
          xi +
      1.0;
  y *= y;
  return (y * ex);
}


x86 assembly (clang, -O0):
<pw10>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xeec(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1130 <pw10+0x30>
movsd  0xf42(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12a5 <pw10+0x1a5>
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  0xecb(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1154 <pw10+0x54>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12a5 <pw10+0x1a5>
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xeaa(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe98(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11ab <pw10+0xab>
movsd  0xed6(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xebc(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    116b <pw10+0x6b>
jmp    11b0 <pw10+0xb0>
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11e7 <pw10+0xe7>
movsd  0xe8a(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe38(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11b0 <pw10+0xb0>
movsd  -0x18(%rbp),%xmm0
movsd  0xe4c(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe48(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe23(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe06(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xde9(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdcc(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdaf(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd92(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<pw10>:
cmp    $0x26,%edi
jle    110e <pw10+0xe>
movsd  0xef3(%rip),%xmm0
ret
xorpd  %xmm0,%xmm0
cmp    $0xffffffda,%edi
jl     11f2 <pw10+0xf2>
cvtsi2sd %edi,%xmm1
cmp    $0x2,%edi
jl     1150 <pw10+0x50>
movsd  0xedc(%rip),%xmm0
movsd  0xedc(%rip),%xmm3
movsd  0xedc(%rip),%xmm4
movapd %xmm0,%xmm2
mulsd  %xmm3,%xmm2
addsd  %xmm4,%xmm1
ucomisd %xmm0,%xmm1
ja     1140 <pw10+0x40>
jmp    1158 <pw10+0x58>
movsd  0xeb0(%rip),%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    118e <pw10+0x8e>
movsd  0xeb6(%rip),%xmm3
movsd  0xe96(%rip),%xmm4
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mulsd  %xmm3,%xmm2
addsd  %xmm4,%xmm1
ucomisd %xmm1,%xmm0
ja     1180 <pw10+0x80>
movsd  0xe92(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xe8e(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xe8a(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xe86(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xe82(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xe7e(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xe7a(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xe1e(%rip),%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @pw10(i32 %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca double
store i32 %0, i32* %3
%7 = load i32, i32* %3
%8 = sitofp i32 %7 to double
%9 = fcmp ogt double %8, 3.800000e+01
br i1 %9, label %10, label %11
10: ; preds = %1
store double 0x47DFFFFFE0000000, double* %2
br label %57
11: ; preds = %1
%12 = load i32, i32* %3
%13 = sitofp i32 %12 to double
%14 = fcmp olt double %13, -3.800000e+01
br i1 %14, label %15, label %16
15: ; preds = %11
store double 0.000000e+00, double* %2
br label %57
16: ; preds = %11
%17 = load i32, i32* %3
%18 = sitofp i32 %17 to double
store double %18, double* %4
store double 1.000000e+00, double* %5
br label %19
19: ; preds = %22, %16
%20 = load double, double* %4
%21 = fcmp ogt double %20, 1.000000e+00
br i1 %21, label %22, label %27
22: ; preds = %19
%23 = load double, double* %5
%24 = fmul double %23, 1.000000e+01
store double %24, double* %5
%25 = load double, double* %4
%26 = fadd double %25, -1.000000e+00
store double %26, double* %4
br label %19
27: ; preds = %19
br label %28
28: ; preds = %31, %27
%29 = load double, double* %4
%30 = fcmp olt double %29, 0.000000e+00
br i1 %30, label %31, label %36
31: ; preds = %28
%32 = load double, double* %5
%33 = fmul double %32, 1.000000e-01
store double %33, double* %5
%34 = load double, double* %4
%35 = fadd double %34, 1.000000e+00
store double %35, double* %4
br label %28
36: ; preds = %28
%37 = load double, double* %4
%38 = call double @llvm.fmuladd.f64(double 0x3F4E8F92E21CCE99, double %37, double 0x3F64EE0D22A11460)
%39 = load double, double* %4
%40 = call double @llvm.fmuladd.f64(double %38, double %39, double 0x3F91D6D79093C22F)
%41 = load double, double* %4
%42 = call double @llvm.fmuladd.f64(double %40, double %41, double 0x3FB2ACF70B241F69)
%43 = load double, double* %4
%44 = call double @llvm.fmuladd.f64(double %42, double %43, double 0x3FD047FBFD100562)
%45 = load double, double* %4
%46 = call double @llvm.fmuladd.f64(double %44, double %45, double 0x3FE5351766426407)
%47 = load double, double* %4
%48 = call double @llvm.fmuladd.f64(double %46, double %47, double 0x3FF26BB1F952B7EC)
%49 = load double, double* %4
%50 = call double @llvm.fmuladd.f64(double %48, double %49, double 1.000000e+00)
store double %50, double* %6
%51 = load double, double* %6
%52 = load double, double* %6
%53 = fmul double %52, %51
store double %53, double* %6
%54 = load double, double* %6
%55 = load double, double* %5
%56 = fmul double %54, %55
store double %56, double* %2
br label %57
57: ; preds = %36, %15, %10
%58 = load double, double* %2
ret double %58
}

LLVM IR (-O2):
define double @pw10(i32 %0) {
%2 = icmp sgt i32 %0, 38
br i1 %2, label %36, label %3
3: ; preds = %1
%4 = sitofp i32 %0 to double
%5 = icmp slt i32 %0, -38
br i1 %5, label %36, label %6
6: ; preds = %3
%7 = icmp sgt i32 %0, 1
br i1 %7, label %12, label %8
8: ; preds = %12, %6
%9 = phi double [ %4, %6 ], [ %16, %12 ]
%10 = phi double [ 1.000000e+00, %6 ], [ %15, %12 ]
%11 = fcmp olt double %9, 0.000000e+00
br i1 %11, label %18, label %24
12: ; preds = %6, %12
%13 = phi double [ %15, %12 ], [ 1.000000e+00, %6 ]
%14 = phi double [ %16, %12 ], [ %4, %6 ]
%15 = fmul double %13, 1.000000e+01
%16 = fadd double %14, -1.000000e+00
%17 = fcmp ogt double %16, 1.000000e+00
br i1 %17, label %12, label %8
18: ; preds = %8, %18
%19 = phi double [ %21, %18 ], [ %10, %8 ]
%20 = phi double [ %22, %18 ], [ %9, %8 ]
%21 = fmul double %19, 1.000000e-01
%22 = fadd double %20, 1.000000e+00
%23 = fcmp olt double %22, 0.000000e+00
br i1 %23, label %18, label %24
24: ; preds = %18, %8
%25 = phi double [ %9, %8 ], [ %22, %18 ]
%26 = phi double [ %10, %8 ], [ %21, %18 ]
%27 = tail call double @llvm.fmuladd.f64(double %25, double 0x3F4E8F92E21CCE99, double 0x3F64EE0D22A11460)
%28 = tail call double @llvm.fmuladd.f64(double %27, double %25, double 0x3F91D6D79093C22F)
%29 = tail call double @llvm.fmuladd.f64(double %28, double %25, double 0x3FB2ACF70B241F69)
%30 = tail call double @llvm.fmuladd.f64(double %29, double %25, double 0x3FD047FBFD100562)
%31 = tail call double @llvm.fmuladd.f64(double %30, double %25, double 0x3FE5351766426407)
%32 = tail call double @llvm.fmuladd.f64(double %31, double %25, double 0x3FF26BB1F952B7EC)
%33 = tail call double @llvm.fmuladd.f64(double %32, double %25, double 1.000000e+00)
%34 = fmul double %33, %33
%35 = fmul double %26, %34
br label %36
36: ; preds = %3, %1, %24
%37 = phi double [ %35, %24 ], [ 0x47DFFFFFE0000000, %1 ], [ 0.000000e+00, %3 ]
ret double %37
}