double aft_tetra_qual_delta(double *vertex, int v1, int v2, int v3, int v4,
                            double delta) {
  double v, ls, q;
  v = det3i4(vertex, v1, v2, v3, v4);
  v = (v + sqrt(v * v + 4.0 * delta * delta)) / 2.0;
  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_delta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
movsd  %xmm0,-0x20(%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,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  0xe85(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  0xe52(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    $0x0,%al
call   1030 <ldisti@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    $0x0,%al
call   1030 <ldisti@plt>
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x48(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    $0x0,%al
call   1030 <ldisti@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x44(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%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    -0x10(%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    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    $0x0,%al
call   1030 <ldisti@plt>
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
add    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xda0(%rip),%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xd88(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  -0x28(%rbp),%xmm0
divsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aft_tetra_qual_delta>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movsd  %xmm0,0x8(%rsp)
mov    %ecx,%r12d
mov    %edx,%ebp
mov    %esi,%r13d
mov    %rdi,%r15
mov    %r8d,0x14(%rsp)
xor    %eax,%eax
call   1040 <det3i4@plt>
cvtsi2sd %eax,%xmm2
movsd  0xe99(%rip),%xmm1
movsd  0x8(%rsp),%xmm0
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm2,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1191 <aft_tetra_qual_delta+0x61>
sqrtsd %xmm0,%xmm0
jmp    11a2 <aft_tetra_qual_delta+0x72>
movsd  %xmm2,0x8(%rsp)
call   1050 <sqrt@plt>
movsd  0x8(%rsp),%xmm2
addsd  %xmm2,%xmm0
mulsd  0xe5a(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r15,%rdi
mov    %r13d,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <ldisti@plt>
mov    %ebp,0x10(%rsp)
mov    %eax,%ebp
mov    %r15,%rdi
mov    %r13d,%esi
mov    %r12d,%edx
xor    %eax,%eax
call   1030 <ldisti@plt>
mov    %eax,%r14d
add    %ebp,%r14d
mov    %r15,%rdi
mov    %r13d,%esi
mov    0x14(%rsp),%ebx
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <ldisti@plt>
mov    %eax,%ebp
add    %r14d,%ebp
mov    %r15,%rdi
mov    0x10(%rsp),%r13d
mov    %r13d,%esi
mov    %r12d,%edx
xor    %eax,%eax
call   1030 <ldisti@plt>
mov    %ebx,%r14d
mov    %eax,%ebx
add    %ebp,%ebx
mov    %r15,%rdi
mov    %r13d,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1030 <ldisti@plt>
mov    %eax,%ebp
add    %ebx,%ebp
mov    %r15,%rdi
mov    %r12d,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1030 <ldisti@plt>
add    %ebp,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  0x8(%rsp),%xmm0
mulsd  0xdc2(%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_delta(double* %0, i32 %1, i32 %2, i32 %3, i32 %4, double %5) {
%7 = alloca double*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
store double* %0, double** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store double %5, double* %12
%16 = load double*, double** %7
%17 = load i32, i32* %8
%18 = load i32, i32* %9
%19 = load i32, i32* %10
%20 = load i32, i32* %11
%21 = call i32 (double*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @det3i4 to i32 (double*, i32, i32, i32, i32, ...)*)(double* %16, i32 %17, i32 %18, i32 %19, i32 %20)
%22 = sitofp i32 %21 to double
store double %22, double* %13
%23 = load double, double* %13
%24 = load double, double* %13
%25 = load double, double* %13
%26 = load double, double* %12
%27 = fmul double 4.000000e+00, %26
%28 = load double, double* %12
%29 = fmul double %27, %28
%30 = call double @llvm.fmuladd.f64(double %24, double %25, double %29)
%31 = call double @sqrt(double %30)
%32 = fadd double %23, %31
%33 = fdiv double %32, 2.000000e+00
store double %33, double* %13
%34 = load double*, double** %7
%35 = load i32, i32* %8
%36 = load i32, i32* %9
%37 = call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %34, i32 %35, i32 %36)
%38 = load double*, double** %7
%39 = load i32, i32* %8
%40 = load i32, i32* %10
%41 = call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %38, i32 %39, i32 %40)
%42 = add nsw i32 %37, %41
%43 = load double*, double** %7
%44 = load i32, i32* %8
%45 = load i32, i32* %11
%46 = call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %43, i32 %44, i32 %45)
%47 = add nsw i32 %42, %46
%48 = load double*, double** %7
%49 = load i32, i32* %9
%50 = load i32, i32* %10
%51 = call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %48, i32 %49, i32 %50)
%52 = add nsw i32 %47, %51
%53 = load double*, double** %7
%54 = load i32, i32* %9
%55 = load i32, i32* %11
%56 = call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %53, i32 %54, i32 %55)
%57 = add nsw i32 %52, %56
%58 = load double*, double** %7
%59 = load i32, i32* %10
%60 = load i32, i32* %11
%61 = call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %58, i32 %59, i32 %60)
%62 = add nsw i32 %57, %61
%63 = sitofp i32 %62 to double
store double %63, double* %14
%64 = call double @sqrt(double 2.000000e+00)
%65 = fmul double 6.000000e+00, %64
%66 = load double, double* %13
%67 = fmul double %65, %66
%68 = load double, double* %14
%69 = fdiv double %67, %68
store double %69, double* %15
%70 = load double, double* %15
ret double %70
}

LLVM IR (-O2):
define double @aft_tetra_qual_delta(double* %0, i32 %1, i32 %2, i32 %3, i32 %4, double %5) {
%7 = 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)
%8 = sitofp i32 %7 to double
%9 = fmul double %5, 4.000000e+00
%10 = fmul double %9, %5
%11 = tail call double @llvm.fmuladd.f64(double %8, double %8, double %10)
%12 = tail call double @sqrt(double %11)
%13 = fadd double %12, %8
%14 = fmul double %13, 5.000000e-01
%15 = tail call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %0, i32 %1, i32 %2)
%16 = tail call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %0, i32 %1, i32 %3)
%17 = add nsw i32 %16, %15
%18 = tail call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %0, i32 %1, i32 %4)
%19 = add nsw i32 %17, %18
%20 = tail call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %0, i32 %2, i32 %3)
%21 = add nsw i32 %19, %20
%22 = tail call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %0, i32 %2, i32 %4)
%23 = add nsw i32 %21, %22
%24 = tail call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %0, i32 %3, i32 %4)
%25 = add nsw i32 %23, %24
%26 = sitofp i32 %25 to double
%27 = fmul double %14, 0x4020F876CCDF6CDA
%28 = fdiv double %27, %26
ret double %28
}