#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 dist2(double *, double *, int);
double sqrt(int);
double tetrahedron_volume(double x1[], double x2[], double x3[], double x4[],
                          int n) {
  double U = dist2(x1, x2, n);
  double V = dist2(x1, x3, n);
  double W = dist2(x2, x3, n);
  double u = dist2(x3, x4, n);
  double v = dist2(x2, x4, n);
  double w = dist2(x1, x4, n);
  double a = v + w - U;
  double b = w + u - V;
  double c = u + v - W;
  return sqrt((4 * u * v * w - u * a * a - v * b * b - w * c * c + a * b * c)) /
         12.0;
}


x86 assembly (clang, -O0):
<tetrahedron_volume>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <dist2@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <dist2@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <dist2@plt>
movsd  %xmm0,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <dist2@plt>
movsd  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <dist2@plt>
movsd  %xmm0,-0x50(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <dist2@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
addsd  -0x58(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x48(%rbp),%xmm0
addsd  -0x50(%rbp),%xmm0
subsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xe0a(%rip),%xmm1
mulsd  -0x48(%rbp),%xmm1
mulsd  -0x50(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x58(%rbp),%xmm1
mulsd  -0x70(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sqrt@plt>
movsd  0xd41(%rip),%xmm1
divsd  %xmm1,%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tetrahedron_volume>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x30,%rsp
mov    %r8d,%ebx
mov    %rcx,%r14
mov    %rdx,%r13
mov    %rsi,%r12
mov    %rdi,%r15
mov    %r8d,%edx
call   1030 <dist2@plt>
movsd  %xmm0,0x28(%rsp)
mov    %r15,%rdi
mov    %r13,%rsi
mov    %ebx,%edx
call   1030 <dist2@plt>
movsd  %xmm0,0x18(%rsp)
mov    %r12,%rdi
mov    %r13,%rsi
mov    %ebx,%edx
call   1030 <dist2@plt>
movsd  %xmm0,0x20(%rsp)
mov    %r13,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1030 <dist2@plt>
movsd  %xmm0,0x10(%rsp)
mov    %r12,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1030 <dist2@plt>
movsd  %xmm0,0x8(%rsp)
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1030 <dist2@plt>
movsd  0x8(%rsp),%xmm6
movapd %xmm6,%xmm2
addsd  %xmm0,%xmm2
subsd  0x28(%rsp),%xmm2
movsd  0x10(%rsp),%xmm5
movapd %xmm5,%xmm1
addsd  %xmm0,%xmm1
subsd  0x18(%rsp),%xmm1
movapd %xmm5,%xmm3
addsd  %xmm6,%xmm3
movapd %xmm2,%xmm4
mulsd  %xmm5,%xmm4
mulsd  0xe1d(%rip),%xmm5
subsd  0x20(%rsp),%xmm3
mulsd  %xmm6,%xmm5
mulsd  %xmm2,%xmm4
mulsd  %xmm0,%xmm5
subsd  %xmm4,%xmm5
movapd %xmm6,%xmm4
mulsd  %xmm1,%xmm4
mulsd  %xmm1,%xmm4
subsd  %xmm4,%xmm5
mulsd  %xmm3,%xmm0
mulsd  %xmm3,%xmm0
subsd  %xmm0,%xmm5
mulsd  %xmm2,%xmm1
mulsd  %xmm3,%xmm1
addsd  %xmm5,%xmm1
cvttsd2si %xmm1,%edi
call   1040 <sqrt@plt>
divsd  0xdd6(%rip),%xmm0
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define double @tetrahedron_volume(double* %0, double* %1, double* %2, double* %3, i32 %4) {
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca i32
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
store double* %0, double** %6
store double* %1, double** %7
store double* %2, double** %8
store double* %3, double** %9
store i32 %4, i32* %10
%20 = load double*, double** %6
%21 = load double*, double** %7
%22 = load i32, i32* %10
%23 = call double @dist2(double* %20, double* %21, i32 %22)
store double %23, double* %11
%24 = load double*, double** %6
%25 = load double*, double** %8
%26 = load i32, i32* %10
%27 = call double @dist2(double* %24, double* %25, i32 %26)
store double %27, double* %12
%28 = load double*, double** %7
%29 = load double*, double** %8
%30 = load i32, i32* %10
%31 = call double @dist2(double* %28, double* %29, i32 %30)
store double %31, double* %13
%32 = load double*, double** %8
%33 = load double*, double** %9
%34 = load i32, i32* %10
%35 = call double @dist2(double* %32, double* %33, i32 %34)
store double %35, double* %14
%36 = load double*, double** %7
%37 = load double*, double** %9
%38 = load i32, i32* %10
%39 = call double @dist2(double* %36, double* %37, i32 %38)
store double %39, double* %15
%40 = load double*, double** %6
%41 = load double*, double** %9
%42 = load i32, i32* %10
%43 = call double @dist2(double* %40, double* %41, i32 %42)
store double %43, double* %16
%44 = load double, double* %15
%45 = load double, double* %16
%46 = fadd double %44, %45
%47 = load double, double* %11
%48 = fsub double %46, %47
store double %48, double* %17
%49 = load double, double* %16
%50 = load double, double* %14
%51 = fadd double %49, %50
%52 = load double, double* %12
%53 = fsub double %51, %52
store double %53, double* %18
%54 = load double, double* %14
%55 = load double, double* %15
%56 = fadd double %54, %55
%57 = load double, double* %13
%58 = fsub double %56, %57
store double %58, double* %19
%59 = load double, double* %14
%60 = fmul double 4.000000e+00, %59
%61 = load double, double* %15
%62 = fmul double %60, %61
%63 = load double, double* %16
%64 = load double, double* %14
%65 = load double, double* %17
%66 = fmul double %64, %65
%67 = load double, double* %17
%68 = fmul double %66, %67
%69 = fneg double %68
%70 = call double @llvm.fmuladd.f64(double %62, double %63, double %69)
%71 = load double, double* %15
%72 = load double, double* %18
%73 = fmul double %71, %72
%74 = load double, double* %18
%75 = fneg double %73
%76 = call double @llvm.fmuladd.f64(double %75, double %74, double %70)
%77 = load double, double* %16
%78 = load double, double* %19
%79 = fmul double %77, %78
%80 = load double, double* %19
%81 = fneg double %79
%82 = call double @llvm.fmuladd.f64(double %81, double %80, double %76)
%83 = load double, double* %17
%84 = load double, double* %18
%85 = fmul double %83, %84
%86 = load double, double* %19
%87 = call double @llvm.fmuladd.f64(double %85, double %86, double %82)
%88 = fptosi double %87 to i32
%89 = call double @sqrt(i32 %88)
%90 = fdiv double %89, 1.200000e+01
ret double %90
}

LLVM IR (-O2):
define double @tetrahedron_volume(double* %0, double* %1, double* %2, double* %3, i32 %4) {
%6 = tail call double @dist2(double* %0, double* %1, i32 %4)
%7 = tail call double @dist2(double* %0, double* %2, i32 %4)
%8 = tail call double @dist2(double* %1, double* %2, i32 %4)
%9 = tail call double @dist2(double* %2, double* %3, i32 %4)
%10 = tail call double @dist2(double* %1, double* %3, i32 %4)
%11 = tail call double @dist2(double* %0, double* %3, i32 %4)
%12 = fadd double %10, %11
%13 = fsub double %12, %6
%14 = fadd double %9, %11
%15 = fsub double %14, %7
%16 = fadd double %9, %10
%17 = fsub double %16, %8
%18 = fmul double %9, 4.000000e+00
%19 = fmul double %18, %10
%20 = fneg double %9
%21 = fmul double %13, %20
%22 = fmul double %13, %21
%23 = tail call double @llvm.fmuladd.f64(double %19, double %11, double %22)
%24 = fneg double %10
%25 = fmul double %15, %24
%26 = tail call double @llvm.fmuladd.f64(double %25, double %15, double %23)
%27 = fneg double %11
%28 = fmul double %17, %27
%29 = tail call double @llvm.fmuladd.f64(double %28, double %17, double %26)
%30 = fmul double %13, %15
%31 = tail call double @llvm.fmuladd.f64(double %30, double %17, double %29)
%32 = fptosi double %31 to i32
%33 = tail call double @sqrt(i32 %32)
%34 = fdiv double %33, 1.200000e+01
ret double %34
}