double aft_tetra_qual(double *vertex, int v1, int v2, int v3, int v4) {
  double v, ls, q;
  v = det3i4(vertex, v1, v2, v3, v4);
  ls = (ldisti(vertex, v1, v2)) + (ldisti(vertex, v1, v3)) +
       (ldisti(vertex, v1, v4)) + (ldisti(vertex, v2, v3)) +
       (ldisti(vertex, v2, v4)) + (ldisti(vertex, v3, v4));
  q = 6.0 * sqrt(2.0) * v / ls;
  return q;
}


x86 assembly (clang, -O0):
<aft_tetra_qual>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x0,%al
call   1040 <det3i4@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    $0x0,%al
call   1030 <ldisti@plt>
mov    %eax,-0x44(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    $0x0,%al
call   1030 <ldisti@plt>
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x40(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    $0x0,%al
call   1030 <ldisti@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    $0x0,%al
call   1030 <ldisti@plt>
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    $0x0,%al
call   1030 <ldisti@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    $0x0,%al
call   1030 <ldisti@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
add    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xdf5(%rip),%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xddd(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  -0x20(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aft_tetra_qual>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8d,0xc(%rsp)
mov    %edx,%r12d
mov    %esi,%ebp
mov    %rdi,%r15
mov    %ecx,%ebx
xor    %eax,%eax
call   1040 <det3i4@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r12d,%edx
xor    %eax,%eax
call   1030 <ldisti@plt>
mov    %eax,%r13d
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %ebx,0x8(%rsp)
xor    %eax,%eax
call   1030 <ldisti@plt>
mov    %eax,%r14d
add    %r13d,%r14d
mov    %r15,%rdi
mov    %ebp,%esi
mov    0xc(%rsp),%r13d
mov    %r13d,%edx
xor    %eax,%eax
call   1030 <ldisti@plt>
mov    %eax,%ebp
add    %r14d,%ebp
mov    %r15,%rdi
mov    %r12d,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <ldisti@plt>
mov    %eax,%ebx
add    %ebp,%ebx
mov    %r15,%rdi
mov    %r12d,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1030 <ldisti@plt>
mov    %eax,%ebp
add    %ebx,%ebp
mov    %r15,%rdi
mov    0x8(%rsp),%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1030 <ldisti@plt>
add    %ebp,%eax
cvtsi2sd %eax,%xmm1
movsd  0x10(%rsp),%xmm0
mulsd  0xe23(%rip),%xmm0
divsd  %xmm1,%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @aft_tetra_qual(double* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
%12 = alloca double
%13 = alloca double
store double* %0, double** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%14 = load double*, double** %6
%15 = load i32, i32* %7
%16 = load i32, i32* %8
%17 = load i32, i32* %9
%18 = load i32, i32* %10
%19 = call i32 (double*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @det3i4 to i32 (double*, i32, i32, i32, i32, ...)*)(double* %14, i32 %15, i32 %16, i32 %17, i32 %18)
%20 = sitofp i32 %19 to double
store double %20, double* %11
%21 = load double*, double** %6
%22 = load i32, i32* %7
%23 = load i32, i32* %8
%24 = call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %21, i32 %22, i32 %23)
%25 = load double*, double** %6
%26 = load i32, i32* %7
%27 = load i32, i32* %9
%28 = call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %25, i32 %26, i32 %27)
%29 = add nsw i32 %24, %28
%30 = load double*, double** %6
%31 = load i32, i32* %7
%32 = load i32, i32* %10
%33 = call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %30, i32 %31, i32 %32)
%34 = add nsw i32 %29, %33
%35 = load double*, double** %6
%36 = load i32, i32* %8
%37 = load i32, i32* %9
%38 = call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %35, i32 %36, i32 %37)
%39 = add nsw i32 %34, %38
%40 = load double*, double** %6
%41 = load i32, i32* %8
%42 = load i32, i32* %10
%43 = call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %40, i32 %41, i32 %42)
%44 = add nsw i32 %39, %43
%45 = load double*, double** %6
%46 = load i32, i32* %9
%47 = load i32, i32* %10
%48 = call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %45, i32 %46, i32 %47)
%49 = add nsw i32 %44, %48
%50 = sitofp i32 %49 to double
store double %50, double* %12
%51 = call double @sqrt(double 2.000000e+00)
%52 = fmul double 6.000000e+00, %51
%53 = load double, double* %11
%54 = fmul double %52, %53
%55 = load double, double* %12
%56 = fdiv double %54, %55
store double %56, double* %13
%57 = load double, double* %13
ret double %57
}

LLVM IR (-O2):
define double @aft_tetra_qual(double* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 (double*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @det3i4 to i32 (double*, i32, i32, i32, i32, ...)*)(double* %0, i32 %1, i32 %2, i32 %3, i32 %4)
%7 = sitofp i32 %6 to double
%8 = tail call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %0, i32 %1, i32 %2)
%9 = tail call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %0, i32 %1, i32 %3)
%10 = add nsw i32 %9, %8
%11 = tail call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %0, i32 %1, i32 %4)
%12 = add nsw i32 %10, %11
%13 = tail call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %0, i32 %2, i32 %3)
%14 = add nsw i32 %12, %13
%15 = tail call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %0, i32 %2, i32 %4)
%16 = add nsw i32 %14, %15
%17 = tail call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %0, i32 %3, i32 %4)
%18 = add nsw i32 %16, %17
%19 = sitofp i32 %18 to double
%20 = fmul double %7, 0x4020F876CCDF6CDA
%21 = fdiv double %20, %19
ret double %21
}