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


x86 assembly (clang, -O0):
<stdlib_strided_dsmeanors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpl   $0x0,-0xc(%rbp)
jg     113e <stdlib_strided_dsmeanors+0x2e>
movsd  0xecc(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1185 <stdlib_strided_dsmeanors+0x75>
cmpl   $0x1,-0xc(%rbp)
je     1152 <stdlib_strided_dsmeanors+0x42>
cmpl   $0x0,-0x1c(%rbp)
jne    1168 <stdlib_strided_dsmeanors+0x58>
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1185 <stdlib_strided_dsmeanors+0x75>
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <stdlib_strided_dssumors@plt>
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stdlib_strided_dsmeanors>:
push   %rbx
test   %edi,%edi
jle    1131 <stdlib_strided_dsmeanors+0x21>
mov    %edi,%ebx
cmp    $0x1,%edi
je     113b <stdlib_strided_dsmeanors+0x2b>
test   %edx,%edx
je     113b <stdlib_strided_dsmeanors+0x2b>
mov    %ebx,%edi
call   1030 <stdlib_strided_dssumors@plt>
cvtsi2sd %ebx,%xmm1
divsd  %xmm1,%xmm0
pop    %rbx
ret
movsd  0xec7(%rip),%xmm0
pop    %rbx
ret
movss  (%rsi),%xmm0
cvtss2sd %xmm0,%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define double @stdlib_strided_dsmeanors(i32 %0, float* %1, i32 %2) {
%4 = alloca double
%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 double 0x7FF8000000000000, double* %4
br label %30
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 %22
17: ; preds = %14, %11
%18 = load float*, float** %6
%19 = getelementptr inbounds float, float* %18, i64 0
%20 = load float, float* %19
%21 = fpext float %20 to double
store double %21, double* %4
br label %30
22: ; preds = %14
%23 = load i32, i32* %5
%24 = load float*, float** %6
%25 = load i32, i32* %7
%26 = call double @stdlib_strided_dssumors(i32 %23, float* %24, i32 %25)
%27 = load i32, i32* %5
%28 = sitofp i32 %27 to double
%29 = fdiv double %26, %28
store double %29, double* %4
br label %30
30: ; preds = %22, %17, %10
%31 = load double, double* %4
ret double %31
}

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