#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 det3i4(double *, int, int, int, int);
int /*<<< orphan*/ dist3i(double *, int, int);
double pow(int /*<<< orphan*/, int);
double sqrt(double);
double tqual(double *vertex, int v1, int v2, int v3, int v4) {
  double v, ls, q;
  v = det3i4(vertex, v1, v2, v3, v4);
  ls = (pow(dist3i(vertex, v1, v2), 3)) + (pow(dist3i(vertex, v1, v3), 3)) +
       (pow(dist3i(vertex, v1, v4), 3)) + (pow(dist3i(vertex, v2, v3), 3)) +
       (pow(dist3i(vertex, v2, v4), 3)) + (pow(dist3i(vertex, v3, v4), 3));
  q = 6.0 * sqrt(2.0) * v / ls;
  return q;
}


x86 assembly (clang, -O0):
<tqual>:
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)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
call   1040 <det3i4@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <dist3i@plt>
mov    %eax,%edi
mov    $0x3,%esi
call   1050 <pow@plt>
movsd  %xmm0,-0x58(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <dist3i@plt>
mov    %eax,%edi
mov    $0x3,%esi
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <dist3i@plt>
mov    %eax,%edi
mov    $0x3,%esi
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <dist3i@plt>
mov    %eax,%edi
mov    $0x3,%esi
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <dist3i@plt>
mov    %eax,%edi
mov    $0x3,%esi
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <dist3i@plt>
mov    %eax,%edi
mov    $0x3,%esi
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xd90(%rip),%xmm0
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xd78(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  -0x20(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tqual>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %r8d,%r14d
mov    %ecx,%r15d
mov    %edx,%r12d
mov    %esi,%ebp
mov    %rdi,%rbx
call   1040 <det3i4@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r12d,%edx
call   1030 <dist3i@plt>
mov    %eax,%edi
mov    $0x3,%esi
call   1050 <pow@plt>
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r15d,%edx
call   1030 <dist3i@plt>
mov    %eax,%edi
mov    $0x3,%esi
call   1050 <pow@plt>
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <dist3i@plt>
mov    %eax,%edi
mov    $0x3,%esi
call   1050 <pow@plt>
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %r15d,%edx
call   1030 <dist3i@plt>
mov    %eax,%edi
mov    $0x3,%esi
call   1050 <pow@plt>
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %r14d,%edx
call   1030 <dist3i@plt>
mov    %eax,%edi
mov    $0x3,%esi
call   1050 <pow@plt>
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r14d,%edx
call   1030 <dist3i@plt>
mov    %eax,%edi
mov    $0x3,%esi
call   1050 <pow@plt>
addsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  0xdd2(%rip),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @tqual(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 double @det3i4(double* %14, i32 %15, i32 %16, i32 %17, i32 %18)
store double %19, double* %11
%20 = load double*, double** %6
%21 = load i32, i32* %7
%22 = load i32, i32* %8
%23 = call i32 @dist3i(double* %20, i32 %21, i32 %22)
%24 = call double @pow(i32 %23, i32 3)
%25 = load double*, double** %6
%26 = load i32, i32* %7
%27 = load i32, i32* %9
%28 = call i32 @dist3i(double* %25, i32 %26, i32 %27)
%29 = call double @pow(i32 %28, i32 3)
%30 = fadd double %24, %29
%31 = load double*, double** %6
%32 = load i32, i32* %7
%33 = load i32, i32* %10
%34 = call i32 @dist3i(double* %31, i32 %32, i32 %33)
%35 = call double @pow(i32 %34, i32 3)
%36 = fadd double %30, %35
%37 = load double*, double** %6
%38 = load i32, i32* %8
%39 = load i32, i32* %9
%40 = call i32 @dist3i(double* %37, i32 %38, i32 %39)
%41 = call double @pow(i32 %40, i32 3)
%42 = fadd double %36, %41
%43 = load double*, double** %6
%44 = load i32, i32* %8
%45 = load i32, i32* %10
%46 = call i32 @dist3i(double* %43, i32 %44, i32 %45)
%47 = call double @pow(i32 %46, i32 3)
%48 = fadd double %42, %47
%49 = load double*, double** %6
%50 = load i32, i32* %9
%51 = load i32, i32* %10
%52 = call i32 @dist3i(double* %49, i32 %50, i32 %51)
%53 = call double @pow(i32 %52, i32 3)
%54 = fadd double %48, %53
store double %54, double* %12
%55 = call double @sqrt(double 2.000000e+00)
%56 = fmul double 6.000000e+00, %55
%57 = load double, double* %11
%58 = fmul double %56, %57
%59 = load double, double* %12
%60 = fdiv double %58, %59
store double %60, double* %13
%61 = load double, double* %13
ret double %61
}

LLVM IR (-O2):
define double @tqual(double* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call double @det3i4(double* %0, i32 %1, i32 %2, i32 %3, i32 %4)
%7 = tail call i32 @dist3i(double* %0, i32 %1, i32 %2)
%8 = tail call double @pow(i32 %7, i32 3)
%9 = tail call i32 @dist3i(double* %0, i32 %1, i32 %3)
%10 = tail call double @pow(i32 %9, i32 3)
%11 = fadd double %8, %10
%12 = tail call i32 @dist3i(double* %0, i32 %1, i32 %4)
%13 = tail call double @pow(i32 %12, i32 3)
%14 = fadd double %11, %13
%15 = tail call i32 @dist3i(double* %0, i32 %2, i32 %3)
%16 = tail call double @pow(i32 %15, i32 3)
%17 = fadd double %14, %16
%18 = tail call i32 @dist3i(double* %0, i32 %2, i32 %4)
%19 = tail call double @pow(i32 %18, i32 3)
%20 = fadd double %17, %19
%21 = tail call i32 @dist3i(double* %0, i32 %3, i32 %4)
%22 = tail call double @pow(i32 %21, i32 3)
%23 = fadd double %20, %22
%24 = fmul double %6, 0x4020F876CCDF6CDA
%25 = fdiv double %24, %23
ret double %25
}