#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 */
int M_LN10;
int M_LN2;
double exp(double);
double floor(double);
double frexp(double, int *);
double modf(int, double *);
double frexp10(double num, int *rExponent) {
  int exponent2 = 0;
  double fraction2 = frexp(num, &exponent2);
  double exponent10 = 0.0;
  double remainder10 = modf(exponent2 * M_LN2 / M_LN10, &exponent10);
  double exponent10Floor = floor(exponent10);
  *rExponent = (int)exponent10Floor;
  return fraction2 * exp((remainder10 - exponent10Floor + exponent10) * M_LN10);
}


x86 assembly (clang, -O0):
<frexp10>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    -0x14(%rbp),%rdi
call   1040 <frexp@plt>
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2e5b(%rip),%rcx
imul   (%rcx),%eax
mov    0x2e59(%rip),%rcx
cltd
idivl  (%rcx)
mov    %eax,%edi
lea    -0x28(%rbp),%rsi
call   1030 <modf@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1060 <floor@plt>
movsd  %xmm0,-0x38(%rbp)
cvttsd2si -0x38(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
mov    0x2e0c(%rip),%rax
cvtsi2sdl (%rax),%xmm1
mulsd  %xmm1,%xmm0
call   1050 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<frexp10>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rdi,%rbx
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1040 <frexp@plt>
movsd  %xmm0,0x20(%rsp)
movq   $0x0,0x8(%rsp)
mov    0x2e66(%rip),%rax
mov    (%rax),%eax
imul   0x4(%rsp),%eax
mov    0x2e60(%rip),%r14
cltd
idivl  (%r14)
lea    0x8(%rsp),%rsi
mov    %eax,%edi
call   1030 <modf@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
call   1060 <floor@plt>
cvttsd2si %xmm0,%eax
mov    %eax,(%rbx)
movsd  0x18(%rsp),%xmm1
subsd  %xmm0,%xmm1
addsd  0x10(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sdl (%r14),%xmm0
mulsd  %xmm1,%xmm0
call   1050 <exp@plt>
mulsd  0x20(%rsp),%xmm0
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@M_LN2 = global i32 0
@M_LN10 = global i32 0
define double @frexp10(double %0, i32* %1) {
%3 = alloca double
%4 = alloca i32*
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %3
store i32* %1, i32** %4
store i32 0, i32* %5
%10 = load double, double* %3
%11 = call double @frexp(double %10, i32* %5)
store double %11, double* %6
store double 0.000000e+00, double* %7
%12 = load i32, i32* %5
%13 = load i32, i32* @M_LN2
%14 = mul nsw i32 %12, %13
%15 = load i32, i32* @M_LN10
%16 = sdiv i32 %14, %15
%17 = call double @modf(i32 %16, double* %7)
store double %17, double* %8
%18 = load double, double* %7
%19 = call double @llvm.floor.f64(double %18)
store double %19, double* %9
%20 = load double, double* %9
%21 = fptosi double %20 to i32
%22 = load i32*, i32** %4
store i32 %21, i32* %22
%23 = load double, double* %6
%24 = load double, double* %8
%25 = load double, double* %9
%26 = fsub double %24, %25
%27 = load double, double* %7
%28 = fadd double %26, %27
%29 = load i32, i32* @M_LN10
%30 = sitofp i32 %29 to double
%31 = fmul double %28, %30
%32 = call double @exp(double %31)
%33 = fmul double %23, %32
ret double %33
}

LLVM IR (-O2):
@M_LN2 = global i32 0
@M_LN10 = global i32 0
define double @frexp10(double %0, i32* nocapture writeonly %1) {
%3 = alloca i32
%4 = alloca double
%5 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%6 = call double @frexp(double %0, i32* %3)
%7 = bitcast double* %4 to i8*
store double 0.000000e+00, double* %4
%8 = load i32, i32* %3
%9 = load i32, i32* @M_LN2
%10 = mul nsw i32 %9, %8
%11 = load i32, i32* @M_LN10
%12 = sdiv i32 %10, %11
%13 = call double @modf(i32 %12, double* %4)
%14 = load double, double* %4
%15 = tail call double @llvm.floor.f64(double %14)
%16 = fptosi double %15 to i32
store i32 %16, i32* %1
%17 = fsub double %13, %15
%18 = fadd double %14, %17
%19 = load i32, i32* @M_LN10
%20 = sitofp i32 %19 to double
%21 = fmul double %18, %20
%22 = tail call double @exp(double %21)
%23 = fmul double %6, %22
ret double %23
}