double randlc(double *x, double a) {
  const double r23 = 1.1920928955078125e-07;
  const double r46 = r23 * r23;
  const double t23 = 8.388608e+06;
  const double t46 = t23 * t23;
  double t1, t2, t3, t4, a1, a2, x1, x2, z;
  double r;
  t1 = r23 * a;
  a1 = (int)t1;
  a2 = a - t23 * a1;
  t1 = r23 * (*x);
  x1 = (int)t1;
  x2 = *x - t23 * x1;
  t1 = a1 * x2 + a2 * x1;
  t2 = (int)(r23 * t1);
  z = t1 - t23 * t2;
  t3 = t23 * z + a2 * x2;
  t4 = (int)(r46 * t3);
  *x = t3 - t46 * t4;
  r = r46 * (*x);
  return r;
}


x86 assembly (clang, -O0):
<randlc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  0xf0b(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xede(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xee1(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xeec(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xed7(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
cvttsd2si -0x38(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm0
movsd  0xea5(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xe94(%rip),%xmm0
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
cvttsd2si -0x38(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
movsd  -0x68(%rbp),%xmm0
movsd  0xe60(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe32(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
cvttsd2si %xmm0,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
movsd  0xe06(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
mulsd  -0x70(%rbp),%xmm1
movsd  0xdda(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xdb5(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
cvttsd2si %xmm0,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
movsd  0xd99(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0xd75(%rip),%xmm0
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<randlc>:
movhpd (%rdi),%xmm0
movapd 0xef4(%rip),%xmm1
mulpd  %xmm0,%xmm1
cvttpd2dq %xmm1,%xmm1
cvtdq2pd %xmm1,%xmm1
movapd 0xef0(%rip),%xmm2
mulpd  %xmm1,%xmm2
addpd  %xmm2,%xmm0
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
mulsd  %xmm0,%xmm2
movapd %xmm0,%xmm3
unpckhpd %xmm0,%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
movsd  0xed4(%rip),%xmm2
mulsd  %xmm1,%xmm2
cvttpd2dq %xmm2,%xmm2
cvtdq2pd %xmm2,%xmm2
mulsd  0xec8(%rip),%xmm2
addsd  %xmm1,%xmm2
mulsd  %xmm3,%xmm0
mulsd  0xec0(%rip),%xmm2
addsd  %xmm2,%xmm0
movsd  0xebc(%rip),%xmm1
movapd %xmm0,%xmm2
mulsd  %xmm1,%xmm2
cvttpd2dq %xmm2,%xmm2
cvtdq2pd %xmm2,%xmm2
mulsd  0xeac(%rip),%xmm2
addsd  %xmm2,%xmm0
movsd  %xmm0,(%rdi)
mulsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @randlc(double* %0, double %1) {
%3 = alloca double*
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
store double* %0, double** %3
store double %1, double* %4
store double 0x3E80000000000000, double* %5
store double 0x3D10000000000000, double* %6
store double 0x4160000000000000, double* %7
store double 0x42D0000000000000, double* %8
%19 = load double, double* %4
%20 = fmul double 0x3E80000000000000, %19
store double %20, double* %9
%21 = load double, double* %9
%22 = fptosi double %21 to i32
%23 = sitofp i32 %22 to double
store double %23, double* %13
%24 = load double, double* %4
%25 = load double, double* %13
%26 = call double @llvm.fmuladd.f64(double 0xC160000000000000, double %25, double %24)
store double %26, double* %14
%27 = load double*, double** %3
%28 = load double, double* %27
%29 = fmul double 0x3E80000000000000, %28
store double %29, double* %9
%30 = load double, double* %9
%31 = fptosi double %30 to i32
%32 = sitofp i32 %31 to double
store double %32, double* %15
%33 = load double*, double** %3
%34 = load double, double* %33
%35 = load double, double* %15
%36 = call double @llvm.fmuladd.f64(double 0xC160000000000000, double %35, double %34)
store double %36, double* %16
%37 = load double, double* %13
%38 = load double, double* %16
%39 = load double, double* %14
%40 = load double, double* %15
%41 = fmul double %39, %40
%42 = call double @llvm.fmuladd.f64(double %37, double %38, double %41)
store double %42, double* %9
%43 = load double, double* %9
%44 = fmul double 0x3E80000000000000, %43
%45 = fptosi double %44 to i32
%46 = sitofp i32 %45 to double
store double %46, double* %10
%47 = load double, double* %9
%48 = load double, double* %10
%49 = call double @llvm.fmuladd.f64(double 0xC160000000000000, double %48, double %47)
store double %49, double* %17
%50 = load double, double* %17
%51 = load double, double* %14
%52 = load double, double* %16
%53 = fmul double %51, %52
%54 = call double @llvm.fmuladd.f64(double 0x4160000000000000, double %50, double %53)
store double %54, double* %11
%55 = load double, double* %11
%56 = fmul double 0x3D10000000000000, %55
%57 = fptosi double %56 to i32
%58 = sitofp i32 %57 to double
store double %58, double* %12
%59 = load double, double* %11
%60 = load double, double* %12
%61 = call double @llvm.fmuladd.f64(double 0xC2D0000000000000, double %60, double %59)
%62 = load double*, double** %3
store double %61, double* %62
%63 = load double*, double** %3
%64 = load double, double* %63
%65 = fmul double 0x3D10000000000000, %64
store double %65, double* %18
%66 = load double, double* %18
ret double %66
}

LLVM IR (-O2):
define double @randlc(double* nocapture %0, double %1) {
%3 = load double, double* %0
%4 = insertelement <2 x double> poison, double %1, i64 0
%5 = insertelement <2 x double> %4, double %3, i64 1
%6 = fmul <2 x double> %5, <double 0x3E80000000000000, double 0x3E80000000000000>
%7 = fptosi <2 x double> %6 to <2 x i32>
%8 = sitofp <2 x i32> %7 to <2 x double>
%9 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %8, <2 x double> <double 0xC160000000000000, double 0xC160000000000000>, <2 x double> %5)
%10 = extractelement <2 x double> %9, i64 0
%11 = shufflevector <2 x double> %8, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%12 = fmul <2 x double> %9, %11
%13 = extractelement <2 x double> %12, i64 0
%14 = extractelement <2 x double> %9, i64 1
%15 = extractelement <2 x double> %8, i64 0
%16 = tail call double @llvm.fmuladd.f64(double %15, double %14, double %13)
%17 = fmul double %16, 0x3E80000000000000
%18 = fptosi double %17 to i32
%19 = sitofp i32 %18 to double
%20 = tail call double @llvm.fmuladd.f64(double %19, double 0xC160000000000000, double %16)
%21 = fmul double %10, %14
%22 = tail call double @llvm.fmuladd.f64(double %20, double 0x4160000000000000, double %21)
%23 = fmul double %22, 0x3D10000000000000
%24 = fptosi double %23 to i32
%25 = sitofp i32 %24 to double
%26 = tail call double @llvm.fmuladd.f64(double %25, double 0xC2D0000000000000, double %22)
store double %26, double* %0
%27 = fmul double %26, 0x3D10000000000000
ret double %27
}