#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 _f(double);
double dgh15(void) {
  int i;
  static double g[8] = {0.0,
                        0.56506958325557575,
                        1.136115585210921,
                        1.719992575186489,
                        2.325732486173858,
                        2.967166927905603,
                        3.669950373404453,
                        4.499990707309392};
  static double w[8] = {0.5641003087264175,   0.4120286874988986,
                        0.1584889157959357,   0.03078003387254608,
                        0.002778068842912276, 0.0001000044412324999,
                        1.059115547711067e-6, 1.522475804253517e-9};
  double s;
  s = _f(g[0]) * w[0];
  for (i = 1; i < 8; i++)
    s += (_f(g[i]) + _f(-g[i])) * w[i];
  return s;
}


x86 assembly (clang, -O0):
<dgh15>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  0x2f10(%rip),%xmm0
call   1030 <_f@plt>
mulsd  0x2f43(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movl   $0x1,-0x4(%rbp)
cmpl   $0x8,-0x4(%rbp)
jge    11c5 <dgh15+0xb5>
movslq -0x4(%rbp),%rcx
lea    0x2ee2(%rip),%rax
movsd  (%rax,%rcx,8),%xmm0
call   1030 <_f@plt>
movsd  %xmm0,-0x18(%rbp)
movslq -0x4(%rbp),%rcx
lea    0x2ec8(%rip),%rax
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <_f@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
addsd  %xmm1,%xmm0
movslq -0x4(%rbp),%rcx
lea    0x2ed0(%rip),%rax
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1139 <dgh15+0x29>
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dgh15>:
sub    $0x18,%rsp
xorpd  %xmm0,%xmm0
call   1030 <_f@plt>
mulsd  0xedb(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0xed5(%rip),%xmm0
call   1030 <_f@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0xeca(%rip),%xmm0
call   1030 <_f@plt>
addsd  0x8(%rsp),%xmm0
mulsd  0xebf(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0xeb3(%rip),%xmm0
call   1030 <_f@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0xea8(%rip),%xmm0
call   1030 <_f@plt>
addsd  0x8(%rsp),%xmm0
mulsd  0xe9d(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0xe91(%rip),%xmm0
call   1030 <_f@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0xe86(%rip),%xmm0
call   1030 <_f@plt>
addsd  0x8(%rsp),%xmm0
mulsd  0xe7b(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0xe6f(%rip),%xmm0
call   1030 <_f@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0xe64(%rip),%xmm0
call   1030 <_f@plt>
addsd  0x8(%rsp),%xmm0
mulsd  0xe59(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0xe4d(%rip),%xmm0
call   1030 <_f@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0xe42(%rip),%xmm0
call   1030 <_f@plt>
addsd  0x8(%rsp),%xmm0
mulsd  0xe37(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0xe2b(%rip),%xmm0
call   1030 <_f@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0xe20(%rip),%xmm0
call   1030 <_f@plt>
addsd  0x8(%rsp),%xmm0
mulsd  0xe15(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0xe09(%rip),%xmm0
call   1030 <_f@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0xdfe(%rip),%xmm0
call   1030 <_f@plt>
addsd  0x8(%rsp),%xmm0
mulsd  0xdf3(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@dgh15.g = internal global [8 x double] [double 0.000000e+00, double 0x3FE2150CCE818169, double 0x3FF22D87892F4F15, double 0x3FFB8516EF3C9EE4, double 0x40029B19A23AE456, double 0x4007BCC203A904D3, double 0x400D5C0EF0FDB88E, double 0x4011FFFD9060CA7E]
@dgh15.w = internal global [8 x double] [double 0x3FE20D1C17349747, double 0x3FDA5EAD927494A9, double 0x3FC4495D630F9F0F, double 0x3F9F84CD1B68D071, double 0x3F66C2085A716A9F, double 0x3F1A372F37DB8533, double 0x3EB1C4DDDC2038C5, double 0x3E1A27EB5DBDEB43]
define double @dgh15() {
%1 = alloca i32
%2 = alloca double
%3 = load double, double* getelementptr inbounds ([8 x double], [8 x double]* @dgh15.g, i64 0, i64 0)
%4 = call double @_f(double %3)
%5 = load double, double* getelementptr inbounds ([8 x double], [8 x double]* @dgh15.w, i64 0, i64 0)
%6 = fmul double %4, %5
store double %6, double* %2
store i32 1, i32* %1
br label %7
7: ; preds = %29, %0
%8 = load i32, i32* %1
%9 = icmp slt i32 %8, 8
br i1 %9, label %10, label %32
10: ; preds = %7
%11 = load i32, i32* %1
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [8 x double], [8 x double]* @dgh15.g, i64 0, i64 %12
%14 = load double, double* %13
%15 = call double @_f(double %14)
%16 = load i32, i32* %1
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [8 x double], [8 x double]* @dgh15.g, i64 0, i64 %17
%19 = load double, double* %18
%20 = fneg double %19
%21 = call double @_f(double %20)
%22 = fadd double %15, %21
%23 = load i32, i32* %1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [8 x double], [8 x double]* @dgh15.w, i64 0, i64 %24
%26 = load double, double* %25
%27 = load double, double* %2
%28 = call double @llvm.fmuladd.f64(double %22, double %26, double %27)
store double %28, double* %2
br label %29
29: ; preds = %10
%30 = load i32, i32* %1
%31 = add nsw i32 %30, 1
store i32 %31, i32* %1
br label %7
32: ; preds = %7
%33 = load double, double* %2
ret double %33
}

LLVM IR (-O2):
define double @dgh15() {
%1 = tail call double @_f(double 0.000000e+00)
%2 = fmul double %1, 0x3FE20D1C17349747
%3 = tail call double @_f(double 0x3FE2150CCE818169)
%4 = tail call double @_f(double 0xBFE2150CCE818169)
%5 = fadd double %3, %4
%6 = tail call double @llvm.fmuladd.f64(double %5, double 0x3FDA5EAD927494A9, double %2)
%7 = tail call double @_f(double 0x3FF22D87892F4F15)
%8 = tail call double @_f(double 0xBFF22D87892F4F15)
%9 = fadd double %7, %8
%10 = tail call double @llvm.fmuladd.f64(double %9, double 0x3FC4495D630F9F0F, double %6)
%11 = tail call double @_f(double 0x3FFB8516EF3C9EE4)
%12 = tail call double @_f(double 0xBFFB8516EF3C9EE4)
%13 = fadd double %11, %12
%14 = tail call double @llvm.fmuladd.f64(double %13, double 0x3F9F84CD1B68D071, double %10)
%15 = tail call double @_f(double 0x40029B19A23AE456)
%16 = tail call double @_f(double 0xC0029B19A23AE456)
%17 = fadd double %15, %16
%18 = tail call double @llvm.fmuladd.f64(double %17, double 0x3F66C2085A716A9F, double %14)
%19 = tail call double @_f(double 0x4007BCC203A904D3)
%20 = tail call double @_f(double 0xC007BCC203A904D3)
%21 = fadd double %19, %20
%22 = tail call double @llvm.fmuladd.f64(double %21, double 0x3F1A372F37DB8533, double %18)
%23 = tail call double @_f(double 0x400D5C0EF0FDB88E)
%24 = tail call double @_f(double 0xC00D5C0EF0FDB88E)
%25 = fadd double %23, %24
%26 = tail call double @llvm.fmuladd.f64(double %25, double 0x3EB1C4DDDC2038C5, double %22)
%27 = tail call double @_f(double 0x4011FFFD9060CA7E)
%28 = tail call double @_f(double 0xC011FFFD9060CA7E)
%29 = fadd double %27, %28
%30 = tail call double @llvm.fmuladd.f64(double %29, double 0x3E1A27EB5DBDEB43, double %26)
ret double %30
}