#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double exp2(double);
int fabs(double);
double modf(double, double *);
double pow(double, double);
double exp10(double x) {
  static const double p10[] = {
      1e-15, 1e-14, 1e-13, 1e-12, 1e-11, 1e-10, 1e-9, 1e-8, 1e-7, 1e-6, 1e-5,
      1e-4,  1e-3,  1e-2,  1e-1,  1,     1e1,   1e2,  1e3,  1e4,  1e5,  1e6,
      1e7,   1e8,   1e9,   1e10,  1e11,  1e12,  1e13, 1e14, 1e15};
  double n, y = modf(x, &n);
  if (fabs(n) < 16) {
    if (!y)
      return p10[(int)n + 15];
    y = exp2(3.32192809488736234787031942948939 * y);
    return y * p10[(int)n + 15];
  }
  return pow(10.0, x);
}


x86 assembly (clang, -O0):
<exp10>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    -0x18(%rbp),%rdi
call   1040 <modf@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1050 <fabs@plt>
cmp    $0x10,%eax
jge    11e9 <exp10+0xa9>
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11ac <exp10+0x6c>
jp     11ac <exp10+0x6c>
cvttsd2si -0x18(%rbp),%eax
add    $0xf,%eax
movslq %eax,%rcx
lea    0xe73(%rip),%rax
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1200 <exp10+0xc0>
movsd  0xe54(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
call   1030 <exp2@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
cvttsd2si -0x18(%rbp),%eax
add    $0xf,%eax
movslq %eax,%rcx
lea    0xe36(%rip),%rax
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1200 <exp10+0xc0>
movsd  -0x10(%rbp),%xmm1
movsd  0xe0a(%rip),%xmm0
call   1060 <pow@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exp10>:
sub    $0x28,%rsp
lea    0x20(%rsp),%rdi
movsd  %xmm0,0x18(%rsp)
call   1040 <modf@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1050 <fabs@plt>
cmp    $0xf,%eax
jg     11ad <exp10+0x6d>
xorpd  %xmm0,%xmm0
movsd  0x10(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jne    1182 <exp10+0x42>
jnp    11c4 <exp10+0x84>
movapd %xmm1,%xmm0
mulsd  0xe7a(%rip),%xmm0
call   1030 <exp2@plt>
cvttsd2si 0x8(%rsp),%eax
cltq
lea    0xe6e(%rip),%rcx
mulsd  0x78(%rcx,%rax,8),%xmm0
add    $0x28,%rsp
ret
movsd  0xe4b(%rip),%xmm0
movsd  0x18(%rsp),%xmm1
add    $0x28,%rsp
jmp    1060 <pow@plt>
cvttsd2si 0x8(%rsp),%eax
cltq
lea    0xe3d(%rip),%rcx
movsd  0x78(%rcx,%rax,8),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
@exp10.p10 = internal constant [31 x double] [double 1.000000e-15, double 0x3D06849B86A12B9B, double 1.000000e-13, double 0x3D719799812DEA11, double 0x3DA5FD7FE1796495, double 1.000000e-10, double 1.000000e-09, 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]
define double @exp10(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
%6 = load double, double* %3
%7 = call double @modf(double %6, double* %4)
store double %7, double* %5
%8 = load double, double* %4
%9 = call i32 @fabs(double %8)
%10 = icmp slt i32 %9, 16
br i1 %10, label %11, label %33
11: ; preds = %1
%12 = load double, double* %5
%13 = fcmp une double %12, 0.000000e+00
br i1 %13, label %21, label %14
14: ; preds = %11
%15 = load double, double* %4
%16 = fptosi double %15 to i32
%17 = add nsw i32 %16, 15
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [31 x double], [31 x double]* @exp10.p10, i64 0, i64 %18
%20 = load double, double* %19
store double %20, double* %2
br label %36
21: ; preds = %11
%22 = load double, double* %5
%23 = fmul double 0x400A934F0979A371, %22
%24 = call double @exp2(double %23)
store double %24, double* %5
%25 = load double, double* %5
%26 = load double, double* %4
%27 = fptosi double %26 to i32
%28 = add nsw i32 %27, 15
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [31 x double], [31 x double]* @exp10.p10, i64 0, i64 %29
%31 = load double, double* %30
%32 = fmul double %25, %31
store double %32, double* %2
br label %36
33: ; preds = %1
%34 = load double, double* %3
%35 = call double @pow(double 1.000000e+01, double %34)
store double %35, double* %2
br label %36
36: ; preds = %33, %21, %14
%37 = load double, double* %2
ret double %37
}

LLVM IR (-O2):
@exp10.p10 = internal unnamed_addr constant [31 x double] [double 1.000000e-15, double 0x3D06849B86A12B9B, double 1.000000e-13, double 0x3D719799812DEA11, double 0x3DA5FD7FE1796495, double 1.000000e-10, double 1.000000e-09, 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]
define double @exp10(double %0) {
%2 = alloca double
%3 = bitcast double* %2 to i8*
%4 = call double @modf(double %0, double* %2)
%5 = load double, double* %2
%6 = tail call i32 @fabs(double %5)
%7 = icmp slt i32 %6, 16
br i1 %7, label %8, label %25
8: ; preds = %1
%9 = fcmp une double %4, 0.000000e+00
br i1 %9, label %16, label %10
10: ; preds = %8
%11 = fptosi double %5 to i32
%12 = add nsw i32 %11, 15
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [31 x double], [31 x double]* @exp10.p10, i64 0, i64 %13
%15 = load double, double* %14
br label %27
16: ; preds = %8
%17 = fmul double %4, 0x400A934F0979A371
%18 = tail call double @exp2(double %17)
%19 = fptosi double %5 to i32
%20 = add nsw i32 %19, 15
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [31 x double], [31 x double]* @exp10.p10, i64 0, i64 %21
%23 = load double, double* %22
%24 = fmul double %18, %23
br label %27
25: ; preds = %1
%26 = tail call double @pow(double 1.000000e+01, double %0)
br label %27
27: ; preds = %25, %16, %10
%28 = phi double [ %24, %16 ], [ %15, %10 ], [ %26, %25 ]
ret double %28
}