#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 */

/* Variables and functions */
double durchschnitt_int_array(int const *, int);
double pow(int const, int);
double stichprobenvarianz_int_array(const int array[], int laenge) {
  double stichprobenvarianz = 0.0;
  double durchschnitt = durchschnitt_int_array(array, laenge);
  if (laenge < 1)
    stichprobenvarianz = 0.0;
  else {
    for (int i = 0; i < laenge; i++) {
      stichprobenvarianz =
          stichprobenvarianz + (pow((array[i] - durchschnitt), 2));
    }
  }
  return stichprobenvarianz / (laenge - 1.0);
}


x86 assembly (clang, -O0):
<stichprobenvarianz_int_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <durchschnitt_int_array@plt>
movsd  %xmm0,-0x20(%rbp)
cmpl   $0x1,-0xc(%rbp)
jge    115f <stichprobenvarianz_int_array+0x3f>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11c0 <stichprobenvarianz_int_array+0xa0>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11bb <stichprobenvarianz_int_array+0x9b>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
cvtsi2sdl (%rax,%rcx,4),%xmm0
subsd  -0x20(%rbp),%xmm0
cvttsd2si %xmm0,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1166 <stichprobenvarianz_int_array+0x46>
jmp    11c0 <stichprobenvarianz_int_array+0xa0>
movsd  -0x18(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  0xe2e(%rip),%xmm2
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stichprobenvarianz_int_array>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %esi,%r15d
mov    %rdi,%rbx
call   1030 <durchschnitt_int_array@plt>
test   %r15d,%r15d
jle    1153 <stichprobenvarianz_int_array+0x33>
movsd  %xmm0,0x8(%rsp)
mov    %r15d,%r14d
cmp    $0x1,%r15d
jne    115c <stichprobenvarianz_int_array+0x3c>
xorpd  %xmm1,%xmm1
xor    %ebp,%ebp
jmp    11ca <stichprobenvarianz_int_array+0xaa>
xorpd  %xmm1,%xmm1
jmp    11fa <stichprobenvarianz_int_array+0xda>
mov    %r14d,%r12d
and    $0xfffffffe,%r12d
xorpd  %xmm1,%xmm1
xor    %ebp,%ebp
nopl   0x0(%rax)
movsd  %xmm1,(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sdl (%rbx,%rbp,4),%xmm0
subsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
xorps  %xmm1,%xmm1
cvtsi2sdl 0x4(%rbx,%rbp,4),%xmm1
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
subsd  0x8(%rsp),%xmm1
cvttsd2si %xmm1,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
movapd %xmm0,%xmm1
addsd  (%rsp),%xmm1
add    $0x2,%rbp
cmp    %rbp,%r12
jne    1170 <stichprobenvarianz_int_array+0x50>
test   $0x1,%r14b
je     11fa <stichprobenvarianz_int_array+0xda>
xorps  %xmm0,%xmm0
cvtsi2sdl (%rbx,%rbp,4),%xmm0
subsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%edi
mov    $0x2,%esi
movsd  %xmm1,(%rsp)
call   1040 <pow@plt>
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %r15d,%xmm0
addsd  0xdf6(%rip),%xmm0
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @stichprobenvarianz_int_array(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store double 0.000000e+00, double* %5
%8 = load i32*, i32** %3
%9 = load i32, i32* %4
%10 = call double @durchschnitt_int_array(i32* %8, i32 %9)
store double %10, double* %6
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 1
br i1 %12, label %13, label %14
13: ; preds = %2
store double 0.000000e+00, double* %5
br label %36
14: ; preds = %2
store i32 0, i32* %7
br label %15
15: ; preds = %32, %14
%16 = load i32, i32* %7
%17 = load i32, i32* %4
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %35
19: ; preds = %15
%20 = load double, double* %5
%21 = load i32*, i32** %3
%22 = load i32, i32* %7
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %21, i64 %23
%25 = load i32, i32* %24
%26 = sitofp i32 %25 to double
%27 = load double, double* %6
%28 = fsub double %26, %27
%29 = fptosi double %28 to i32
%30 = call double @pow(i32 %29, i32 2)
%31 = fadd double %20, %30
store double %31, double* %5
br label %32
32: ; preds = %19
%33 = load i32, i32* %7
%34 = add nsw i32 %33, 1
store i32 %34, i32* %7
br label %15
35: ; preds = %15
br label %36
36: ; preds = %35, %13
%37 = load double, double* %5
%38 = load i32, i32* %4
%39 = sitofp i32 %38 to double
%40 = fsub double %39, 1.000000e+00
%41 = fdiv double %37, %40
ret double %41
}

LLVM IR (-O2):
define double @stichprobenvarianz_int_array(i32* %0, i32 %1) {
%3 = tail call double @durchschnitt_int_array(i32* %0, i32 %1)
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %46
5: ; preds = %2
%6 = zext i32 %1 to i64
%7 = and i64 %6, 1
%8 = icmp eq i32 %1, 1
br i1 %8, label %33, label %9
9: ; preds = %5
%10 = and i64 %6, 4294967294
br label %11
11: ; preds = %11, %9
%12 = phi i64 [ 0, %9 ], [ %30, %11 ]
%13 = phi double [ 0.000000e+00, %9 ], [ %29, %11 ]
%14 = phi i64 [ 0, %9 ], [ %31, %11 ]
%15 = getelementptr inbounds i32, i32* %0, i64 %12
%16 = load i32, i32* %15
%17 = sitofp i32 %16 to double
%18 = fsub double %17, %3
%19 = fptosi double %18 to i32
%20 = tail call double @pow(i32 %19, i32 2)
%21 = fadd double %13, %20
%22 = or i64 %12, 1
%23 = getelementptr inbounds i32, i32* %0, i64 %22
%24 = load i32, i32* %23
%25 = sitofp i32 %24 to double
%26 = fsub double %25, %3
%27 = fptosi double %26 to i32
%28 = tail call double @pow(i32 %27, i32 2)
%29 = fadd double %21, %28
%30 = add nuw nsw i64 %12, 2
%31 = add i64 %14, 2
%32 = icmp eq i64 %31, %10
br i1 %32, label %33, label %11
33: ; preds = %11, %5
%34 = phi double [ undef, %5 ], [ %29, %11 ]
%35 = phi i64 [ 0, %5 ], [ %30, %11 ]
%36 = phi double [ 0.000000e+00, %5 ], [ %29, %11 ]
%37 = icmp eq i64 %7, 0
br i1 %37, label %46, label %38
38: ; preds = %33
%39 = getelementptr inbounds i32, i32* %0, i64 %35
%40 = load i32, i32* %39
%41 = sitofp i32 %40 to double
%42 = fsub double %41, %3
%43 = fptosi double %42 to i32
%44 = tail call double @pow(i32 %43, i32 2)
%45 = fadd double %36, %44
br label %46
46: ; preds = %38, %33, %2
%47 = phi double [ 0.000000e+00, %2 ], [ %34, %33 ], [ %45, %38 ]
%48 = sitofp i32 %1 to double
%49 = fadd double %48, -1.000000e+00
%50 = fdiv double %47, %49
ret double %50
}