#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 gpoledf(double, double *, int const, double, double *);
double glsadf1(double x, double *c, const int m, const int n, double *d) {
  int i;
  double gamma;
  gamma = -1 / (double)n;
  for (i = 0; i < n; i++)
    x = gpoledf(x, c, m, gamma, &d[m * i]);
  return (x);
}


x86 assembly (clang, -O0):
<glsadf1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cvtsi2sdl -0x18(%rbp),%xmm1
movsd  0xec8(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1191 <glsadf1+0x81>
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
movsd  -0x30(%rbp),%xmm1
mov    -0x20(%rbp),%rdx
mov    -0x14(%rbp),%eax
imul   -0x24(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
call   1030 <gpoledf@plt>
movsd  %xmm0,-0x8(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1148 <glsadf1+0x38>
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glsadf1>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
test   %edx,%edx
jle    116d <glsadf1+0x5d>
mov    %rcx,%rbx
mov    %esi,%r15d
mov    %rdi,%r14
cvtsi2sd %edx,%xmm1
movsd  0xecb(%rip),%xmm2
divsd  %xmm1,%xmm2
movsd  %xmm2,0x8(%rsp)
movslq %esi,%r12
mov    %edx,%ebp
shl    $0x3,%r12
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15d,%esi
movsd  0x8(%rsp),%xmm1
mov    %rbx,%rdx
call   1030 <gpoledf@plt>
add    %r12,%rbx
add    $0xffffffffffffffff,%rbp
jne    1150 <glsadf1+0x40>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @glsadf1(double %0, double* %1, i32 %2, i32 %3, double* %4) {
%6 = alloca double
%7 = alloca double*
%8 = alloca i32
%9 = alloca i32
%10 = alloca double*
%11 = alloca i32
%12 = alloca double
store double %0, double* %6
store double* %1, double** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store double* %4, double** %10
%13 = load i32, i32* %9
%14 = sitofp i32 %13 to double
%15 = fdiv double -1.000000e+00, %14
store double %15, double* %12
store i32 0, i32* %11
br label %16
16: ; preds = %32, %5
%17 = load i32, i32* %11
%18 = load i32, i32* %9
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %35
20: ; preds = %16
%21 = load double, double* %6
%22 = load double*, double** %7
%23 = load i32, i32* %8
%24 = load double, double* %12
%25 = load double*, double** %10
%26 = load i32, i32* %8
%27 = load i32, i32* %11
%28 = mul nsw i32 %26, %27
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double, double* %25, i64 %29
%31 = call double @gpoledf(double %21, double* %22, i32 %23, double %24, double* %30)
store double %31, double* %6
br label %32
32: ; preds = %20
%33 = load i32, i32* %11
%34 = add nsw i32 %33, 1
store i32 %34, i32* %11
br label %16
35: ; preds = %16
%36 = load double, double* %6
ret double %36
}

LLVM IR (-O2):
define double @glsadf1(double %0, double* %1, i32 %2, i32 %3, double* %4) {
%6 = sitofp i32 %3 to double
%7 = fdiv double -1.000000e+00, %6
%8 = icmp sgt i32 %3, 0
br i1 %8, label %9, label %20
9: ; preds = %5
%10 = sext i32 %2 to i64
%11 = zext i32 %3 to i64
br label %12
12: ; preds = %9, %12
%13 = phi i64 [ 0, %9 ], [ %18, %12 ]
%14 = phi double [ %0, %9 ], [ %17, %12 ]
%15 = mul nsw i64 %13, %10
%16 = getelementptr inbounds double, double* %4, i64 %15
%17 = tail call double @gpoledf(double %14, double* %1, i32 %2, double %7, double* %16)
%18 = add nuw nsw i64 %13, 1
%19 = icmp eq i64 %18, %11
br i1 %19, label %20, label %12
20: ; preds = %12, %5
%21 = phi double [ %0, %5 ], [ %17, %12 ]
ret double %21
}