#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 dgh10(void) {
  int i;
  static double g[5] = {0.3429013272237046, 1.036610829789514,
                        1.756683649299882, 2.532731674232790,
                        3.436159118837738};
  static double w[5] = {0.6108626337353258, 0.2401386110823147,
                        0.03387439445548106, 0.001343645746781233,
                        7.640432855232621e-6};
  double s;
  for (i = 0, s = 0.; i < 5; i++)
    s += (_f(g[i]) + _f(-g[i])) * w[i];
  return s;
}


x86 assembly (clang, -O0):
<dgh10>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
cmpl   $0x5,-0x4(%rbp)
jge    11b3 <dgh10+0xa3>
movslq -0x4(%rbp),%rcx
lea    0x2ef4(%rip),%rax
movsd  (%rax,%rcx,8),%xmm0
call   1030 <_f@plt>
movsd  %xmm0,-0x18(%rbp)
movslq -0x4(%rbp),%rcx
lea    0x2eda(%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    0x2ed2(%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    1127 <dgh10+0x17>
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dgh10>:
sub    $0x18,%rsp
movsd  0xee4(%rip),%xmm0
call   1030 <_f@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0xed9(%rip),%xmm0
call   1030 <_f@plt>
addsd  0x8(%rsp),%xmm0
mulsd  0xece(%rip),%xmm0
xorpd  %xmm1,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xec0(%rip),%xmm0
call   1030 <_f@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0xeb5(%rip),%xmm0
call   1030 <_f@plt>
addsd  0x10(%rsp),%xmm0
mulsd  0xeaa(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xe9e(%rip),%xmm0
call   1030 <_f@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0xe93(%rip),%xmm0
call   1030 <_f@plt>
addsd  0x10(%rsp),%xmm0
mulsd  0xe88(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xe7c(%rip),%xmm0
call   1030 <_f@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0xe71(%rip),%xmm0
call   1030 <_f@plt>
addsd  0x10(%rsp),%xmm0
mulsd  0xe66(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xe5a(%rip),%xmm0
call   1030 <_f@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0xe4f(%rip),%xmm0
call   1030 <_f@plt>
addsd  0x10(%rsp),%xmm0
mulsd  0xe44(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@dgh10.g = internal global [5 x double] [double 0x3FD5F218688B9252, double 0x3FF095F53CCA0194, double 0x3FFC1B6050729328, double 0x40044308D2F2FC3B, double 0x400B7D40FDFA1504]
@dgh10.w = internal global [5 x double] [double 0x3FE38C2FCB47BB9A, double 0x3FCEBCDCAC8D7DE8, double 0x3FA157FC10B75836, double 0x3F5603A8A28CA7A7, double 0x3EE005ED187F8CC3]
define double @dgh10() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
store double 0.000000e+00, double* %2
br label %3
3: ; preds = %25, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 5
br i1 %5, label %6, label %28
6: ; preds = %3
%7 = load i32, i32* %1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [5 x double], [5 x double]* @dgh10.g, i64 0, i64 %8
%10 = load double, double* %9
%11 = call double @_f(double %10)
%12 = load i32, i32* %1
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [5 x double], [5 x double]* @dgh10.g, i64 0, i64 %13
%15 = load double, double* %14
%16 = fneg double %15
%17 = call double @_f(double %16)
%18 = fadd double %11, %17
%19 = load i32, i32* %1
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [5 x double], [5 x double]* @dgh10.w, i64 0, i64 %20
%22 = load double, double* %21
%23 = load double, double* %2
%24 = call double @llvm.fmuladd.f64(double %18, double %22, double %23)
store double %24, double* %2
br label %25
25: ; preds = %6
%26 = load i32, i32* %1
%27 = add nsw i32 %26, 1
store i32 %27, i32* %1
br label %3
28: ; preds = %3
%29 = load double, double* %2
ret double %29
}

LLVM IR (-O2):
define double @dgh10() {
%1 = tail call double @_f(double 0x3FD5F218688B9252)
%2 = tail call double @_f(double 0xBFD5F218688B9252)
%3 = fadd double %1, %2
%4 = tail call double @llvm.fmuladd.f64(double %3, double 0x3FE38C2FCB47BB9A, double 0.000000e+00)
%5 = tail call double @_f(double 0x3FF095F53CCA0194)
%6 = tail call double @_f(double 0xBFF095F53CCA0194)
%7 = fadd double %5, %6
%8 = tail call double @llvm.fmuladd.f64(double %7, double 0x3FCEBCDCAC8D7DE8, double %4)
%9 = tail call double @_f(double 0x3FFC1B6050729328)
%10 = tail call double @_f(double 0xBFFC1B6050729328)
%11 = fadd double %9, %10
%12 = tail call double @llvm.fmuladd.f64(double %11, double 0x3FA157FC10B75836, double %8)
%13 = tail call double @_f(double 0x40044308D2F2FC3B)
%14 = tail call double @_f(double 0xC0044308D2F2FC3B)
%15 = fadd double %13, %14
%16 = tail call double @llvm.fmuladd.f64(double %15, double 0x3F5603A8A28CA7A7, double %12)
%17 = tail call double @_f(double 0x400B7D40FDFA1504)
%18 = tail call double @_f(double 0xC00B7D40FDFA1504)
%19 = fadd double %17, %18
%20 = tail call double @llvm.fmuladd.f64(double %19, double 0x3EE005ED187F8CC3, double %16)
ret double %20
}