#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 */
int /*<<< orphan*/ pwm(double *, int, double *, double, double,
                       int /*<<< orphan*/);
void lMoments(double *series, int n, double *lMoment, double A, double B) {
  double alpha[3];
  pwm(series, n, alpha, A, B, 0);
  lMoment[1] = alpha[0];
  lMoment[2] = alpha[0] - 2 * alpha[1];
  lMoment[3] = alpha[0] - 6 * alpha[1] + 6 * alpha[2];
}


x86 assembly (clang, -O0):
<lMoments>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x40(%rbp),%rdx
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
xor    %ecx,%ecx
call   1030 <pwm@plt>
movsd  -0x40(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x40(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x40(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  0xe84(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
movsd  0xe67(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x18(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lMoments>:
push   %rbx
sub    $0x20,%rsp
mov    %rdx,%rbx
mov    %rsp,%rdx
xor    %ecx,%ecx
call   1030 <pwm@plt>
movsd  (%rsp),%xmm0
movsd  %xmm0,0x8(%rbx)
movupd 0x8(%rsp),%xmm1
movsd  0xec6(%rip),%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
unpcklpd %xmm2,%xmm0
mulpd  0xec2(%rip),%xmm1
addpd  %xmm0,%xmm1
movupd %xmm1,0x10(%rbx)
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @lMoments(double* %0, i32 %1, double* %2, double %3, double %4) {
%6 = alloca double*
%7 = alloca i32
%8 = alloca double*
%9 = alloca double
%10 = alloca double
%11 = alloca [3 x double]
store double* %0, double** %6
store i32 %1, i32* %7
store double* %2, double** %8
store double %3, double* %9
store double %4, double* %10
%12 = load double*, double** %6
%13 = load i32, i32* %7
%14 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 0
%15 = load double, double* %9
%16 = load double, double* %10
%17 = call i32 @pwm(double* %12, i32 %13, double* %14, double %15, double %16, i32 0)
%18 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 0
%19 = load double, double* %18
%20 = load double*, double** %8
%21 = getelementptr inbounds double, double* %20, i64 1
store double %19, double* %21
%22 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 0
%23 = load double, double* %22
%24 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 1
%25 = load double, double* %24
%26 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %25, double %23)
%27 = load double*, double** %8
%28 = getelementptr inbounds double, double* %27, i64 2
store double %26, double* %28
%29 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 0
%30 = load double, double* %29
%31 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 1
%32 = load double, double* %31
%33 = call double @llvm.fmuladd.f64(double -6.000000e+00, double %32, double %30)
%34 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 2
%35 = load double, double* %34
%36 = call double @llvm.fmuladd.f64(double 6.000000e+00, double %35, double %33)
%37 = load double*, double** %8
%38 = getelementptr inbounds double, double* %37, i64 3
store double %36, double* %38
ret void
}

LLVM IR (-O2):
define void @lMoments(double* %0, i32 %1, double* nocapture writeonly %2, double %3, double %4) {
%6 = alloca [3 x double]
%7 = bitcast [3 x double]* %6 to i8*
%8 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%9 = call i32 @pwm(double* %0, i32 %1, double* %8, double %3, double %4, i32 0)
%10 = load double, double* %8
%11 = getelementptr inbounds double, double* %2, i64 1
store double %10, double* %11
%12 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 1
%13 = getelementptr inbounds double, double* %2, i64 2
%14 = bitcast double* %12 to <2 x double>*
%15 = load <2 x double>, <2 x double>* %14
%16 = extractelement <2 x double> %15, i64 0
%17 = call double @llvm.fmuladd.f64(double %16, double -6.000000e+00, double %10)
%18 = insertelement <2 x double> poison, double %10, i64 0
%19 = insertelement <2 x double> %18, double %17, i64 1
%20 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %15, <2 x double> <double -2.000000e+00, double 6.000000e+00>, <2 x double> %19)
%21 = bitcast double* %13 to <2 x double>*
store <2 x double> %20, <2 x double>* %21
ret void
}