#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 M_PI;
int sin(int);
double dEnergyDifferenceNNNGamma2(const double k1, const double k2,
                                  const double eta) {
  return 6.283185307179586476925 *
         (sin(6.283185307179586476925 * k2) -
          sin(6.283185307179586476925 * k1) +
          2 * eta * (sin(4 * M_PI * k2) - sin(4 * M_PI * k1)));
}


x86 assembly (clang, -O0):
<dEnergyDifferenceNNNGamma2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  0xed1(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
mov    %eax,-0x34(%rbp)
movsd  0xeb8(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe9a(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    0x2e69(%rip),%rax
mov    (%rax),%eax
shl    $0x2,%eax
cvtsi2sd %eax,%xmm0
mulsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2e48(%rip),%rax
mov    (%rax),%eax
shl    $0x2,%eax
cvtsi2sd %eax,%xmm0
mulsd  -0x8(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
movsd  -0x30(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe24(%rip),%xmm0
mulsd  %xmm1,%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dEnergyDifferenceNNNGamma2>:
push   %rbx
sub    $0x20,%rsp
movsd  %xmm2,(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
movapd %xmm1,%xmm0
mulsd  0xece(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
mulsd  0xeb5(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
sub    %eax,%ebx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  %xmm0,0x18(%rsp)
mov    0x2e7e(%rip),%rbx
mov    (%rbx),%eax
shl    $0x2,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm1,%xmm1
movsd  %xmm1,(%rsp)
mulsd  0x10(%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
mov    (%rbx),%ecx
shl    $0x2,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
mov    %eax,%ebx
mulsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
sub    %eax,%ebx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
mulsd  (%rsp),%xmm0
addsd  0x18(%rsp),%xmm0
mulsd  0xe34(%rip),%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@M_PI = global i32 0
define double @dEnergyDifferenceNNNGamma2(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %5
%8 = fmul double 0x401921FB54442D18, %7
%9 = fptosi double %8 to i32
%10 = call i32 @sin(i32 %9)
%11 = load double, double* %4
%12 = fmul double 0x401921FB54442D18, %11
%13 = fptosi double %12 to i32
%14 = call i32 @sin(i32 %13)
%15 = sub nsw i32 %10, %14
%16 = sitofp i32 %15 to double
%17 = load double, double* %6
%18 = fmul double 2.000000e+00, %17
%19 = load i32, i32* @M_PI
%20 = mul nsw i32 4, %19
%21 = sitofp i32 %20 to double
%22 = load double, double* %5
%23 = fmul double %21, %22
%24 = fptosi double %23 to i32
%25 = call i32 @sin(i32 %24)
%26 = load i32, i32* @M_PI
%27 = mul nsw i32 4, %26
%28 = sitofp i32 %27 to double
%29 = load double, double* %4
%30 = fmul double %28, %29
%31 = fptosi double %30 to i32
%32 = call i32 @sin(i32 %31)
%33 = sub nsw i32 %25, %32
%34 = sitofp i32 %33 to double
%35 = call double @llvm.fmuladd.f64(double %18, double %34, double %16)
%36 = fmul double 0x401921FB54442D18, %35
ret double %36
}

LLVM IR (-O2):
@M_PI = global i32 0
define double @dEnergyDifferenceNNNGamma2(double %0, double %1, double %2) {
%4 = fmul double %1, 0x401921FB54442D18
%5 = fptosi double %4 to i32
%6 = tail call i32 @sin(i32 %5)
%7 = fmul double %0, 0x401921FB54442D18
%8 = fptosi double %7 to i32
%9 = tail call i32 @sin(i32 %8)
%10 = sub nsw i32 %6, %9
%11 = sitofp i32 %10 to double
%12 = fmul double %2, 2.000000e+00
%13 = load i32, i32* @M_PI
%14 = shl nsw i32 %13, 2
%15 = sitofp i32 %14 to double
%16 = fmul double %15, %1
%17 = fptosi double %16 to i32
%18 = tail call i32 @sin(i32 %17)
%19 = load i32, i32* @M_PI
%20 = shl nsw i32 %19, 2
%21 = sitofp i32 %20 to double
%22 = fmul double %21, %0
%23 = fptosi double %22 to i32
%24 = tail call i32 @sin(i32 %23)
%25 = sub nsw i32 %18, %24
%26 = sitofp i32 %25 to double
%27 = tail call double @llvm.fmuladd.f64(double %12, double %26, double %11)
%28 = fmul double %27, 0x401921FB54442D18
ret double %28
}