#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 */
typedef int int64_t;

/* Variables and functions */
scalar_t__ stdlib_strided_sapxsumpw(int const, float, float const *, int const);
scalar_t__ stdlib_strided_ssumpw(int const, float const *, int const);
float stdlib_strided_smeanpn(const int64_t N, const float *X,
                             const int64_t stride) {
  double dN;
  float mu;
  float c;
  if (N <= 0) {
    return 0.0 / 0.0;
  }
  if (N == 1 || stride == 0) {
    return X[0];
  }
  dN = (double)N;
  mu = (double)stdlib_strided_ssumpw(N, X, stride) / dN;
  c = (double)stdlib_strided_sapxsumpw(N, -mu, X, stride) / dN;
  return mu + c;
}


x86 assembly (clang, -O0):
<stdlib_strided_smeanpn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     114e <stdlib_strided_smeanpn+0x2e>
movss  0xebc(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11e3 <stdlib_strided_smeanpn+0xc3>
cmpl   $0x1,-0x8(%rbp)
je     1162 <stdlib_strided_smeanpn+0x42>
cmpl   $0x0,-0x14(%rbp)
jne    1174 <stdlib_strided_smeanpn+0x54>
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11e3 <stdlib_strided_smeanpn+0xc3>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <stdlib_strided_ssumpw@plt>
cvtsi2sd %rax,%xmm0
divsd  -0x20(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x8(%rbp),%edi
movss  -0x24(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <stdlib_strided_sapxsumpw@plt>
cvtsi2sd %rax,%xmm0
divsd  -0x20(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x24(%rbp),%xmm0
addss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stdlib_strided_smeanpn>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
test   %edi,%edi
jle    1199 <stdlib_strided_smeanpn+0x79>
mov    %rsi,%r14
mov    %edi,%ebp
cmp    $0x1,%edi
je     11a3 <stdlib_strided_smeanpn+0x83>
mov    %edx,%ebx
test   %edx,%edx
je     11a3 <stdlib_strided_smeanpn+0x83>
cvtsi2sd %ebp,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %ebp,%edi
mov    %r14,%rsi
mov    %ebx,%edx
call   1040 <stdlib_strided_ssumpw@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  0x8(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm1
movaps %xmm1,0x10(%rsp)
movaps 0xea0(%rip),%xmm0
xorps  %xmm1,%xmm0
mov    %ebp,%edi
mov    %r14,%rsi
mov    %ebx,%edx
call   1030 <stdlib_strided_sapxsumpw@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  0x8(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
addss  0x10(%rsp),%xmm0
jmp    11a8 <stdlib_strided_smeanpn+0x88>
movss  0xe5f(%rip),%xmm0
jmp    11a8 <stdlib_strided_smeanpn+0x88>
movss  (%r14),%xmm0
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define float @stdlib_strided_smeanpn(i32 %0, float* %1, i32 %2) {
%4 = alloca float
%5 = alloca i32
%6 = alloca float*
%7 = alloca i32
%8 = alloca double
%9 = alloca float
%10 = alloca float
store i32 %0, i32* %5
store float* %1, float** %6
store i32 %2, i32* %7
%11 = load i32, i32* %5
%12 = icmp sle i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %3
store float 0x7FF8000000000000, float* %4
br label %48
14: ; preds = %3
%15 = load i32, i32* %5
%16 = icmp eq i32 %15, 1
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = load i32, i32* %7
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %17, %14
%21 = load float*, float** %6
%22 = getelementptr inbounds float, float* %21, i64 0
%23 = load float, float* %22
store float %23, float* %4
br label %48
24: ; preds = %17
%25 = load i32, i32* %5
%26 = sitofp i32 %25 to double
store double %26, double* %8
%27 = load i32, i32* %5
%28 = load float*, float** %6
%29 = load i32, i32* %7
%30 = call i64 @stdlib_strided_ssumpw(i32 %27, float* %28, i32 %29)
%31 = sitofp i64 %30 to double
%32 = load double, double* %8
%33 = fdiv double %31, %32
%34 = fptrunc double %33 to float
store float %34, float* %9
%35 = load i32, i32* %5
%36 = load float, float* %9
%37 = fneg float %36
%38 = load float*, float** %6
%39 = load i32, i32* %7
%40 = call i64 @stdlib_strided_sapxsumpw(i32 %35, float %37, float* %38, i32 %39)
%41 = sitofp i64 %40 to double
%42 = load double, double* %8
%43 = fdiv double %41, %42
%44 = fptrunc double %43 to float
store float %44, float* %10
%45 = load float, float* %9
%46 = load float, float* %10
%47 = fadd float %45, %46
store float %47, float* %4
br label %48
48: ; preds = %24, %20, %13
%49 = load float, float* %4
ret float %49
}

LLVM IR (-O2):
define float @stdlib_strided_smeanpn(i32 %0, float* %1, i32 %2) {
%4 = icmp slt i32 %0, 1
br i1 %4, label %23, label %5
5: ; preds = %3
%6 = icmp eq i32 %0, 1
%7 = icmp eq i32 %2, 0
%8 = or i1 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = load float, float* %1
br label %23
11: ; preds = %5
%12 = sitofp i32 %0 to double
%13 = tail call i64 @stdlib_strided_ssumpw(i32 %0, float* %1, i32 %2)
%14 = sitofp i64 %13 to double
%15 = fdiv double %14, %12
%16 = fptrunc double %15 to float
%17 = fneg float %16
%18 = tail call i64 @stdlib_strided_sapxsumpw(i32 %0, float %17, float* %1, i32 %2)
%19 = sitofp i64 %18 to double
%20 = fdiv double %19, %12
%21 = fptrunc double %20 to float
%22 = fadd float %16, %21
br label %23
23: ; preds = %3, %11, %9
%24 = phi float [ %10, %9 ], [ %22, %11 ], [ 0x7FF8000000000000, %3 ]
ret float %24
}