#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);
double stdlib_strided_dnanvariancewd(int, int, double *, int);
int main() {
  double x[] = {1.0, 2.0, 0.0 / 0.0, 3.0, 0.0 / 0.0, 4.0,
                5.0, 6.0, 0.0 / 0.0, 7.0, 8.0,       0.0 / 0.0};
  int64_t N = 6;
  int64_t stride = 2;
  double v = stdlib_strided_dnanvariancewd(N, 1, x, stride);
  printf("sample variance: %lf\n", v);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    -0x60(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x60,%edx
call   1050 <memcpy@plt>
movl   $0x6,-0x64(%rbp)
movl   $0x2,-0x68(%rbp)
mov    -0x64(%rbp),%edi
lea    -0x60(%rbp),%rdx
mov    -0x68(%rbp),%ecx
mov    $0x1,%esi
call   1040 <stdlib_strided_dnanvariancewd@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
lea    0xee0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x68,%rsp
movaps 0xf25(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xf09(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xeed(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xed1(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeb5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe99(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdx
mov    $0x6,%edi
mov    $0x1,%esi
mov    $0x2,%ecx
call   1040 <stdlib_strided_dnanvariancewd@plt>
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x68,%rsp
ret

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

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