#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 dglg5(void) {
  int i;
  static double g[5] = {12.64080084427578, 7.085810005858838, 3.596425771040722,
                        1.41340305910651679, 0.2635603197181409};
  static double w[5] = {0.0000233699723857762, 0.00361175867992205,
                        0.0759424496817060, 0.398666811083176,
                        0.521755610582809};
  double s;
  for (i = 0, s = 0.; i < 5; i++)
    s += _f(g[i]) * w[i];
  return s;
}


x86 assembly (clang, -O0):
<dglg5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
cmpl   $0x5,-0x4(%rbp)
jge    1176 <dglg5+0x66>
movslq -0x4(%rbp),%rcx
lea    0x2ef4(%rip),%rax
movsd  (%rax,%rcx,8),%xmm0
call   1030 <_f@plt>
movslq -0x4(%rbp),%rcx
lea    0x2f0f(%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 <dglg5+0x17>
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dglg5>:
push   %rax
movsd  0xee7(%rip),%xmm0
call   1030 <_f@plt>
mulsd  0xee2(%rip),%xmm0
xorpd  %xmm1,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
movsd  0xed5(%rip),%xmm0
call   1030 <_f@plt>
mulsd  0xed0(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xec6(%rip),%xmm0
call   1030 <_f@plt>
mulsd  0xec1(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xeb7(%rip),%xmm0
call   1030 <_f@plt>
mulsd  0xeb2(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xea8(%rip),%xmm0
call   1030 <_f@plt>
mulsd  0xea3(%rip),%xmm0
addsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@dglg5.g = internal global [5 x double] [double 0x402948170C5AD3CC, double 0x401C57DE94035547, double 0x400CC57ADFE8E452, double 0x3FF69D4C86AEDC8C, double 0x3FD0DE2C1A6D9D31]
@dglg5.w = internal global [5 x double] [double 0x3EF8815446103D90, double 0x3F6D96682D297233, double 0x3FB370F6E1C2D45D, double 0x3FD983C1CCE6951D, double 0x3FE0B238D27EA548]
define double @dglg5() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
store double 0.000000e+00, double* %2
br label %3
3: ; preds = %18, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 5
br i1 %5, label %6, label %21
6: ; preds = %3
%7 = load i32, i32* %1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [5 x double], [5 x double]* @dglg5.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]* @dglg5.w, i64 0, i64 %13
%15 = load double, double* %14
%16 = load double, double* %2
%17 = call double @llvm.fmuladd.f64(double %11, double %15, double %16)
store double %17, double* %2
br label %18
18: ; preds = %6
%19 = load i32, i32* %1
%20 = add nsw i32 %19, 1
store i32 %20, i32* %1
br label %3
21: ; preds = %3
%22 = load double, double* %2
ret double %22
}

LLVM IR (-O2):
define double @dglg5() {
%1 = tail call double @_f(double 0x402948170C5AD3CC)
%2 = tail call double @llvm.fmuladd.f64(double %1, double 0x3EF8815446103D90, double 0.000000e+00)
%3 = tail call double @_f(double 0x401C57DE94035547)
%4 = tail call double @llvm.fmuladd.f64(double %3, double 0x3F6D96682D297233, double %2)
%5 = tail call double @_f(double 0x400CC57ADFE8E452)
%6 = tail call double @llvm.fmuladd.f64(double %5, double 0x3FB370F6E1C2D45D, double %4)
%7 = tail call double @_f(double 0x3FF69D4C86AEDC8C)
%8 = tail call double @llvm.fmuladd.f64(double %7, double 0x3FD983C1CCE6951D, double %6)
%9 = tail call double @_f(double 0x3FD0DE2C1A6D9D31)
%10 = tail call double @llvm.fmuladd.f64(double %9, double 0x3FE0B238D27EA548, double %8)
ret double %10
}