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


x86 assembly (clang, -O0):
<stdlib_strided_dmeanors>:
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_dmeanors+0x2e>
movsd  0xecc(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1181 <stdlib_strided_dmeanors+0x71>
cmpl   $0x1,-0xc(%rbp)
je     1152 <stdlib_strided_dmeanors+0x42>
cmpl   $0x0,-0x1c(%rbp)
jne    1164 <stdlib_strided_dmeanors+0x54>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1181 <stdlib_strided_dmeanors+0x71>
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <stdlib_strided_dsumors@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_dmeanors>:
push   %rbx
test   %edi,%edi
jle    1131 <stdlib_strided_dmeanors+0x21>
mov    %edi,%ebx
cmp    $0x1,%edi
je     113b <stdlib_strided_dmeanors+0x2b>
test   %edx,%edx
je     113b <stdlib_strided_dmeanors+0x2b>
mov    %ebx,%edi
call   1030 <stdlib_strided_dsumors@plt>
cvtsi2sd %ebx,%xmm1
divsd  %xmm1,%xmm0
pop    %rbx
ret
movsd  0xec7(%rip),%xmm0
pop    %rbx
ret
movsd  (%rsi),%xmm0
pop    %rbx
ret

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

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