#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 mglsadff1t(double, double *, int const, double const, double, double *);
double mglsadf1t(double x, double *b, const int m, const double a, const int n,
                 double *d) {
  int i;
  double g;
  g = -1.0 / (double)n;
  for (i = 0; i < n; i++)
    x = mglsadff1t(x, b, m, a, g, &d[i * (m + 1)]);
  return (x);
}


x86 assembly (clang, -O0):
<mglsadf1t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movsd  %xmm1,-0x20(%rbp)
mov    %edx,-0x24(%rbp)
mov    %rcx,-0x30(%rbp)
cvtsi2sdl -0x24(%rbp),%xmm1
movsd  0xec3(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    11a0 <mglsadf1t+0x90>
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
movsd  -0x20(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
mov    -0x30(%rbp),%rdx
mov    -0x34(%rbp),%eax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
call   1030 <mglsadff1t@plt>
movsd  %xmm0,-0x8(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    114d <mglsadf1t+0x3d>
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mglsadf1t>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
test   %edx,%edx
jle    1182 <mglsadf1t+0x72>
mov    %rcx,%rbx
mov    %esi,%r15d
mov    %rdi,%r14
cvtsi2sd %edx,%xmm2
movsd  0xecb(%rip),%xmm3
divsd  %xmm2,%xmm3
movsd  %xmm3,(%rsp)
movslq %esi,%rax
mov    %edx,%ebp
lea    0x8(,%rax,8),%r12
movsd  %xmm1,0x8(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15d,%esi
movsd  (%rsp),%xmm2
mov    %rbx,%rdx
call   1030 <mglsadff1t@plt>
movsd  0x8(%rsp),%xmm1
add    %r12,%rbx
add    $0xffffffffffffffff,%rbp
jne    1160 <mglsadf1t+0x50>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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