#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_ssumpw(int const, float const *, int const);
float stdlib_strided_smeanpw(const int64_t N, const float *X,
                             const int64_t stride) {
  if (N <= 0) {
    return 0.0f / 0.0f;
  }
  if (N == 1 || stride == 0) {
    return X[0];
  }
  return (double)stdlib_strided_ssumpw(N, X, stride) / (double)N;
}


x86 assembly (clang, -O0):
<stdlib_strided_smeanpw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     113e <stdlib_strided_smeanpw+0x2e>
movss  0xecc(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    118a <stdlib_strided_smeanpw+0x7a>
cmpl   $0x1,-0x8(%rbp)
je     1152 <stdlib_strided_smeanpw+0x42>
cmpl   $0x0,-0x14(%rbp)
jne    1164 <stdlib_strided_smeanpw+0x54>
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    118a <stdlib_strided_smeanpw+0x7a>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <stdlib_strided_ssumpw@plt>
cvtsi2sd %rax,%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stdlib_strided_smeanpw>:
push   %rbx
test   %edi,%edi
jle    113a <stdlib_strided_smeanpw+0x2a>
mov    %edi,%ebx
cmp    $0x1,%edi
je     1144 <stdlib_strided_smeanpw+0x34>
test   %edx,%edx
je     1144 <stdlib_strided_smeanpw+0x34>
mov    %ebx,%edi
call   1030 <stdlib_strided_ssumpw@plt>
cvtsi2sd %rax,%xmm0
cvtsi2sd %ebx,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbx
ret
movss  0xebe(%rip),%xmm0
pop    %rbx
ret
movss  (%rsi),%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define float @stdlib_strided_smeanpw(i32 %0, float* %1, i32 %2) {
%4 = alloca float
%5 = alloca i32
%6 = alloca float*
%7 = alloca i32
store i32 %0, i32* %5
store float* %1, float** %6
store i32 %2, i32* %7
%8 = load i32, i32* %5
%9 = icmp sle i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %3
store float 0x7FF8000000000000, float* %4
br label %31
11: ; preds = %3
%12 = load i32, i32* %5
%13 = icmp eq i32 %12, 1
br i1 %13, label %17, label %14
14: ; preds = %11
%15 = load i32, i32* %7
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %14, %11
%18 = load float*, float** %6
%19 = getelementptr inbounds float, float* %18, i64 0
%20 = load float, float* %19
store float %20, float* %4
br label %31
21: ; preds = %14
%22 = load i32, i32* %5
%23 = load float*, float** %6
%24 = load i32, i32* %7
%25 = call i64 @stdlib_strided_ssumpw(i32 %22, float* %23, i32 %24)
%26 = sitofp i64 %25 to double
%27 = load i32, i32* %5
%28 = sitofp i32 %27 to double
%29 = fdiv double %26, %28
%30 = fptrunc double %29 to float
store float %30, float* %4
br label %31
31: ; preds = %21, %17, %10
%32 = load float, float* %4
ret float %32
}

LLVM IR (-O2):
define float @stdlib_strided_smeanpw(i32 %0, float* %1, i32 %2) {
%4 = icmp slt i32 %0, 1
br i1 %4, label %17, 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 %17
11: ; preds = %5
%12 = tail call i64 @stdlib_strided_ssumpw(i32 %0, float* %1, i32 %2)
%13 = sitofp i64 %12 to double
%14 = sitofp i32 %0 to double
%15 = fdiv double %13, %14
%16 = fptrunc double %15 to float
br label %17
17: ; preds = %3, %11, %9
%18 = phi float [ %10, %9 ], [ %16, %11 ], [ 0x7FF8000000000000, %3 ]
ret float %18
}