long double qual_delta(double *vertex, int v1, int v2, int v3, int v4,
                       double delta) {
  long 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):
<qual_delta>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%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
xor    %eax,%eax
mov    %al,-0x7d(%rbp)
call   1040 <det3i4@plt>
mov    %eax,-0x58(%rbp)
fildl  -0x58(%rbp)
fstpt  -0x30(%rbp)
fldt   -0x30(%rbp)
fld    %st(0)
fstpt  -0x9c(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  0xe73(%rip),%xmm2
movaps %xmm1,%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
fldl   -0x60(%rbp)
fxch   %st(1)
fmul   %st,%st(0)
faddp  %st,%st(1)
fstpl  -0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
call   1050 <sqrt@plt>
fldt   -0x9c(%rbp)
mov    -0x7d(%rbp),%al
movsd  %xmm0,-0x70(%rbp)
fldl   -0x70(%rbp)
faddp  %st,%st(1)
flds   0xe4c(%rip)
fdivrp %st,%st(1)
fstpt  -0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <ldisti@plt>
mov    %eax,%ecx
mov    -0x7d(%rbp),%al
mov    %ecx,-0x90(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <ldisti@plt>
mov    -0x90(%rbp),%ecx
mov    %eax,%edx
mov    -0x7d(%rbp),%al
add    %edx,%ecx
mov    %ecx,-0x8c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <ldisti@plt>
mov    -0x8c(%rbp),%ecx
mov    %eax,%edx
mov    -0x7d(%rbp),%al
add    %edx,%ecx
mov    %ecx,-0x88(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <ldisti@plt>
mov    -0x88(%rbp),%ecx
mov    %eax,%edx
mov    -0x7d(%rbp),%al
add    %edx,%ecx
mov    %ecx,-0x84(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <ldisti@plt>
mov    -0x84(%rbp),%ecx
mov    %eax,%edx
mov    -0x7d(%rbp),%al
add    %edx,%ecx
mov    %ecx,-0x7c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <ldisti@plt>
mov    %eax,%ecx
mov    -0x7c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x54(%rbp)
fildl  -0x54(%rbp)
fstpt  -0x40(%rbp)
movsd  0xd71(%rip),%xmm0
call   1050 <sqrt@plt>
movsd  0xd6c(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
fldl   -0x78(%rbp)
fldt   -0x30(%rbp)
fmulp  %st,%st(1)
fldt   -0x40(%rbp)
fdivrp %st,%st(1)
fstpt  -0x50(%rbp)
fldt   -0x50(%rbp)
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qual_delta>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
movsd  %xmm0,(%rsp)
mov    %ecx,%r12d
mov    %edx,%ebp
mov    %esi,%r13d
mov    %rdi,%r15
mov    %r8d,0x14(%rsp)
xor    %eax,%eax
call   1040 <det3i4@plt>
mov    %eax,0x1c(%rsp)
fildl  0x1c(%rsp)
movsd  0xe96(%rip),%xmm0
movsd  (%rsp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x30(%rsp)
fld    %st(0)
fmul   %st(1),%st
faddl  0x30(%rsp)
fstpl  0x28(%rsp)
movsd  0x28(%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     119f <qual_delta+0x6f>
sqrtsd %xmm0,%xmm0
jmp    11aa <qual_delta+0x7a>
fstpt  (%rsp)
call   1050 <sqrt@plt>
fldt   (%rsp)
movsd  %xmm0,0x20(%rsp)
faddl  0x20(%rsp)
fmuls  0xe56(%rip)
fstpt  (%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
mov    %eax,0x18(%rsp)
fldt   (%rsp)
fmull  0xdb9(%rip)
fidivl 0x18(%rsp)
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define x86_fp80 @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 x86_fp80
%14 = alloca x86_fp80
%15 = alloca x86_fp80
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 x86_fp80
store x86_fp80 %22, x86_fp80* %13
%23 = load x86_fp80, x86_fp80* %13
%24 = load x86_fp80, x86_fp80* %13
%25 = load x86_fp80, x86_fp80* %13
%26 = load double, double* %12
%27 = fmul double 4.000000e+00, %26
%28 = load double, double* %12
%29 = fmul double %27, %28
%30 = fpext double %29 to x86_fp80
%31 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %24, x86_fp80 %25, x86_fp80 %30)
%32 = fptrunc x86_fp80 %31 to double
%33 = call double @sqrt(double %32)
%34 = fpext double %33 to x86_fp80
%35 = fadd x86_fp80 %23, %34
%36 = fdiv x86_fp80 %35, 0xK40008000000000000000
store x86_fp80 %36, x86_fp80* %13
%37 = load double*, double** %7
%38 = load i32, i32* %8
%39 = load i32, i32* %9
%40 = call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %37, i32 %38, i32 %39)
%41 = load double*, double** %7
%42 = load i32, i32* %8
%43 = load i32, i32* %10
%44 = call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %41, i32 %42, i32 %43)
%45 = add nsw i32 %40, %44
%46 = load double*, double** %7
%47 = load i32, i32* %8
%48 = load i32, i32* %11
%49 = call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %46, i32 %47, i32 %48)
%50 = add nsw i32 %45, %49
%51 = load double*, double** %7
%52 = load i32, i32* %9
%53 = load i32, i32* %10
%54 = call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %51, i32 %52, i32 %53)
%55 = add nsw i32 %50, %54
%56 = load double*, double** %7
%57 = load i32, i32* %9
%58 = load i32, i32* %11
%59 = call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %56, i32 %57, i32 %58)
%60 = add nsw i32 %55, %59
%61 = load double*, double** %7
%62 = load i32, i32* %10
%63 = load i32, i32* %11
%64 = call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @ldisti to i32 (double*, i32, i32, ...)*)(double* %61, i32 %62, i32 %63)
%65 = add nsw i32 %60, %64
%66 = sitofp i32 %65 to x86_fp80
store x86_fp80 %66, x86_fp80* %14
%67 = call double @sqrt(double 2.000000e+00)
%68 = fmul double 6.000000e+00, %67
%69 = fpext double %68 to x86_fp80
%70 = load x86_fp80, x86_fp80* %13
%71 = fmul x86_fp80 %69, %70
%72 = load x86_fp80, x86_fp80* %14
%73 = fdiv x86_fp80 %71, %72
store x86_fp80 %73, x86_fp80* %15
%74 = load x86_fp80, x86_fp80* %15
ret x86_fp80 %74
}

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