#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 pow(int, double);
int returnMean(double *, int);
scalar_t__ standardOffset(int, double *, int);
double returnStandardDeviation(double *array, int n) {
  int mean;
  int sumOffset = 0;
  mean = returnMean(array, n);
  for (int i = 0; i < n; i++) {
    sumOffset += standardOffset(mean, array, i);
  }
  return (pow(sumOffset / n, 0.5));
}


x86 assembly (clang, -O0):
<returnStandardDeviation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <returnMean@plt>
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1192 <returnStandardDeviation+0x62>
mov    -0x10(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1030 <standardOffset@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115c <returnStandardDeviation+0x2c>
mov    -0x14(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,%edi
movsd  0xe5d(%rip),%xmm0
call   1050 <pow@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<returnStandardDeviation>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r14d
mov    %rdi,%r15
call   1040 <returnMean@plt>
test   %r14d,%r14d
jle    1169 <returnStandardDeviation+0x39>
mov    %eax,%r12d
xor    %ebp,%ebp
xor    %ebx,%ebx
nop
mov    %r12d,%edi
mov    %r15,%rsi
mov    %ebp,%edx
call   1030 <standardOffset@plt>
add    %eax,%ebx
add    $0x1,%ebp
cmp    %ebp,%r14d
jne    1150 <returnStandardDeviation+0x20>
jmp    116b <returnStandardDeviation+0x3b>
xor    %ebx,%ebx
mov    %ebx,%eax
cltd
idiv   %r14d
movsd  0xe87(%rip),%xmm0
mov    %eax,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <pow@plt>

LLVM IR (-O0):
define double @returnStandardDeviation(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
store i32 0, i32* %6
%8 = load double*, double** %3
%9 = load i32, i32* %4
%10 = call i32 @returnMean(double* %8, i32 %9)
store i32 %10, i32* %5
store i32 0, i32* %7
br label %11
11: ; preds = %24, %2
%12 = load i32, i32* %7
%13 = load i32, i32* %4
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %27
15: ; preds = %11
%16 = load i32, i32* %5
%17 = load double*, double** %3
%18 = load i32, i32* %7
%19 = call i64 @standardOffset(i32 %16, double* %17, i32 %18)
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = add nsw i64 %21, %19
%23 = trunc i64 %22 to i32
store i32 %23, i32* %6
br label %24
24: ; preds = %15
%25 = load i32, i32* %7
%26 = add nsw i32 %25, 1
store i32 %26, i32* %7
br label %11
27: ; preds = %11
%28 = load i32, i32* %6
%29 = load i32, i32* %4
%30 = sdiv i32 %28, %29
%31 = call double @pow(i32 %30, double 5.000000e-01)
ret double %31
}

LLVM IR (-O2):
define double @returnStandardDeviation(double* %0, i32 %1) {
%3 = tail call i32 @returnMean(double* %0, i32 %1)
%4 = icmp sgt i32 %1, 0
br i1 %4, label %9, label %5
5: ; preds = %9, %2
%6 = phi i32 [ 0, %2 ], [ %14, %9 ]
%7 = sdiv i32 %6, %1
%8 = tail call double @pow(i32 %7, double 5.000000e-01)
ret double %8
9: ; preds = %2, %9
%10 = phi i32 [ %15, %9 ], [ 0, %2 ]
%11 = phi i32 [ %14, %9 ], [ 0, %2 ]
%12 = tail call i64 @standardOffset(i32 %3, double* %0, i32 %10)
%13 = trunc i64 %12 to i32
%14 = add i32 %11, %13
%15 = add nuw nsw i32 %10, 1
%16 = icmp eq i32 %15, %1
br i1 %16, label %5, label %9
}