#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 */
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ stdlib_strided_dmeanvarpn(int, int, double *, int, double *,
                                             int);
int main() {
  double x[] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0};
  double out[] = {0.0, 0.0};
  int64_t N = 4;
  int64_t strideX = 2;
  int64_t strideOut = 1;
  stdlib_strided_dmeanvarpn(N, 1, x, strideX, out, strideOut);
  printf("sample mean: %lf\n", out[0]);
  printf("sample variance: %lf\n", out[1]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    -0x40(%rbp),%rdi
lea    0xead(%rip),%rsi
mov    $0x40,%edx
call   1060 <memcpy@plt>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
movl   $0x4,-0x54(%rbp)
movl   $0x2,-0x58(%rbp)
movl   $0x1,-0x5c(%rbp)
mov    -0x54(%rbp),%edi
lea    -0x40(%rbp),%rdx
mov    -0x58(%rbp),%ecx
lea    -0x50(%rbp),%r8
mov    -0x5c(%rbp),%r9d
mov    $0x1,%esi
call   1050 <stdlib_strided_dmeanvarpn@plt>
movsd  -0x50(%rbp),%xmm0
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x48(%rbp),%xmm0
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x58,%rsp
movaps 0xf05(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeb1(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
lea    0x10(%rsp),%rdx
mov    %rsp,%r8
mov    $0x4,%edi
mov    $0x1,%esi
mov    $0x2,%ecx
mov    $0x1,%r9d
call   1040 <stdlib_strided_dmeanvarpn@plt>
movsd  (%rsp),%xmm0
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm0
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
ret

LLVM IR (-O0):
@__const.main.x = [8 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 5.000000e+00, double 6.000000e+00, double 7.000000e+00, double 8.000000e+00]
@.str = [18 x i8] c"sample mean: %lf\0A\00"
@.str.1 = [22 x i8] c"sample variance: %lf\0A\00"
define i32 @main() {
%1 = alloca [8 x double]
%2 = alloca [2 x double]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast [8 x double]* %1 to i8*
%7 = bitcast [2 x double]* %2 to i8*
store i32 4, i32* %3
store i32 2, i32* %4
store i32 1, i32* %5
%8 = load i32, i32* %3
%9 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 0
%10 = load i32, i32* %4
%11 = getelementptr inbounds [2 x double], [2 x double]* %2, i64 0, i64 0
%12 = load i32, i32* %5
%13 = call i32 @stdlib_strided_dmeanvarpn(i32 %8, i32 1, double* %9, i32 %10, double* %11, i32 %12)
%14 = getelementptr inbounds [2 x double], [2 x double]* %2, i64 0, i64 0
%15 = load double, double* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), double %15)
%17 = getelementptr inbounds [2 x double], [2 x double]* %2, i64 0, i64 1
%18 = load double, double* %17
%19 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), double %18)
ret i32 0
}

LLVM IR (-O2):
@__const.main.x = [8 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 5.000000e+00, double 6.000000e+00, double 7.000000e+00, double 8.000000e+00]
@.str = [18 x i8] c"sample mean: %lf\0A\00"
@.str.1 = [22 x i8] c"sample variance: %lf\0A\00"
define i32 @main() {
%1 = alloca [8 x double]
%2 = alloca [2 x double]
%3 = bitcast [8 x double]* %1 to i8*
%4 = bitcast [2 x double]* %2 to i8*
%5 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 0
%6 = getelementptr inbounds [2 x double], [2 x double]* %2, i64 0, i64 0
%7 = call i32 @stdlib_strided_dmeanvarpn(i32 4, i32 1, double* %5, i32 2, double* %6, i32 1)
%8 = load double, double* %6
%9 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), double %8)
%10 = getelementptr inbounds [2 x double], [2 x double]* %2, i64 0, i64 1
%11 = load double, double* %10
%12 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), double %11)
ret i32 0
}