#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 rlog1(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 rlog1, h, r, t, w, w1;
  if (*x < -0.39e0 || *x > 0.57e0)
    goto S40;
  if (*x < -0.18e0)
    goto S10;
  if (*x > 0.18e0)
    goto S20;
  h = *x;
  w1 = 0.0e0;
  goto S30;
S10:
  h = *x + 0.3e0;
  h /= 0.7e0;
  w1 = a - h * 0.3e0;
  goto S30;
S20:
  h = 0.75e0 * *x - 0.25e0;
  w1 = b + h / 3.0e0;
S30:
  r = h / (h + 2.0e0);
  t = r * r;
  w = ((p2 * t + p1) * t + p0) / ((q2 * t + q1) * t + 1.0e0);
  rlog1 = 2.0e0 * t * (1.0e0 / (1.0e0 - r) - r * w) + w1;
  return rlog1;
S40:
  w = *x + 0.5e0 + 0.5e0;
  rlog1 = *x - log(w);
  return rlog1;
}


x86 assembly (clang, -O0):
<rlog1>:
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 <rlog1+0x3c>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xec6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1151 <rlog1+0x41>
jmp    13b0 <rlog1+0x2a0>
mov    -0x10(%rbp),%rax
movsd  0xeb3(%rip),%xmm0
ucomisd (%rax),%xmm0
jbe    116c <rlog1+0x5c>
jmp    11ab <rlog1+0x9b>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xe9c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    118b <rlog1+0x7b>
jmp    1223 <rlog1+0x113>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,0x2ed5(%rip)
xorps  %xmm0,%xmm0
movsd  %xmm0,0x2eea(%rip)
jmp    1273 <rlog1+0x163>
mov    -0x10(%rbp),%rax
movsd  0xe81(%rip),%xmm0
addsd  (%rax),%xmm0
movsd  %xmm0,0x2ead(%rip)
movsd  0x2ea5(%rip),%xmm0
movsd  0xe6d(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x2e91(%rip)
movsd  0x2e41(%rip),%xmm1
movsd  0x2e81(%rip),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe2a(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x2e72(%rip)
jmp    1273 <rlog1+0x163>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xdf5(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdf1(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,0x2e25(%rip)
movsd  0x2ddd(%rip),%xmm0
movsd  0x2e15(%rip),%xmm1
movsd  0xdbd(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,0x2e1d(%rip)
movsd  0x2df5(%rip),%xmm0
movsd  0xdcd(%rip),%xmm1
addsd  0x2de5(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x2de1(%rip)
movsd  0x2dd9(%rip),%xmm0
mulsd  0x2dd1(%rip),%xmm0
movsd  %xmm0,0x2dd1(%rip)
movsd  0x2d91(%rip),%xmm0
movsd  0x2dc1(%rip),%xmm2
movsd  0x2d79(%rip),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0x2da9(%rip),%xmm2
movsd  0x2d59(%rip),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0x2d69(%rip),%xmm1
movsd  0x2d89(%rip),%xmm3
movsd  0x2d51(%rip),%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
movsd  0x2d71(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xd2d(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x2d5d(%rip)
movsd  0xd1d(%rip),%xmm0
mulsd  0x2d45(%rip),%xmm0
movsd  0xd05(%rip),%xmm2
subsd  0x2d2d(%rip),%xmm2
movsd  0xcf5(%rip),%xmm1
divsd  %xmm2,%xmm1
movsd  0x2d19(%rip),%xmm2
movsd  0x2d21(%rip),%xmm3
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movsd  0x2d02(%rip),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x2cca(%rip)
movsd  0x2cc2(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    140f <rlog1+0x2ff>
mov    -0x10(%rbp),%rax
movsd  0xc9c(%rip),%xmm0
addsd  (%rax),%xmm0
movsd  0xc90(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,0x2cb4(%rip)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0x2c9f(%rip),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x2c66(%rip)
movsd  0x2c5e(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rlog1>:
push   %rax
movsd  (%rdi),%xmm5
movsd  0xee3(%rip),%xmm0
ucomisd %xmm5,%xmm0
ja     1161 <rlog1+0x51>
ucomisd 0xedd(%rip),%xmm5
ja     1161 <rlog1+0x51>
movsd  0xedb(%rip),%xmm0
ucomisd %xmm5,%xmm0
jbe    118e <rlog1+0x7e>
movsd  0xefd(%rip),%xmm0
addsd  %xmm0,%xmm5
divsd  0xef9(%rip),%xmm5
mulsd  %xmm5,%xmm0
movsd  0xef5(%rip),%xmm1
subsd  %xmm0,%xmm1
jmp    11c0 <rlog1+0xb0>
movsd  0xeff(%rip),%xmm1
movapd %xmm5,%xmm0
addsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm5,(%rsp)
call   1030 <log@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret
xorpd  %xmm1,%xmm1
ucomisd 0xe7e(%rip),%xmm5
jbe    11c0 <rlog1+0xb0>
mulsd  0xe7c(%rip),%xmm5
addsd  0xe7c(%rip),%xmm5
movapd %xmm5,%xmm1
divsd  0xe78(%rip),%xmm1
addsd  0xe78(%rip),%xmm1
movsd  0xe90(%rip),%xmm0
addsd  %xmm5,%xmm0
divsd  %xmm0,%xmm5
movapd %xmm5,%xmm2
mulsd  %xmm5,%xmm2
movapd %xmm2,%xmm0
unpcklpd %xmm2,%xmm0
movapd 0xe88(%rip),%xmm3
mulpd  %xmm0,%xmm3
addpd  0xe8c(%rip),%xmm3
mulpd  %xmm0,%xmm3
addpd  0xe90(%rip),%xmm3
movapd %xmm3,%xmm0
unpckhpd %xmm3,%xmm0
divsd  %xmm0,%xmm3
addsd  %xmm2,%xmm2
movsd  0xe48(%rip),%xmm0
movapd %xmm0,%xmm4
subsd  %xmm5,%xmm4
divsd  %xmm4,%xmm0
mulsd  %xmm5,%xmm3
subsd  %xmm3,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rax
ret

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

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