#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 dilog(int);
int log(double);
double rhoexact(double x) {
  do {
  } while (0);
  if (x <= 0.)
    return 0.;
  if (x <= 1.)
    return 1.;
  if (x <= 2.)
    return 1. - log(x);
  if (x <= 3.)
    return 1. - log(x) * (1. - log(x - 1.)) + dilog(1. - x) +
           0.5 * 1.644934066848226436;
  return 0.;
}


x86 assembly (clang, -O0):
<rhoexact>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
jmp    1132 <rhoexact+0x12>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     114d <rhoexact+0x2d>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1267 <rhoexact+0x147>
movsd  0xeab(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     1172 <rhoexact+0x52>
movsd  0xe98(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1267 <rhoexact+0x147>
movsd  0xe8e(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     11a9 <rhoexact+0x89>
movsd  -0x10(%rbp),%xmm0
call   1040 <log@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe65(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1267 <rhoexact+0x147>
movsd  0xe5f(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     125f <rhoexact+0x13f>
movsd  -0x10(%rbp),%xmm0
call   1040 <log@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe24(%rip),%xmm1
subsd  %xmm1,%xmm0
call   1040 <log@plt>
movsd  -0x20(%rbp),%xmm0
cvtsi2sd %eax,%xmm2
movsd  0xe0a(%rip),%xmm1
subsd  %xmm2,%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xde3(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xdd2(%rip),%xmm0
subsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <dilog@plt>
movsd  -0x18(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
addsd  %xmm1,%xmm0
movsd  0xdc7(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1267 <rhoexact+0x147>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rhoexact>:
sub    $0x18,%rsp
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jae    11ea <rhoexact+0xca>
movsd  0xec2(%rip),%xmm0
ucomisd %xmm1,%xmm0
jae    11ea <rhoexact+0xca>
movsd  0xeb8(%rip),%xmm0
ucomisd %xmm1,%xmm0
jae    11ef <rhoexact+0xcf>
movsd  0xeae(%rip),%xmm0
ucomisd %xmm1,%xmm0
xorpd  %xmm0,%xmm0
jb     11ea <rhoexact+0xca>
movapd %xmm1,%xmm0
movsd  %xmm1,0x10(%rsp)
call   1040 <log@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xe88(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
call   1040 <log@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0xe56(%rip),%xmm1
movapd %xmm1,%xmm2
subsd  %xmm0,%xmm2
mulsd  0x8(%rsp),%xmm2
movapd %xmm1,%xmm0
subsd  %xmm2,%xmm0
movsd  %xmm0,0x8(%rsp)
subsd  0x10(%rsp),%xmm1
cvttsd2si %xmm1,%edi
call   1030 <dilog@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0x8(%rsp),%xmm0
addsd  0xe36(%rip),%xmm0
add    $0x18,%rsp
ret
movapd %xmm1,%xmm0
call   1040 <log@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  0xdf9(%rip),%xmm0
subsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @rhoexact(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
br label %4
4: ; preds = %1
br label %5
5: ; preds = %4
%6 = load double, double* %3
%7 = fcmp ole double %6, 0.000000e+00
br i1 %7, label %8, label %9
8: ; preds = %5
store double 0.000000e+00, double* %2
br label %43
9: ; preds = %5
%10 = load double, double* %3
%11 = fcmp ole double %10, 1.000000e+00
br i1 %11, label %12, label %13
12: ; preds = %9
store double 1.000000e+00, double* %2
br label %43
13: ; preds = %9
%14 = load double, double* %3
%15 = fcmp ole double %14, 2.000000e+00
br i1 %15, label %16, label %21
16: ; preds = %13
%17 = load double, double* %3
%18 = call i32 @log(double %17)
%19 = sitofp i32 %18 to double
%20 = fsub double 1.000000e+00, %19
store double %20, double* %2
br label %43
21: ; preds = %13
%22 = load double, double* %3
%23 = fcmp ole double %22, 3.000000e+00
br i1 %23, label %24, label %42
24: ; preds = %21
%25 = load double, double* %3
%26 = call i32 @log(double %25)
%27 = sitofp i32 %26 to double
%28 = load double, double* %3
%29 = fsub double %28, 1.000000e+00
%30 = call i32 @log(double %29)
%31 = sitofp i32 %30 to double
%32 = fsub double 1.000000e+00, %31
%33 = fneg double %27
%34 = call double @llvm.fmuladd.f64(double %33, double %32, double 1.000000e+00)
%35 = load double, double* %3
%36 = fsub double 1.000000e+00, %35
%37 = fptosi double %36 to i32
%38 = call i32 @dilog(i32 %37)
%39 = sitofp i32 %38 to double
%40 = fadd double %34, %39
%41 = fadd double %40, 0x3FEA51A6625307D3
store double %41, double* %2
br label %43
42: ; preds = %21
store double 0.000000e+00, double* %2
br label %43
43: ; preds = %42, %24, %16, %12, %8
%44 = load double, double* %2
ret double %44
}

LLVM IR (-O2):
define double @rhoexact(double %0) {
%2 = fcmp ugt double %0, 0.000000e+00
br i1 %2, label %3, label %28
3: ; preds = %1
%4 = fcmp ugt double %0, 1.000000e+00
br i1 %4, label %5, label %28
5: ; preds = %3
%6 = fcmp ugt double %0, 2.000000e+00
br i1 %6, label %11, label %7
7: ; preds = %5
%8 = tail call i32 @log(double %0)
%9 = sitofp i32 %8 to double
%10 = fsub double 1.000000e+00, %9
br label %28
11: ; preds = %5
%12 = fcmp ugt double %0, 3.000000e+00
br i1 %12, label %28, label %13
13: ; preds = %11
%14 = tail call i32 @log(double %0)
%15 = sitofp i32 %14 to double
%16 = fadd double %0, -1.000000e+00
%17 = tail call i32 @log(double %16)
%18 = sitofp i32 %17 to double
%19 = fsub double 1.000000e+00, %18
%20 = fneg double %15
%21 = tail call double @llvm.fmuladd.f64(double %20, double %19, double 1.000000e+00)
%22 = fsub double 1.000000e+00, %0
%23 = fptosi double %22 to i32
%24 = tail call i32 @dilog(i32 %23)
%25 = sitofp i32 %24 to double
%26 = fadd double %21, %25
%27 = fadd double %26, 0x3FEA51A6625307D3
br label %28
28: ; preds = %11, %3, %1, %13, %7
%29 = phi double [ %10, %7 ], [ %27, %13 ], [ 0.000000e+00, %1 ], [ 1.000000e+00, %3 ], [ 0.000000e+00, %11 ]
ret double %29
}