#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 */
long double pow(double, double);
double skewness_double(int n, double *data) {
  int i;
  long double var1 = 0, var2 = 0, var3 = 0, var5;
  double dat;
  for (i = 0; i < n; i++) {
    dat = (double)data[i];
    var1 += (long double)(dat / (double)n);
    var2 += (long double)(dat * dat) / (double)n;
    var3 += (long double)(dat * dat * dat) / (double)n;
  }
  var5 = pow((double)(var2 - var1 * var1), 1.5);
  return (double)((var3 - 3 * var1 * var2 + 2 * var1 * var1 * var1) / var5);
}


x86 assembly (clang, -O0):
<skewness_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
fldz
fld    %st(0)
fstpt  -0x30(%rbp)
fld    %st(0)
fstpt  -0x40(%rbp)
fstpt  -0x50(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11f1 <skewness_double+0xe1>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
fldl   -0x80(%rbp)
fldt   -0x30(%rbp)
faddp  %st,%st(1)
fstpt  -0x30(%rbp)
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm0,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
fldl   -0x90(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
fldl   -0x88(%rbp)
fdivrp %st,%st(1)
fldt   -0x40(%rbp)
faddp  %st,%st(1)
fstpt  -0x40(%rbp)
movsd  -0x68(%rbp),%xmm1
movaps %xmm1,%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
fldl   -0xa0(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
fldl   -0x98(%rbp)
fdivrp %st,%st(1)
fldt   -0x50(%rbp)
faddp  %st,%st(1)
fstpt  -0x50(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1138 <skewness_double+0x28>
fldt   -0x40(%rbp)
fldt   -0x30(%rbp)
fmul   %st,%st(0)
fsubrp %st,%st(1)
fstpl  -0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  0xdf5(%rip),%xmm1
call   1030 <pow@plt>
fstpt  -0x60(%rbp)
fldt   -0x50(%rbp)
fldt   -0x30(%rbp)
flds   0xde9(%rip)
fmul   %st(1),%st
fldt   -0x40(%rbp)
fmulp  %st,%st(1)
faddp  %st,%st(2)
fld    %st(0)
fadd   %st(1),%st
fmul   %st(1),%st
fmulp  %st,%st(1)
faddp  %st,%st(1)
fldt   -0x60(%rbp)
fdivrp %st,%st(1)
fstpl  -0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skewness_double>:
sub    $0x58,%rsp
fldz
fld    %st(0)
fld    %st(1)
test   %edi,%edi
fldz
jle    11a6 <skewness_double+0x96>
fstp   %st(0)
fstp   %st(0)
fstp   %st(1)
fstp   %st(0)
cvtsi2sd %edi,%xmm0
mov    %edi,0x4(%rsp)
fildl  0x4(%rsp)
mov    %edi,%eax
fldz
xor    %ecx,%ecx
fld    %st(0)
fld    %st(1)
fxch   %st(3)
fxch   %st(1)
fxch   %st(2)
fxch   %st(1)
nopw   0x0(%rax,%rax,1)
movsd  (%rsi,%rcx,8),%xmm1
movapd %xmm1,%xmm2
divsd  %xmm0,%xmm2
movsd  %xmm2,0x20(%rsp)
fxch   %st(1)
faddl  0x20(%rsp)
movapd %xmm1,%xmm2
mulsd  %xmm1,%xmm2
movsd  %xmm2,0x28(%rsp)
fld    %st(1)
fdivrl 0x28(%rsp)
mulsd  %xmm1,%xmm2
movsd  %xmm2,0x18(%rsp)
fld    %st(2)
fdivrl 0x18(%rsp)
fxch   %st(4)
faddp  %st,%st(1)
fxch   %st(4)
faddp  %st,%st(3)
add    $0x1,%rcx
cmp    %rcx,%rax
fxch   %st(2)
fxch   %st(3)
fxch   %st(2)
fxch   %st(1)
jne    1150 <skewness_double+0x40>
fstp   %st(0)
fld    %st(0)
fstpt  0x34(%rsp)
fld    %st(1)
fstpt  0x40(%rsp)
fxch   %st(2)
fstpt  0x4c(%rsp)
fxch   %st(1)
fmul   %st,%st(0)
fsubrp %st,%st(1)
fstpl  0x10(%rsp)
movsd  0x10(%rsp),%xmm0
movsd  0xe2e(%rip),%xmm1
call   1030 <pow@plt>
fldt   0x34(%rsp)
fld    %st(0)
fmuls  0xe25(%rip)
fldt   0x40(%rsp)
fmulp  %st,%st(1)
fldt   0x4c(%rsp)
faddp  %st,%st(1)
fld    %st(1)
fadd   %st(2),%st
fmul   %st(2),%st
fmulp  %st,%st(2)
faddp  %st,%st(1)
fdivp  %st,%st(1)
fstpl  0x8(%rsp)
movsd  0x8(%rsp),%xmm0
add    $0x58,%rsp
ret

LLVM IR (-O0):
define double @skewness_double(i32 %0, double* %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca i32
%6 = alloca x86_fp80
%7 = alloca x86_fp80
%8 = alloca x86_fp80
%9 = alloca x86_fp80
%10 = alloca double
store i32 %0, i32* %3
store double* %1, double** %4
store x86_fp80 0xK00000000000000000000, x86_fp80* %6
store x86_fp80 0xK00000000000000000000, x86_fp80* %7
store x86_fp80 0xK00000000000000000000, x86_fp80* %8
store i32 0, i32* %5
br label %11
11: ; preds = %50, %2
%12 = load i32, i32* %5
%13 = load i32, i32* %3
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %53
15: ; preds = %11
%16 = load double*, double** %4
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double, double* %16, i64 %18
%20 = load double, double* %19
store double %20, double* %10
%21 = load double, double* %10
%22 = load i32, i32* %3
%23 = sitofp i32 %22 to double
%24 = fdiv double %21, %23
%25 = fpext double %24 to x86_fp80
%26 = load x86_fp80, x86_fp80* %6
%27 = fadd x86_fp80 %26, %25
store x86_fp80 %27, x86_fp80* %6
%28 = load double, double* %10
%29 = load double, double* %10
%30 = fmul double %28, %29
%31 = fpext double %30 to x86_fp80
%32 = load i32, i32* %3
%33 = sitofp i32 %32 to double
%34 = fpext double %33 to x86_fp80
%35 = fdiv x86_fp80 %31, %34
%36 = load x86_fp80, x86_fp80* %7
%37 = fadd x86_fp80 %36, %35
store x86_fp80 %37, x86_fp80* %7
%38 = load double, double* %10
%39 = load double, double* %10
%40 = fmul double %38, %39
%41 = load double, double* %10
%42 = fmul double %40, %41
%43 = fpext double %42 to x86_fp80
%44 = load i32, i32* %3
%45 = sitofp i32 %44 to double
%46 = fpext double %45 to x86_fp80
%47 = fdiv x86_fp80 %43, %46
%48 = load x86_fp80, x86_fp80* %8
%49 = fadd x86_fp80 %48, %47
store x86_fp80 %49, x86_fp80* %8
br label %50
50: ; preds = %15
%51 = load i32, i32* %5
%52 = add nsw i32 %51, 1
store i32 %52, i32* %5
br label %11
53: ; preds = %11
%54 = load x86_fp80, x86_fp80* %7
%55 = load x86_fp80, x86_fp80* %6
%56 = load x86_fp80, x86_fp80* %6
%57 = fneg x86_fp80 %55
%58 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %57, x86_fp80 %56, x86_fp80 %54)
%59 = fptrunc x86_fp80 %58 to double
%60 = call x86_fp80 @pow(double %59, double 1.500000e+00)
store x86_fp80 %60, x86_fp80* %9
%61 = load x86_fp80, x86_fp80* %8
%62 = load x86_fp80, x86_fp80* %6
%63 = fmul x86_fp80 0xK4000C000000000000000, %62
%64 = load x86_fp80, x86_fp80* %7
%65 = fneg x86_fp80 %63
%66 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %65, x86_fp80 %64, x86_fp80 %61)
%67 = load x86_fp80, x86_fp80* %6
%68 = fmul x86_fp80 0xK40008000000000000000, %67
%69 = load x86_fp80, x86_fp80* %6
%70 = fmul x86_fp80 %68, %69
%71 = load x86_fp80, x86_fp80* %6
%72 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %70, x86_fp80 %71, x86_fp80 %66)
%73 = load x86_fp80, x86_fp80* %9
%74 = fdiv x86_fp80 %72, %73
%75 = fptrunc x86_fp80 %74 to double
ret double %75
}

LLVM IR (-O2):
define double @skewness_double(i32 %0, double* nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %28
4: ; preds = %2
%5 = sitofp i32 %0 to double
%6 = sitofp i32 %0 to x86_fp80
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %4, %8
%9 = phi i64 [ 0, %4 ], [ %26, %8 ]
%10 = phi x86_fp80 [ 0xK00000000000000000000, %4 ], [ %17, %8 ]
%11 = phi x86_fp80 [ 0xK00000000000000000000, %4 ], [ %21, %8 ]
%12 = phi x86_fp80 [ 0xK00000000000000000000, %4 ], [ %25, %8 ]
%13 = getelementptr inbounds double, double* %1, i64 %9
%14 = load double, double* %13
%15 = fdiv double %14, %5
%16 = fpext double %15 to x86_fp80
%17 = fadd x86_fp80 %10, %16
%18 = fmul double %14, %14
%19 = fpext double %18 to x86_fp80
%20 = fdiv x86_fp80 %19, %6
%21 = fadd x86_fp80 %11, %20
%22 = fmul double %14, %18
%23 = fpext double %22 to x86_fp80
%24 = fdiv x86_fp80 %23, %6
%25 = fadd x86_fp80 %12, %24
%26 = add nuw nsw i64 %9, 1
%27 = icmp eq i64 %26, %7
br i1 %27, label %28, label %8
28: ; preds = %8, %2
%29 = phi x86_fp80 [ 0xK00000000000000000000, %2 ], [ %25, %8 ]
%30 = phi x86_fp80 [ 0xK00000000000000000000, %2 ], [ %21, %8 ]
%31 = phi x86_fp80 [ 0xK00000000000000000000, %2 ], [ %17, %8 ]
%32 = fneg x86_fp80 %31
%33 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %32, x86_fp80 %31, x86_fp80 %30)
%34 = fptrunc x86_fp80 %33 to double
%35 = tail call x86_fp80 @pow(double %34, double 1.500000e+00)
%36 = fmul x86_fp80 %31, 0xKC000C000000000000000
%37 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %36, x86_fp80 %30, x86_fp80 %29)
%38 = fmul x86_fp80 %31, 0xK40008000000000000000
%39 = fmul x86_fp80 %31, %38
%40 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %39, x86_fp80 %31, x86_fp80 %37)
%41 = fdiv x86_fp80 %40, %35
%42 = fptrunc x86_fp80 %41 to double
ret double %42
}