#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 */
typedef int uint64_t;

/* Variables and functions */
double exp2(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);
  union {
    double f;
    uint64_t i;
  } u = {n};
  if ((u.i >> 52 & 0x7ff) < 0x3ff + 4) {
    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    $0x30,%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
movsd  %xmm0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    $0x34,%ecx
sar    %cl,%eax
and    $0x7ff,%eax
cmp    $0x403,%eax
jge    11ea <exp10+0xba>
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11ad <exp10+0x7d>
jp     11ad <exp10+0x7d>
cvttsd2si -0x18(%rbp),%eax
add    $0xf,%eax
movslq %eax,%rcx
lea    0xe72(%rip),%rax
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1201 <exp10+0xd1>
movsd  0xe53(%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    0xe35(%rip),%rax
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1201 <exp10+0xd1>
movsd  -0x10(%rbp),%xmm1
movsd  0xe09(%rip),%xmm0
call   1050 <pow@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exp10>:
sub    $0x18,%rsp
movsd  %xmm0,0x8(%rsp)
lea    0x10(%rsp),%rdi
call   1030 <modf@plt>
movsd  0xec4(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
add    $0x18,%rsp
jmp    1040 <pow@plt>

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

LLVM IR (-O2):
define double @exp10(double %0) {
%2 = alloca double
%3 = bitcast double* %2 to i8*
%4 = call double @modf(double %0, double* %2)
%5 = tail call double @pow(double 1.000000e+01, double %0)
ret double %5
}