#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);
long skewness_long(int n, long *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 (long)((var3 - 3 * var1 * var2 + 2 * var1 * var1 * var1) / var5);
}


x86 assembly (clang, -O0):
<skewness_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%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    11f2 <skewness_long+0xe2>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cvtsi2sdq (%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_long+0x28>
fldt   -0x40(%rbp)
fldt   -0x30(%rbp)
fmul   %st,%st(0)
fsubrp %st,%st(1)
fstpl  -0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  0xdf4(%rip),%xmm1
call   1030 <pow@plt>
fstpt  -0x60(%rbp)
fldt   -0x50(%rbp)
fldt   -0x30(%rbp)
flds   0xde8(%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)
fnstcw -0xa2(%rbp)
movzwl -0xa2(%rbp),%eax
or     $0xc00,%eax
mov    %ax,-0xa4(%rbp)
fldcw  -0xa4(%rbp)
fistpll -0x70(%rbp)
fldcw  -0xa2(%rbp)
mov    -0x70(%rbp),%rax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skewness_long>:
sub    $0x58,%rsp
fldz
fld    %st(0)
fld    %st(1)
test   %edi,%edi
fldz
jle    11aa <skewness_long+0x9a>
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)
xorps  %xmm1,%xmm1
cvtsi2sdq (%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_long+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  0x8(%rsp)
movsd  0x8(%rsp),%xmm0
movsd  0xe2a(%rip),%xmm1
call   1030 <pow@plt>
fldt   0x34(%rsp)
fld    %st(0)
fmuls  0xe21(%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)
fnstcw (%rsp)
movzwl (%rsp),%eax
or     $0xc00,%eax
mov    %ax,0x2(%rsp)
fldcw  0x2(%rsp)
fistpll 0x10(%rsp)
fldcw  (%rsp)
mov    0x10(%rsp),%rax
add    $0x58,%rsp
ret

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

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