#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 */
scalar_t__ pow(double, int);
double sqrt(double);
double get_standard_deviation(double *data_array, double mean, int size) {
  double stddev;
  double sum_of_squares = 0;
  double mean_sum_of_squares;
  int i;
  for (i = 0; i < size; i++) {
    sum_of_squares += pow((data_array[i] - mean), 2);
  }
  mean_sum_of_squares = sum_of_squares / size;
  stddev = sqrt(mean_sum_of_squares);
  return (stddev);
}


x86 assembly (clang, -O0):
<get_standard_deviation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1188 <get_standard_deviation+0x68>
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x10(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1143 <get_standard_deviation+0x23>
movsd  -0x28(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_standard_deviation>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %esi,%r14d
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
test   %esi,%esi
jle    1278 <get_standard_deviation+0x158>
mov    %rdi,%rbx
mov    %r14d,%r12d
lea    -0x1(%r12),%rax
mov    %r12d,%r15d
and    $0x3,%r15d
cmp    $0x3,%rax
movsd  %xmm1,0x8(%rsp)
jae    1168 <get_standard_deviation+0x48>
xorpd  %xmm0,%xmm0
xor    %ebp,%ebp
jmp    1230 <get_standard_deviation+0x110>
and    $0xfffffffc,%r12d
xorpd  %xmm0,%xmm0
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  %xmm0,(%rsp)
movsd  (%rbx,%rbp,8),%xmm0
subsd  %xmm1,%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rbx,%rbp,8),%xmm0
subsd  0x8(%rsp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x10(%rbx,%rbp,8),%xmm0
subsd  0x8(%rsp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x18(%rbx,%rbp,8),%xmm0
subsd  0x8(%rsp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movsd  0x8(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  (%rsp),%xmm0
add    $0x4,%rbp
cmp    %rbp,%r12
jne    1180 <get_standard_deviation+0x60>
test   %r15,%r15
je     1278 <get_standard_deviation+0x158>
lea    (%rbx,%rbp,8),%rbx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,(%rsp)
movsd  (%rbx,%rbp,8),%xmm0
subsd  %xmm1,%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
xorps  %xmm2,%xmm2
cvtsi2sd %rax,%xmm2
addsd  %xmm2,%xmm0
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1240 <get_standard_deviation+0x120>
xorps  %xmm1,%xmm1
cvtsi2sd %r14d,%xmm1
divsd  %xmm1,%xmm0
ucomisd 0xd74(%rip),%xmm0
jb     129f <get_standard_deviation+0x17f>
sqrtsd %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <sqrt@plt>

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

LLVM IR (-O2):
define double @get_standard_deviation(double* nocapture %0, double %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %64
5: ; preds = %3
%6 = zext i32 %2 to i64
%7 = add nsw i64 %6, -1
%8 = and i64 %6, 3
%9 = icmp ult i64 %7, 3
br i1 %9, label %46, label %10
10: ; preds = %5
%11 = and i64 %6, 4294967292
br label %12
12: ; preds = %12, %10
%13 = phi i64 [ 0, %10 ], [ %43, %12 ]
%14 = phi double [ 0.000000e+00, %10 ], [ %42, %12 ]
%15 = phi i64 [ 0, %10 ], [ %44, %12 ]
%16 = getelementptr inbounds double, double* %0, i64 %13
%17 = load double, double* %16
%18 = fsub double %17, %1
%19 = tail call i64 @pow(double %18, i32 2)
%20 = sitofp i64 %19 to double
%21 = fadd double %14, %20
%22 = or i64 %13, 1
%23 = getelementptr inbounds double, double* %0, i64 %22
%24 = load double, double* %23
%25 = fsub double %24, %1
%26 = tail call i64 @pow(double %25, i32 2)
%27 = sitofp i64 %26 to double
%28 = fadd double %21, %27
%29 = or i64 %13, 2
%30 = getelementptr inbounds double, double* %0, i64 %29
%31 = load double, double* %30
%32 = fsub double %31, %1
%33 = tail call i64 @pow(double %32, i32 2)
%34 = sitofp i64 %33 to double
%35 = fadd double %28, %34
%36 = or i64 %13, 3
%37 = getelementptr inbounds double, double* %0, i64 %36
%38 = load double, double* %37
%39 = fsub double %38, %1
%40 = tail call i64 @pow(double %39, i32 2)
%41 = sitofp i64 %40 to double
%42 = fadd double %35, %41
%43 = add nuw nsw i64 %13, 4
%44 = add i64 %15, 4
%45 = icmp eq i64 %44, %11
br i1 %45, label %46, label %12
46: ; preds = %12, %5
%47 = phi double [ undef, %5 ], [ %42, %12 ]
%48 = phi i64 [ 0, %5 ], [ %43, %12 ]
%49 = phi double [ 0.000000e+00, %5 ], [ %42, %12 ]
%50 = icmp eq i64 %8, 0
br i1 %50, label %64, label %51
51: ; preds = %46, %51
%52 = phi i64 [ %61, %51 ], [ %48, %46 ]
%53 = phi double [ %60, %51 ], [ %49, %46 ]
%54 = phi i64 [ %62, %51 ], [ 0, %46 ]
%55 = getelementptr inbounds double, double* %0, i64 %52
%56 = load double, double* %55
%57 = fsub double %56, %1
%58 = tail call i64 @pow(double %57, i32 2)
%59 = sitofp i64 %58 to double
%60 = fadd double %53, %59
%61 = add nuw nsw i64 %52, 1
%62 = add i64 %54, 1
%63 = icmp eq i64 %62, %8
br i1 %63, label %64, label %51
64: ; preds = %46, %51, %3
%65 = phi double [ 0.000000e+00, %3 ], [ %47, %46 ], [ %60, %51 ]
%66 = sitofp i32 %2 to double
%67 = fdiv double %65, %66
%68 = tail call double @sqrt(double %67)
ret double %68
}