#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 exp(double);
int fabs(double);
double log(double);
double _calcPhi_3(double theta) {
  double phi_3;
  double a_n, step1, step2, n, riemann_zeta_4, I_m;
  step1 = 1.0;
  step2 = 0.0;
  n = 1.0;
  a_n = 0.0;
  while (fabs(step1 - step2) > 1E-6) {
    step1 = step2;
    step2 = 1.0 / (exp(n / theta) * n * n) *
            (0.5 + theta / n + theta * theta / n / n);
    a_n += step2;
    n = n + 1.0;
  }
  riemann_zeta_4 = 3.14159265358979323846 * 3.14159265358979323846 *
                   3.14159265358979323846 * 3.14159265358979323846 / 90.0;
  I_m = theta * log(1.0 - exp(-1.0 / theta)) +
        6.0 * theta * theta * (riemann_zeta_4 * theta * theta - a_n);
  phi_3 = 0.25 + 2.0 * I_m;
  return phi_3;
}


x86 assembly (clang, -O0):
<_calcPhi_3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xebb(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xea6(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm0
movsd  0xe86(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    121b <_calcPhi_3+0xeb>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x30(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm1
mulsd  -0x30(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
movsd  0xe46(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm2
divsd  -0x30(%rbp),%xmm2
movsd  0xe60(%rip),%xmm1
addsd  %xmm2,%xmm1
movsd  -0x8(%rbp),%xmm2
mulsd  -0x8(%rbp),%xmm2
divsd  -0x30(%rbp),%xmm2
divsd  -0x30(%rbp),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xdf4(%rip),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1167 <_calcPhi_3+0x37>
movsd  0xe05(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xde6(%rip),%xmm0
divsd  -0x8(%rbp),%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xdb1(%rip),%xmm0
subsd  %xmm1,%xmm0
call   1050 <log@plt>
movaps %xmm0,%xmm2
movsd  -0x48(%rbp),%xmm0
movsd  0xdb0(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm3
mulsd  -0x8(%rbp),%xmm3
movsd  -0x8(%rbp),%xmm5
movsd  -0x18(%rbp),%xmm4
movq   %xmm4,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm4
mulsd  %xmm5,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xd49(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_calcPhi_3>:
sub    $0x48,%rsp
movsd  %xmm0,(%rsp)
movsd  0xebf(%rip),%xmm0
call   1030 <fabs@plt>
test   %eax,%eax
jle    1226 <_calcPhi_3+0xf6>
movsd  (%rsp),%xmm1
movapd %xmm1,%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x20(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xe8d(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
xorps  %xmm0,%xmm0
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,0x28(%rsp)
movapd 0x10(%rsp),%xmm0
divsd  %xmm1,%xmm0
call   1040 <exp@plt>
movapd 0x10(%rsp),%xmm3
mulsd  %xmm3,%xmm0
mulsd  %xmm3,%xmm0
movsd  (%rsp),%xmm1
divsd  %xmm3,%xmm1
addsd  0xe54(%rip),%xmm1
movsd  0x20(%rsp),%xmm4
divsd  %xmm3,%xmm4
shufpd $0x2,0xe69(%rip),%xmm4
movapd %xmm3,%xmm2
unpcklpd %xmm0,%xmm2
divpd  %xmm2,%xmm4
addsd  %xmm4,%xmm1
unpckhpd %xmm4,%xmm4
mulsd  %xmm1,%xmm4
movapd %xmm4,0x30(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  %xmm4,%xmm0
movsd  %xmm0,0x8(%rsp)
addsd  0xe03(%rip),%xmm3
movapd %xmm3,0x10(%rsp)
movsd  0x28(%rsp),%xmm0
subsd  %xmm4,%xmm0
call   1030 <fabs@plt>
movsd  (%rsp),%xmm1
movaps 0x30(%rsp),%xmm0
test   %eax,%eax
jg     1180 <_calcPhi_3+0x50>
jmp    1234 <_calcPhi_3+0x104>
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm1
movsd  0xdd4(%rip),%xmm0
divsd  %xmm1,%xmm0
call   1040 <exp@plt>
movsd  0xdb3(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1050 <log@plt>
movsd  0xdb6(%rip),%xmm1
movsd  (%rsp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm3,%xmm1
movsd  0xda9(%rip),%xmm2
mulsd  %xmm3,%xmm2
mulsd  %xmm3,%xmm2
subsd  0x8(%rsp),%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
addsd  %xmm0,%xmm0
addsd  0xd8b(%rip),%xmm0
add    $0x48,%rsp
ret

LLVM IR (-O0):
define double @_calcPhi_3(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %2
store double 1.000000e+00, double* %5
store double 0.000000e+00, double* %6
store double 1.000000e+00, double* %7
store double 0.000000e+00, double* %4
br label %10
10: ; preds = %17, %1
%11 = load double, double* %5
%12 = load double, double* %6
%13 = fsub double %11, %12
%14 = call i32 @fabs(double %13)
%15 = sitofp i32 %14 to double
%16 = fcmp ogt double %15, 0x3EB0C6F7A0B5ED8D
br i1 %16, label %17, label %46
17: ; preds = %10
%18 = load double, double* %6
store double %18, double* %5
%19 = load double, double* %7
%20 = load double, double* %2
%21 = fdiv double %19, %20
%22 = call double @exp(double %21)
%23 = load double, double* %7
%24 = fmul double %22, %23
%25 = load double, double* %7
%26 = fmul double %24, %25
%27 = fdiv double 1.000000e+00, %26
%28 = load double, double* %2
%29 = load double, double* %7
%30 = fdiv double %28, %29
%31 = fadd double 5.000000e-01, %30
%32 = load double, double* %2
%33 = load double, double* %2
%34 = fmul double %32, %33
%35 = load double, double* %7
%36 = fdiv double %34, %35
%37 = load double, double* %7
%38 = fdiv double %36, %37
%39 = fadd double %31, %38
%40 = fmul double %27, %39
store double %40, double* %6
%41 = load double, double* %6
%42 = load double, double* %4
%43 = fadd double %42, %41
store double %43, double* %4
%44 = load double, double* %7
%45 = fadd double %44, 1.000000e+00
store double %45, double* %7
br label %10
46: ; preds = %10
store double 0x3FF151322AC7D847, double* %8
%47 = load double, double* %2
%48 = load double, double* %2
%49 = fdiv double -1.000000e+00, %48
%50 = call double @exp(double %49)
%51 = fsub double 1.000000e+00, %50
%52 = call double @log(double %51)
%53 = load double, double* %2
%54 = fmul double 6.000000e+00, %53
%55 = load double, double* %2
%56 = fmul double %54, %55
%57 = load double, double* %8
%58 = load double, double* %2
%59 = fmul double %57, %58
%60 = load double, double* %2
%61 = load double, double* %4
%62 = fneg double %61
%63 = call double @llvm.fmuladd.f64(double %59, double %60, double %62)
%64 = fmul double %56, %63
%65 = call double @llvm.fmuladd.f64(double %47, double %52, double %64)
store double %65, double* %9
%66 = load double, double* %9
%67 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %66, double 2.500000e-01)
store double %67, double* %3
%68 = load double, double* %3
ret double %68
}

LLVM IR (-O2):
define double @_calcPhi_3(double %0) {
%2 = tail call i32 @fabs(double 1.000000e+00)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %30
4: ; preds = %1
%5 = fmul double %0, %0
br label %6
6: ; preds = %4, %6
%7 = phi double [ 0.000000e+00, %4 ], [ %25, %6 ]
%8 = phi double [ 1.000000e+00, %4 ], [ %26, %6 ]
%9 = phi double [ 0.000000e+00, %4 ], [ %24, %6 ]
%10 = fdiv double %8, %0
%11 = tail call double @exp(double %10)
%12 = fmul double %8, %11
%13 = fmul double %8, %12
%14 = fdiv double %0, %8
%15 = fadd double %14, 5.000000e-01
%16 = fdiv double %5, %8
%17 = insertelement <2 x double> <double poison, double 1.000000e+00>, double %16, i64 0
%18 = insertelement <2 x double> poison, double %8, i64 0
%19 = insertelement <2 x double> %18, double %13, i64 1
%20 = fdiv <2 x double> %17, %19
%21 = extractelement <2 x double> %20, i64 0
%22 = fadd double %15, %21
%23 = extractelement <2 x double> %20, i64 1
%24 = fmul double %22, %23
%25 = fadd double %7, %24
%26 = fadd double %8, 1.000000e+00
%27 = fsub double %9, %24
%28 = tail call i32 @fabs(double %27)
%29 = icmp sgt i32 %28, 0
br i1 %29, label %6, label %30
30: ; preds = %6, %1
%31 = phi double [ 0.000000e+00, %1 ], [ %25, %6 ]
%32 = fdiv double -1.000000e+00, %0
%33 = tail call double @exp(double %32)
%34 = fsub double 1.000000e+00, %33
%35 = tail call double @log(double %34)
%36 = fmul double %0, 6.000000e+00
%37 = fmul double %36, %0
%38 = fmul double %0, 0x3FF151322AC7D847
%39 = fneg double %31
%40 = tail call double @llvm.fmuladd.f64(double %38, double %0, double %39)
%41 = fmul double %37, %40
%42 = tail call double @llvm.fmuladd.f64(double %0, double %35, double %41)
%43 = tail call double @llvm.fmuladd.f64(double %42, double 2.000000e+00, double 2.500000e-01)
ret double %43
}