#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 sqrt(double);
double airMode3_d(const double _v[3]) {
  double num, den, mean, v[3];
  mean = (_v[0] + _v[1] + _v[2]) / 3;
  v[0] = _v[0] - mean;
  v[1] = _v[1] - mean;
  v[2] = _v[2] - mean;
  num = (v[0] + v[1] - 2 * v[2]) * (2 * v[0] - v[1] - v[2]) *
        (v[0] - 2 * v[1] + v[2]);
  den = v[0] * v[0] + v[1] * v[1] + v[2] * v[2] - v[1] * v[2] - v[0] * v[1] -
        v[0] * v[2];
  den = sqrt(den);
  return (den ? num / (2 * den * den * den) : 0);
}


x86 assembly (clang, -O0):
<airMode3_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x10(%rax),%xmm0
movsd  0xec2(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x40(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  -0x40(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
addsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
subsd  -0x30(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x40(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
addsd  %xmm2,%xmm2
subsd  %xmm2,%xmm1
addsd  -0x30(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x40(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    12c2 <airMode3_d+0x1b2>
jp     12c2 <airMode3_d+0x1b2>
jmp    12ec <airMode3_d+0x1dc>
movsd  -0x10(%rbp),%xmm0
movsd  0xd39(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    12f9 <airMode3_d+0x1e9>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    12f9 <airMode3_d+0x1e9>
movsd  -0x48(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<airMode3_d>:
sub    $0x28,%rsp
movsd  (%rdi),%xmm4
movsd  0x8(%rdi),%xmm5
movapd %xmm4,%xmm0
addsd  %xmm5,%xmm0
movsd  0x10(%rdi),%xmm6
addsd  %xmm6,%xmm0
divsd  0xeca(%rip),%xmm0
subsd  %xmm0,%xmm4
subsd  %xmm0,%xmm5
subsd  %xmm0,%xmm6
movapd %xmm5,%xmm0
mulsd  %xmm5,%xmm0
movapd %xmm4,%xmm1
mulsd  %xmm4,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm6,%xmm0
mulsd  %xmm6,%xmm0
addsd  %xmm1,%xmm0
movapd %xmm5,%xmm1
mulsd  %xmm6,%xmm1
subsd  %xmm1,%xmm0
movapd %xmm4,%xmm1
mulsd  %xmm5,%xmm1
subsd  %xmm1,%xmm0
movapd %xmm4,%xmm1
mulsd  %xmm6,%xmm1
subsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1196 <airMode3_d+0x86>
sqrtsd %xmm0,%xmm0
jmp    11c1 <airMode3_d+0xb1>
movsd  %xmm4,0x8(%rsp)
movapd %xmm5,0x10(%rsp)
movsd  %xmm6,(%rsp)
call   1030 <sqrt@plt>
xorpd  %xmm1,%xmm1
movsd  (%rsp),%xmm6
movapd 0x10(%rsp),%xmm5
movsd  0x8(%rsp),%xmm4
ucomisd %xmm1,%xmm0
jne    11c9 <airMode3_d+0xb9>
jnp    1225 <airMode3_d+0x115>
movapd 0xe3f(%rip),%xmm1
xorpd  %xmm5,%xmm1
movapd %xmm4,%xmm2
addsd  %xmm5,%xmm2
movapd %xmm6,%xmm3
addsd  %xmm6,%xmm3
subsd  %xmm3,%xmm2
movapd %xmm4,%xmm3
addsd  %xmm4,%xmm3
addsd  %xmm1,%xmm3
subsd  %xmm6,%xmm3
mulsd  %xmm2,%xmm3
addsd  %xmm5,%xmm5
subsd  %xmm5,%xmm4
addsd  %xmm6,%xmm4
mulsd  %xmm3,%xmm4
movapd %xmm0,%xmm1
addsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
divsd  %xmm1,%xmm4
movapd %xmm4,%xmm1
movapd %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @airMode3_d(double* %0) {
%2 = alloca double*
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca [3 x double]
store double* %0, double** %2
%7 = load double*, double** %2
%8 = getelementptr inbounds double, double* %7, i64 0
%9 = load double, double* %8
%10 = load double*, double** %2
%11 = getelementptr inbounds double, double* %10, i64 1
%12 = load double, double* %11
%13 = fadd double %9, %12
%14 = load double*, double** %2
%15 = getelementptr inbounds double, double* %14, i64 2
%16 = load double, double* %15
%17 = fadd double %13, %16
%18 = fdiv double %17, 3.000000e+00
store double %18, double* %5
%19 = load double*, double** %2
%20 = getelementptr inbounds double, double* %19, i64 0
%21 = load double, double* %20
%22 = load double, double* %5
%23 = fsub double %21, %22
%24 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
store double %23, double* %24
%25 = load double*, double** %2
%26 = getelementptr inbounds double, double* %25, i64 1
%27 = load double, double* %26
%28 = load double, double* %5
%29 = fsub double %27, %28
%30 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 1
store double %29, double* %30
%31 = load double*, double** %2
%32 = getelementptr inbounds double, double* %31, i64 2
%33 = load double, double* %32
%34 = load double, double* %5
%35 = fsub double %33, %34
%36 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 2
store double %35, double* %36
%37 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%38 = load double, double* %37
%39 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 1
%40 = load double, double* %39
%41 = fadd double %38, %40
%42 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 2
%43 = load double, double* %42
%44 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %43, double %41)
%45 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%46 = load double, double* %45
%47 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 1
%48 = load double, double* %47
%49 = fneg double %48
%50 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %46, double %49)
%51 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 2
%52 = load double, double* %51
%53 = fsub double %50, %52
%54 = fmul double %44, %53
%55 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%56 = load double, double* %55
%57 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 1
%58 = load double, double* %57
%59 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %58, double %56)
%60 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 2
%61 = load double, double* %60
%62 = fadd double %59, %61
%63 = fmul double %54, %62
store double %63, double* %3
%64 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%65 = load double, double* %64
%66 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%67 = load double, double* %66
%68 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 1
%69 = load double, double* %68
%70 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 1
%71 = load double, double* %70
%72 = fmul double %69, %71
%73 = call double @llvm.fmuladd.f64(double %65, double %67, double %72)
%74 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 2
%75 = load double, double* %74
%76 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 2
%77 = load double, double* %76
%78 = call double @llvm.fmuladd.f64(double %75, double %77, double %73)
%79 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 1
%80 = load double, double* %79
%81 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 2
%82 = load double, double* %81
%83 = fneg double %80
%84 = call double @llvm.fmuladd.f64(double %83, double %82, double %78)
%85 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%86 = load double, double* %85
%87 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 1
%88 = load double, double* %87
%89 = fneg double %86
%90 = call double @llvm.fmuladd.f64(double %89, double %88, double %84)
%91 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%92 = load double, double* %91
%93 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 2
%94 = load double, double* %93
%95 = fneg double %92
%96 = call double @llvm.fmuladd.f64(double %95, double %94, double %90)
store double %96, double* %4
%97 = load double, double* %4
%98 = call double @sqrt(double %97)
store double %98, double* %4
%99 = load double, double* %4
%100 = fcmp une double %99, 0.000000e+00
br i1 %100, label %101, label %110
101: ; preds = %1
%102 = load double, double* %3
%103 = load double, double* %4
%104 = fmul double 2.000000e+00, %103
%105 = load double, double* %4
%106 = fmul double %104, %105
%107 = load double, double* %4
%108 = fmul double %106, %107
%109 = fdiv double %102, %108
br label %111
110: ; preds = %1
br label %111
111: ; preds = %110, %101
%112 = phi double [ %109, %101 ], [ 0.000000e+00, %110 ]
ret double %112
}

LLVM IR (-O2):
define double @airMode3_d(double* nocapture %0) {
%2 = load double, double* %0
%3 = getelementptr inbounds double, double* %0, i64 1
%4 = load double, double* %3
%5 = fadd double %2, %4
%6 = getelementptr inbounds double, double* %0, i64 2
%7 = load double, double* %6
%8 = fadd double %5, %7
%9 = fdiv double %8, 3.000000e+00
%10 = fsub double %2, %9
%11 = fsub double %4, %9
%12 = fsub double %7, %9
%13 = fneg double %11
%14 = fmul double %11, %11
%15 = tail call double @llvm.fmuladd.f64(double %10, double %10, double %14)
%16 = tail call double @llvm.fmuladd.f64(double %12, double %12, double %15)
%17 = tail call double @llvm.fmuladd.f64(double %13, double %12, double %16)
%18 = fneg double %10
%19 = tail call double @llvm.fmuladd.f64(double %18, double %11, double %17)
%20 = tail call double @llvm.fmuladd.f64(double %18, double %12, double %19)
%21 = tail call double @sqrt(double %20)
%22 = fcmp une double %21, 0.000000e+00
br i1 %22, label %23, label %36
23: ; preds = %1
%24 = fadd double %10, %11
%25 = tail call double @llvm.fmuladd.f64(double %12, double -2.000000e+00, double %24)
%26 = tail call double @llvm.fmuladd.f64(double %10, double 2.000000e+00, double %13)
%27 = fsub double %26, %12
%28 = fmul double %25, %27
%29 = tail call double @llvm.fmuladd.f64(double %11, double -2.000000e+00, double %10)
%30 = fadd double %12, %29
%31 = fmul double %30, %28
%32 = fmul double %21, 2.000000e+00
%33 = fmul double %21, %32
%34 = fmul double %21, %33
%35 = fdiv double %31, %34
br label %36
36: ; preds = %1, %23
%37 = phi double [ %35, %23 ], [ 0.000000e+00, %1 ]
ret double %37
}