#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 */
unsigned long long pow(long long, int);
unsigned long long sqrt(long long);
float standard_deviation(long long *array, float mean, long long array_length) {
  long long i = 0LL;
  unsigned long long tmp = 0LL;
  long long array_total = 0LL;
  for (i = 0; i <= array_length; ++i) {
    tmp = tmp + pow((array[i] - mean), 2);
  }
  array_total = (tmp / (array_length));
  tmp = sqrt(array_total);
  return tmp;
}


x86 assembly (clang, -O0):
<standard_deviation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jg     11ac <standard_deviation+0x8c>
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
cvtsi2ssq (%rax,%rcx,8),%xmm0
subss  -0xc(%rbp),%xmm0
cvttss2si %xmm0,%rdi
mov    $0x2,%esi
call   1030 <pow@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1155 <standard_deviation+0x35>
mov    -0x28(%rbp),%rax
mov    -0x18(%rbp),%rcx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
call   1040 <sqrt@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x40(%rbp)
test   %rax,%rax
movss  %xmm0,-0x3c(%rbp)
js     1207 <standard_deviation+0xe7>
movss  -0x40(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x3c(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<standard_deviation>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
test   %rsi,%rsi
js     11bb <standard_deviation+0x9b>
mov    %rdi,%r15
movss  %xmm0,0xc(%rsp)
lea    0x1(%r14),%r13
test   %r14,%r14
mov    %r13,0x10(%rsp)
je     11c0 <standard_deviation+0xa0>
and    $0xfffffffffffffffe,%r13
xor    %r12d,%r12d
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtsi2ssq (%r15,%rbp,8),%xmm0
subss  0xc(%rsp),%xmm0
cvttss2si %xmm0,%rdi
mov    $0x2,%esi
call   1030 <pow@plt>
mov    %rax,%rbx
xorps  %xmm0,%xmm0
cvtsi2ssq 0x8(%r15,%rbp,8),%xmm0
add    %r12,%rbx
subss  0xc(%rsp),%xmm0
cvttss2si %xmm0,%rdi
mov    $0x2,%esi
call   1030 <pow@plt>
mov    %rax,%r12
add    %rbx,%r12
add    $0x2,%rbp
cmp    %rbp,%r13
jne    1160 <standard_deviation+0x40>
testb  $0x1,0x10(%rsp)
jne    11cc <standard_deviation+0xac>
jmp    11ed <standard_deviation+0xcd>
xor    %r12d,%r12d
jmp    11ed <standard_deviation+0xcd>
xor    %r12d,%r12d
xor    %ebp,%ebp
testb  $0x1,0x10(%rsp)
je     11ed <standard_deviation+0xcd>
xorps  %xmm0,%xmm0
cvtsi2ssq (%r15,%rbp,8),%xmm0
subss  0xc(%rsp),%xmm0
cvttss2si %xmm0,%rdi
mov    $0x2,%esi
call   1030 <pow@plt>
add    %rax,%r12
mov    %r12,%rax
or     %r14,%rax
shr    $0x20,%rax
je     1206 <standard_deviation+0xe6>
mov    %r12,%rax
xor    %edx,%edx
div    %r14
mov    %rax,%rdi
jmp    1210 <standard_deviation+0xf0>
mov    %r12d,%eax
xor    %edx,%edx
div    %r14d
mov    %eax,%edi
call   1040 <sqrt@plt>
test   %rax,%rax
js     1224 <standard_deviation+0x104>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
jmp    123c <standard_deviation+0x11c>
mov    %rax,%rcx
shr    %rcx
and    $0x1,%eax
or     %rcx,%rax
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
addss  %xmm0,%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define float @standard_deviation(i64* nocapture %0, float %1, i64 %2) {
%4 = icmp slt i64 %2, 0
br i1 %4, label %46, label %5
5: ; preds = %3
%6 = add i64 %2, 1
%7 = and i64 %6, 1
%8 = icmp eq i64 %2, 0
br i1 %8, label %33, label %9
9: ; preds = %5
%10 = and i64 %6, -2
br label %11
11: ; preds = %11, %9
%12 = phi i64 [ 0, %9 ], [ %29, %11 ]
%13 = phi i64 [ 0, %9 ], [ %30, %11 ]
%14 = phi i64 [ 0, %9 ], [ %31, %11 ]
%15 = getelementptr inbounds i64, i64* %0, i64 %13
%16 = load i64, i64* %15
%17 = sitofp i64 %16 to float
%18 = fsub float %17, %1
%19 = fptosi float %18 to i64
%20 = tail call i64 @pow(i64 %19, i32 2)
%21 = add i64 %20, %12
%22 = or i64 %13, 1
%23 = getelementptr inbounds i64, i64* %0, i64 %22
%24 = load i64, i64* %23
%25 = sitofp i64 %24 to float
%26 = fsub float %25, %1
%27 = fptosi float %26 to i64
%28 = tail call i64 @pow(i64 %27, i32 2)
%29 = add i64 %28, %21
%30 = add nuw i64 %13, 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 i64 [ undef, %5 ], [ %29, %11 ]
%35 = phi i64 [ 0, %5 ], [ %29, %11 ]
%36 = phi i64 [ 0, %5 ], [ %30, %11 ]
%37 = icmp eq i64 %7, 0
br i1 %37, label %46, label %38
38: ; preds = %33
%39 = getelementptr inbounds i64, i64* %0, i64 %36
%40 = load i64, i64* %39
%41 = sitofp i64 %40 to float
%42 = fsub float %41, %1
%43 = fptosi float %42 to i64
%44 = tail call i64 @pow(i64 %43, i32 2)
%45 = add i64 %44, %35
br label %46
46: ; preds = %38, %33, %3
%47 = phi i64 [ 0, %3 ], [ %34, %33 ], [ %45, %38 ]
%48 = udiv i64 %47, %2
%49 = tail call i64 @sqrt(i64 %48)
%50 = uitofp i64 %49 to float
ret float %50
}