#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 M_PI;
double acos(int);
int /*<<< orphan*/ assert(int);
double const cos(double);
double fabs(double const);
int sqrt(int);
double CalculateSum12NNNEllipsoid(const double d12, const double d34,
                                  const double eta) {
  const double t = eta * (cos(6.283185307179586476925 * d12) +
                          cos(6.283185307179586476925 * d34));
  assert(fabs(t) >= 0.5);
  return acos(-(sqrt(1 + 32 * t * t) + 1) / (8 * t)) / M_PI;
}


x86 assembly (clang, -O0):
<CalculateSum12NNNEllipsoid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xeb7(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  0xea0(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
call   1050 <cos@plt>
movsd  -0x30(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x28(%rbp),%xmm0
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movaps 0xe80(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xe5c(%rip),%xmm1
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  0xe3b(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe1d(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <sqrt@plt>
mov    %eax,%ecx
add    $0x1,%ecx
xor    %eax,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  0xdf3(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <acos@plt>
mov    0x2dc2(%rip),%rax
divsd  (%rax),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CalculateSum12NNNEllipsoid>:
sub    $0x28,%rsp
movsd  %xmm2,(%rsp)
movsd  %xmm1,0x20(%rsp)
mulsd  0xea9(%rip),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x20(%rsp),%xmm0
mulsd  0xe90(%rip),%xmm0
call   1050 <cos@plt>
addsd  0x18(%rsp),%xmm0
mulsd  (%rsp),%xmm0
movapd %xmm0,(%rsp)
movapd 0xea3(%rip),%xmm1
andpd  %xmm0,%xmm1
xor    %edi,%edi
ucomisd 0xe6d(%rip),%xmm1
setae  %dil
call   1040 <assert@plt>
movsd  0xe64(%rip),%xmm0
movapd (%rsp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
addsd  0xe57(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1060 <sqrt@plt>
not    %eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movapd (%rsp),%xmm1
mulsd  0xe40(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <acos@plt>
mov    0x2df4(%rip),%rax
divsd  (%rax),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @CalculateSum12NNNEllipsoid(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%8 = load double, double* %6
%9 = load double, double* %4
%10 = fmul double 0x401921FB54442D18, %9
%11 = call double @cos(double %10)
%12 = load double, double* %5
%13 = fmul double 0x401921FB54442D18, %12
%14 = call double @cos(double %13)
%15 = fadd double %11, %14
%16 = fmul double %8, %15
store double %16, double* %7
%17 = load double, double* %7
%18 = call double @llvm.fabs.f64(double %17)
%19 = fcmp oge double %18, 5.000000e-01
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = load double, double* %7
%23 = fmul double 3.200000e+01, %22
%24 = load double, double* %7
%25 = call double @llvm.fmuladd.f64(double %23, double %24, double 1.000000e+00)
%26 = fptosi double %25 to i32
%27 = call i32 @sqrt(i32 %26)
%28 = add nsw i32 %27, 1
%29 = sub nsw i32 0, %28
%30 = sitofp i32 %29 to double
%31 = load double, double* %7
%32 = fmul double 8.000000e+00, %31
%33 = fdiv double %30, %32
%34 = fptosi double %33 to i32
%35 = call double @acos(i32 %34)
%36 = load double, double* @M_PI
%37 = fdiv double %35, %36
ret double %37
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @CalculateSum12NNNEllipsoid(double %0, double %1, double %2) {
%4 = fmul double %0, 0x401921FB54442D18
%5 = tail call double @cos(double %4)
%6 = fmul double %1, 0x401921FB54442D18
%7 = tail call double @cos(double %6)
%8 = fadd double %5, %7
%9 = fmul double %8, %2
%10 = tail call double @llvm.fabs.f64(double %9)
%11 = fcmp oge double %10, 5.000000e-01
%12 = zext i1 %11 to i32
%13 = tail call i32 @assert(i32 %12)
%14 = fmul double %9, 3.200000e+01
%15 = tail call double @llvm.fmuladd.f64(double %14, double %9, double 1.000000e+00)
%16 = fptosi double %15 to i32
%17 = tail call i32 @sqrt(i32 %16)
%18 = xor i32 %17, -1
%19 = sitofp i32 %18 to double
%20 = fmul double %9, 8.000000e+00
%21 = fdiv double %19, %20
%22 = fptosi double %21 to i32
%23 = tail call double @acos(i32 %22)
%24 = load double, double* @M_PI
%25 = fdiv double %23, %24
ret double %25
}