#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 *, float);
float stdlib_strided_snanvariancewd(int, float, float *, int);
int main() {
  float 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;
  float v = stdlib_strided_snanvariancewd(N, 1.0f, x, stride);
  printf("sample variance: %f\n", v);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
lea    0xecd(%rip),%rsi
mov    $0x30,%edx
call   1050 <memcpy@plt>
movl   $0x6,-0x34(%rbp)
movl   $0x2,-0x38(%rbp)
mov    -0x34(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%edx
movss  0xe93(%rip),%xmm0
call   1040 <stdlib_strided_snanvariancewd@plt>
movss  %xmm0,-0x3c(%rbp)
movss  -0x3c(%rbp),%xmm0
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
movaps 0xf05(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,(%rsp)
movss  0xeb1(%rip),%xmm0
mov    %rsp,%rsi
mov    $0x6,%edi
mov    $0x2,%edx
call   1040 <stdlib_strided_snanvariancewd@plt>
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

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

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