#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 dglg10(void) {
  int i;
  static double g[10] = {29.92069701227389,  21.99658581198076,
                         16.27925783137810,  11.84378583790007,
                         8.330152746764497,  5.552496140063804,
                         3.401433697854900,  1.808342901740316,
                         0.7294545495031705, 0.1377934705404924};
  static double w[10] = {9.9118272196090e-13,  1.839564823979631e-9,
                         4.249313984962686e-7, 2.8259233495995656e-5,
                         7.530083885875388e-4, 9.5015169751811006e-3,
                         6.208745609867775e-2, 2.1806828761180942e-1,
                         4.011199291552736e-1, 3.0844111576502014e-1};
  double s;
  for (i = 0, s = 0.; i < 10; i++)
    s += _f(g[i]) * w[i];
  return s;
}


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

x86 assembly (clang, -O2):
<dglg10>:
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
movsd  %xmm0,(%rsp)
movsd  0xe99(%rip),%xmm0
call   1030 <_f@plt>
mulsd  0xe94(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xe8a(%rip),%xmm0
call   1030 <_f@plt>
mulsd  0xe85(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xe7b(%rip),%xmm0
call   1030 <_f@plt>
mulsd  0xe76(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xe6c(%rip),%xmm0
call   1030 <_f@plt>
mulsd  0xe67(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xe5d(%rip),%xmm0
call   1030 <_f@plt>
mulsd  0xe58(%rip),%xmm0
addsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@dglg10.g = internal global [10 x double] [double 0x403DEBB2CCA53DC4, double 0x4035FF203F6E1D6F, double 0x4030477D70F4EBBB, double 0x4027B004B28537AF, double 0x4020A909C7E41380, double 0x401635C18C52F60A, double 0x400B3622DEDE64A4, double 0x3FFCEEF8F76EDAB9, double 0x3FE757B111411ADF, double 0x3FC1A33768C970C8]
@dglg10.w = internal global [10 x double] [double 0x3D716FE3E009670B, double 0x3E1F9A7DDD2BCDA2, double 0x3E9C84440DFB409E, double 0x3EFDA1C7BD225785, double 0x3F48ACB133884D94, double 0x3F837588055DC806, double 0x3FAFC9ED52DF0E65, double 0x3FCBE9A961CB3158, double 0x3FD9ABF2EC5FBA28, double 0x3FD3BD7FCE3CF5F3]
define double @dglg10() {
%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, 10
br i1 %5, label %6, label %21
6: ; preds = %3
%7 = load i32, i32* %1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [10 x double], [10 x double]* @dglg10.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 [10 x double], [10 x double]* @dglg10.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 @dglg10() {
%1 = tail call double @_f(double 0x403DEBB2CCA53DC4)
%2 = tail call double @llvm.fmuladd.f64(double %1, double 0x3D716FE3E009670B, double 0.000000e+00)
%3 = tail call double @_f(double 0x4035FF203F6E1D6F)
%4 = tail call double @llvm.fmuladd.f64(double %3, double 0x3E1F9A7DDD2BCDA2, double %2)
%5 = tail call double @_f(double 0x4030477D70F4EBBB)
%6 = tail call double @llvm.fmuladd.f64(double %5, double 0x3E9C84440DFB409E, double %4)
%7 = tail call double @_f(double 0x4027B004B28537AF)
%8 = tail call double @llvm.fmuladd.f64(double %7, double 0x3EFDA1C7BD225785, double %6)
%9 = tail call double @_f(double 0x4020A909C7E41380)
%10 = tail call double @llvm.fmuladd.f64(double %9, double 0x3F48ACB133884D94, double %8)
%11 = tail call double @_f(double 0x401635C18C52F60A)
%12 = tail call double @llvm.fmuladd.f64(double %11, double 0x3F837588055DC806, double %10)
%13 = tail call double @_f(double 0x400B3622DEDE64A4)
%14 = tail call double @llvm.fmuladd.f64(double %13, double 0x3FAFC9ED52DF0E65, double %12)
%15 = tail call double @_f(double 0x3FFCEEF8F76EDAB9)
%16 = tail call double @llvm.fmuladd.f64(double %15, double 0x3FCBE9A961CB3158, double %14)
%17 = tail call double @_f(double 0x3FE757B111411ADF)
%18 = tail call double @llvm.fmuladd.f64(double %17, double 0x3FD9ABF2EC5FBA28, double %16)
%19 = tail call double @_f(double 0x3FC1A33768C970C8)
%20 = tail call double @llvm.fmuladd.f64(double %19, double 0x3FD3BD7FCE3CF5F3, double %18)
ret double %20
}