#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 log(double);
double rlog(double *x) {
  static double a = .566749439387324e-01;
  static double b = .456512608815524e-01;
  static double p0 = .333333333333333e+00;
  static double p1 = -.224696413112536e+00;
  static double p2 = .620886815375787e-02;
  static double q1 = -.127408923933623e+01;
  static double q2 = .354508718369557e+00;
  static double rlog, r, t, u, w, w1;
  if (*x < 0.61e0 || *x > 1.57e0)
    goto S40;
  if (*x < 0.82e0)
    goto S10;
  if (*x > 1.18e0)
    goto S20;
  u = *x - 0.5e0 - 0.5e0;
  w1 = 0.0e0;
  goto S30;
S10:
  u = *x - 0.7e0;
  u /= 0.7e0;
  w1 = a - u * 0.3e0;
  goto S30;
S20:
  u = 0.75e0 * *x - 1.e0;
  w1 = b + u / 3.0e0;
S30:
  r = u / (u + 2.0e0);
  t = r * r;
  w = ((p2 * t + p1) * t + p0) / ((q2 * t + q1) * t + 1.0e0);
  rlog = 2.0e0 * t * (1.0e0 / (1.0e0 - r) - r * w) + w1;
  return rlog;
S40:
  r = *x - 0.5e0 - 0.5e0;
  rlog = r - log(*x);
  return rlog;
}


x86 assembly (clang, -O0):
<rlog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  0xed8(%rip),%xmm0
ucomisd (%rax),%xmm0
ja     114c <rlog+0x3c>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xec6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1151 <rlog+0x41>
jmp    13cc <rlog+0x2bc>
mov    -0x10(%rbp),%rax
movsd  0xeb3(%rip),%xmm0
ucomisd (%rax),%xmm0
jbe    116c <rlog+0x5c>
jmp    11c3 <rlog+0xb3>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xe9c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    118b <rlog+0x7b>
jmp    123f <rlog+0x12f>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xe85(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe79(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,0x2ecd(%rip)
xorps  %xmm0,%xmm0
movsd  %xmm0,0x2ed2(%rip)
jmp    128f <rlog+0x17f>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xe75(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,0x2ea1(%rip)
movsd  0x2e99(%rip),%xmm0
movsd  0xe59(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x2e85(%rip)
movsd  0x2e25(%rip),%xmm1
movsd  0x2e75(%rip),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe16(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x2e56(%rip)
jmp    128f <rlog+0x17f>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xde1(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xddd(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,0x2e19(%rip)
movsd  0x2dc1(%rip),%xmm0
movsd  0x2e09(%rip),%xmm1
movsd  0xda9(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,0x2e01(%rip)
movsd  0x2de9(%rip),%xmm0
movsd  0xdb9(%rip),%xmm1
addsd  0x2dd9(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x2dbd(%rip)
movsd  0x2db5(%rip),%xmm0
mulsd  0x2dad(%rip),%xmm0
movsd  %xmm0,0x2dad(%rip)
movsd  0x2d75(%rip),%xmm0
movsd  0x2d9d(%rip),%xmm2
movsd  0x2d5d(%rip),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0x2d85(%rip),%xmm2
movsd  0x2d3d(%rip),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0x2d4d(%rip),%xmm1
movsd  0x2d65(%rip),%xmm3
movsd  0x2d35(%rip),%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
movsd  0x2d4d(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xd19(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x2d41(%rip)
movsd  0xd09(%rip),%xmm0
mulsd  0x2d21(%rip),%xmm0
movsd  0xcf1(%rip),%xmm2
subsd  0x2d09(%rip),%xmm2
movsd  0xce1(%rip),%xmm1
divsd  %xmm2,%xmm1
movsd  0x2cf5(%rip),%xmm2
movsd  0x2d05(%rip),%xmm3
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movsd  0x2ce6(%rip),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x2cae(%rip)
movsd  0x2ca6(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    142f <rlog+0x31f>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xc44(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xc38(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,0x2c7c(%rip)
movsd  0x2c74(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x2c46(%rip)
movsd  0x2c3e(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rlog>:
push   %rax
movsd  (%rdi),%xmm0
movsd  0xee3(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     1161 <rlog+0x51>
ucomisd 0xedd(%rip),%xmm0
ja     1161 <rlog+0x51>
movsd  0xedb(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    118d <rlog+0x7d>
addsd  0xf05(%rip),%xmm0
divsd  0xf05(%rip),%xmm0
movsd  0xf05(%rip),%xmm2
mulsd  %xmm0,%xmm2
addsd  0xf01(%rip),%xmm2
jmp    11d1 <rlog+0xc1>
movsd  0xeb7(%rip),%xmm1
movapd %xmm0,%xmm2
addsd  %xmm1,%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%rsp)
call   1030 <log@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
jmp    1245 <rlog+0x135>
ucomisd 0xe83(%rip),%xmm0
jbe    11bd <rlog+0xad>
mulsd  0xe89(%rip),%xmm0
addsd  0xe89(%rip),%xmm0
movapd %xmm0,%xmm2
divsd  0xe85(%rip),%xmm2
addsd  0xe85(%rip),%xmm2
jmp    11d1 <rlog+0xc1>
movsd  0xe5b(%rip),%xmm1
addsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm2,%xmm2
movsd  0xe8f(%rip),%xmm1
addsd  %xmm0,%xmm1
divsd  %xmm1,%xmm0
movapd %xmm0,%xmm3
mulsd  %xmm0,%xmm3
movapd %xmm3,%xmm1
unpcklpd %xmm3,%xmm1
movapd 0xe87(%rip),%xmm4
mulpd  %xmm1,%xmm4
addpd  0xe8b(%rip),%xmm4
mulpd  %xmm1,%xmm4
addpd  0xe8f(%rip),%xmm4
movapd %xmm4,%xmm1
unpckhpd %xmm4,%xmm1
divsd  %xmm1,%xmm4
addsd  %xmm3,%xmm3
movsd  0xe47(%rip),%xmm1
movapd %xmm1,%xmm5
subsd  %xmm0,%xmm5
divsd  %xmm5,%xmm1
mulsd  %xmm0,%xmm4
subsd  %xmm4,%xmm1
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@rlog.a = internal global double 0x3FAD047F8D7060E0
@rlog.b = internal global double 0x3FA75F9A2103CE16
@rlog.p0 = internal global double 0x3FD555555555554F
@rlog.p1 = internal global double 0xBFCCC2DA20EC6581
@rlog.p2 = internal global double 0x3F796E785AA6287C
@rlog.q1 = internal global double 0xBFF462AB65F2276C
@rlog.q2 = internal global double 0x3FD6B04555E2D2E4
@rlog.rlog = internal global double 0.000000e+00
@rlog.r = internal global double 0.000000e+00
@rlog.t = internal global double 0.000000e+00
@rlog.u = internal global double 0.000000e+00
@rlog.w = internal global double 0.000000e+00
@rlog.w1 = internal global double 0.000000e+00
define double @rlog(double* %0) {
%2 = alloca double
%3 = alloca double*
store double* %0, double** %3
%4 = load double*, double** %3
%5 = load double, double* %4
%6 = fcmp olt double %5, 6.100000e-01
br i1 %6, label %11, label %7
7: ; preds = %1
%8 = load double*, double** %3
%9 = load double, double* %8
%10 = fcmp ogt double %9, 1.570000e+00
br i1 %10, label %11, label %12
11: ; preds = %7, %1
br label %79
12: ; preds = %7
%13 = load double*, double** %3
%14 = load double, double* %13
%15 = fcmp olt double %14, 8.200000e-01
br i1 %15, label %16, label %17
16: ; preds = %12
br label %27
17: ; preds = %12
%18 = load double*, double** %3
%19 = load double, double* %18
%20 = fcmp ogt double %19, 1.180000e+00
br i1 %20, label %21, label %22
21: ; preds = %17
br label %37
22: ; preds = %17
%23 = load double*, double** %3
%24 = load double, double* %23
%25 = fsub double %24, 5.000000e-01
%26 = fsub double %25, 5.000000e-01
store double %26, double* @rlog.u
store double 0.000000e+00, double* @rlog.w1
br label %45
27: ; preds = %16
%28 = load double*, double** %3
%29 = load double, double* %28
%30 = fsub double %29, 0x3FE6666666666666
store double %30, double* @rlog.u
%31 = load double, double* @rlog.u
%32 = fdiv double %31, 0x3FE6666666666666
store double %32, double* @rlog.u
%33 = load double, double* @rlog.a
%34 = load double, double* @rlog.u
%35 = fneg double %34
%36 = call double @llvm.fmuladd.f64(double %35, double 3.000000e-01, double %33)
store double %36, double* @rlog.w1
br label %45
37: ; preds = %21
%38 = load double*, double** %3
%39 = load double, double* %38
%40 = call double @llvm.fmuladd.f64(double 7.500000e-01, double %39, double -1.000000e+00)
store double %40, double* @rlog.u
%41 = load double, double* @rlog.b
%42 = load double, double* @rlog.u
%43 = fdiv double %42, 3.000000e+00
%44 = fadd double %41, %43
store double %44, double* @rlog.w1
br label %45
45: ; preds = %37, %27, %22
%46 = load double, double* @rlog.u
%47 = load double, double* @rlog.u
%48 = fadd double %47, 2.000000e+00
%49 = fdiv double %46, %48
store double %49, double* @rlog.r
%50 = load double, double* @rlog.r
%51 = load double, double* @rlog.r
%52 = fmul double %50, %51
store double %52, double* @rlog.t
%53 = load double, double* @rlog.p2
%54 = load double, double* @rlog.t
%55 = load double, double* @rlog.p1
%56 = call double @llvm.fmuladd.f64(double %53, double %54, double %55)
%57 = load double, double* @rlog.t
%58 = load double, double* @rlog.p0
%59 = call double @llvm.fmuladd.f64(double %56, double %57, double %58)
%60 = load double, double* @rlog.q2
%61 = load double, double* @rlog.t
%62 = load double, double* @rlog.q1
%63 = call double @llvm.fmuladd.f64(double %60, double %61, double %62)
%64 = load double, double* @rlog.t
%65 = call double @llvm.fmuladd.f64(double %63, double %64, double 1.000000e+00)
%66 = fdiv double %59, %65
store double %66, double* @rlog.w
%67 = load double, double* @rlog.t
%68 = fmul double 2.000000e+00, %67
%69 = load double, double* @rlog.r
%70 = fsub double 1.000000e+00, %69
%71 = fdiv double 1.000000e+00, %70
%72 = load double, double* @rlog.r
%73 = load double, double* @rlog.w
%74 = fneg double %72
%75 = call double @llvm.fmuladd.f64(double %74, double %73, double %71)
%76 = load double, double* @rlog.w1
%77 = call double @llvm.fmuladd.f64(double %68, double %75, double %76)
store double %77, double* @rlog.rlog
%78 = load double, double* @rlog.rlog
store double %78, double* %2
br label %90
79: ; preds = %11
%80 = load double*, double** %3
%81 = load double, double* %80
%82 = fsub double %81, 5.000000e-01
%83 = fsub double %82, 5.000000e-01
store double %83, double* @rlog.r
%84 = load double, double* @rlog.r
%85 = load double*, double** %3
%86 = load double, double* %85
%87 = call double @log(double %86)
%88 = fsub double %84, %87
store double %88, double* @rlog.rlog
%89 = load double, double* @rlog.rlog
store double %89, double* %2
br label %90
90: ; preds = %79, %45
%91 = load double, double* %2
ret double %91
}

LLVM IR (-O2):
define double @rlog(double* nocapture %0) {
%2 = load double, double* %0
%3 = fcmp olt double %2, 6.100000e-01
%4 = fcmp ogt double %2, 1.570000e+00
%5 = or i1 %3, %4
br i1 %5, label %41, label %6
6: ; preds = %1
%7 = fcmp olt double %2, 8.200000e-01
br i1 %7, label %13, label %8
8: ; preds = %6
%9 = fcmp ogt double %2, 1.180000e+00
br i1 %9, label %18, label %10
10: ; preds = %8
%11 = fadd double %2, -5.000000e-01
%12 = fadd double %11, -5.000000e-01
br label %22
13: ; preds = %6
%14 = fadd double %2, 0xBFE6666666666666
%15 = fdiv double %14, 0x3FE6666666666666
%16 = fneg double %15
%17 = tail call double @llvm.fmuladd.f64(double %16, double 3.000000e-01, double 0x3FAD047F8D7060E0)
br label %22
18: ; preds = %8
%19 = tail call double @llvm.fmuladd.f64(double %2, double 7.500000e-01, double -1.000000e+00)
%20 = fdiv double %19, 3.000000e+00
%21 = fadd double %20, 0x3FA75F9A2103CE16
br label %22
22: ; preds = %18, %13, %10
%23 = phi double [ %21, %18 ], [ %17, %13 ], [ 0.000000e+00, %10 ]
%24 = phi double [ %19, %18 ], [ %15, %13 ], [ %12, %10 ]
%25 = fadd double %24, 2.000000e+00
%26 = fdiv double %24, %25
%27 = fmul double %26, %26
%28 = insertelement <2 x double> poison, double %27, i64 0
%29 = shufflevector <2 x double> %28, <2 x double> poison, <2 x i32> zeroinitializer
%30 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %29, <2 x double> <double 0x3F796E785AA6287C, double 0x3FD6B04555E2D2E4>, <2 x double> <double 0xBFCCC2DA20EC6581, double 0xBFF462AB65F2276C>)
%31 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %30, <2 x double> %29, <2 x double> <double 0x3FD555555555554F, double 1.000000e+00>)
%32 = extractelement <2 x double> %31, i64 0
%33 = extractelement <2 x double> %31, i64 1
%34 = fdiv double %32, %33
%35 = fmul double %27, 2.000000e+00
%36 = fsub double 1.000000e+00, %26
%37 = fdiv double 1.000000e+00, %36
%38 = fneg double %26
%39 = tail call double @llvm.fmuladd.f64(double %38, double %34, double %37)
%40 = tail call double @llvm.fmuladd.f64(double %35, double %39, double %23)
br label %46
41: ; preds = %1
%42 = fadd double %2, -5.000000e-01
%43 = fadd double %42, -5.000000e-01
%44 = tail call double @log(double %2)
%45 = fsub double %43, %44
br label %46
46: ; preds = %41, %22
%47 = phi double [ %45, %41 ], [ %40, %22 ]
ret double %47
}