#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 sqrt(double);
int /*<<< orphan*/ vector_product(double const *, double const *, double *);
double calculate_volume_factor_2d(const double a[3][3]) {
  double vp[3];
  vector_product(a[0], a[1], vp);
  return sqrt((vp[0] * vp[0] + vp[1] * vp[1] + vp[2] * vp[2]) /
              (a[0][0] * a[0][0] + a[0][1] * a[0][1] + a[0][2] * a[0][2]) /
              (a[1][0] * a[1][0] + a[1][1] * a[1][1] + a[1][2] * a[1][2]));
}


x86 assembly (clang, -O0):
<calculate_volume_factor_2d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    $0x18,%rsi
lea    -0x20(%rbp),%rdx
call   1030 <vector_product@plt>
movsd  -0x20(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm3
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm3
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm1
mov    -0x8(%rbp),%rax
mulsd  0x20(%rax),%xmm1
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
mov    -0x8(%rbp),%rax
movsd  0x28(%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x28(%rax),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate_volume_factor_2d>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rbx
lea    0x18(%rdi),%rsi
mov    %rsp,%rdx
call   1030 <vector_product@plt>
movapd (%rsp),%xmm1
movupd 0x8(%rsp),%xmm0
movhpd 0x8(%rbx),%xmm0
mulpd  %xmm0,%xmm0
movhpd (%rbx),%xmm1
mulpd  %xmm1,%xmm1
addpd  %xmm0,%xmm1
movsd  0x10(%rsp),%xmm0
movhpd 0x10(%rbx),%xmm0
mulpd  %xmm0,%xmm0
addpd  %xmm1,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
divsd  %xmm1,%xmm0
movsd  0x18(%rbx),%xmm1
movsd  0x20(%rbx),%xmm2
mulsd  %xmm2,%xmm2
mulsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
movsd  0x28(%rbx),%xmm2
mulsd  %xmm2,%xmm2
addsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11aa <calculate_volume_factor_2d+0x8a>
sqrtsd %xmm0,%xmm0
jmp    11af <calculate_volume_factor_2d+0x8f>
call   1040 <sqrt@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @calculate_volume_factor_2d([3 x double]* %0) {
%2 = alloca [3 x double]*
%3 = alloca [3 x double]
store [3 x double]* %0, [3 x double]** %2
%4 = load [3 x double]*, [3 x double]** %2
%5 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0
%6 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%7 = load [3 x double]*, [3 x double]** %2
%8 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 1
%9 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%10 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 0
%11 = call i32 @vector_product(double* %6, double* %9, double* %10)
%12 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 0
%13 = load double, double* %12
%14 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 0
%15 = load double, double* %14
%16 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 1
%17 = load double, double* %16
%18 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 1
%19 = load double, double* %18
%20 = fmul double %17, %19
%21 = call double @llvm.fmuladd.f64(double %13, double %15, double %20)
%22 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 2
%23 = load double, double* %22
%24 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 2
%25 = load double, double* %24
%26 = call double @llvm.fmuladd.f64(double %23, double %25, double %21)
%27 = load [3 x double]*, [3 x double]** %2
%28 = getelementptr inbounds [3 x double], [3 x double]* %27, i64 0
%29 = getelementptr inbounds [3 x double], [3 x double]* %28, i64 0, i64 0
%30 = load double, double* %29
%31 = load [3 x double]*, [3 x double]** %2
%32 = getelementptr inbounds [3 x double], [3 x double]* %31, i64 0
%33 = getelementptr inbounds [3 x double], [3 x double]* %32, i64 0, i64 0
%34 = load double, double* %33
%35 = load [3 x double]*, [3 x double]** %2
%36 = getelementptr inbounds [3 x double], [3 x double]* %35, i64 0
%37 = getelementptr inbounds [3 x double], [3 x double]* %36, i64 0, i64 1
%38 = load double, double* %37
%39 = load [3 x double]*, [3 x double]** %2
%40 = getelementptr inbounds [3 x double], [3 x double]* %39, i64 0
%41 = getelementptr inbounds [3 x double], [3 x double]* %40, i64 0, i64 1
%42 = load double, double* %41
%43 = fmul double %38, %42
%44 = call double @llvm.fmuladd.f64(double %30, double %34, double %43)
%45 = load [3 x double]*, [3 x double]** %2
%46 = getelementptr inbounds [3 x double], [3 x double]* %45, i64 0
%47 = getelementptr inbounds [3 x double], [3 x double]* %46, i64 0, i64 2
%48 = load double, double* %47
%49 = load [3 x double]*, [3 x double]** %2
%50 = getelementptr inbounds [3 x double], [3 x double]* %49, i64 0
%51 = getelementptr inbounds [3 x double], [3 x double]* %50, i64 0, i64 2
%52 = load double, double* %51
%53 = call double @llvm.fmuladd.f64(double %48, double %52, double %44)
%54 = fdiv double %26, %53
%55 = load [3 x double]*, [3 x double]** %2
%56 = getelementptr inbounds [3 x double], [3 x double]* %55, i64 1
%57 = getelementptr inbounds [3 x double], [3 x double]* %56, i64 0, i64 0
%58 = load double, double* %57
%59 = load [3 x double]*, [3 x double]** %2
%60 = getelementptr inbounds [3 x double], [3 x double]* %59, i64 1
%61 = getelementptr inbounds [3 x double], [3 x double]* %60, i64 0, i64 0
%62 = load double, double* %61
%63 = load [3 x double]*, [3 x double]** %2
%64 = getelementptr inbounds [3 x double], [3 x double]* %63, i64 1
%65 = getelementptr inbounds [3 x double], [3 x double]* %64, i64 0, i64 1
%66 = load double, double* %65
%67 = load [3 x double]*, [3 x double]** %2
%68 = getelementptr inbounds [3 x double], [3 x double]* %67, i64 1
%69 = getelementptr inbounds [3 x double], [3 x double]* %68, i64 0, i64 1
%70 = load double, double* %69
%71 = fmul double %66, %70
%72 = call double @llvm.fmuladd.f64(double %58, double %62, double %71)
%73 = load [3 x double]*, [3 x double]** %2
%74 = getelementptr inbounds [3 x double], [3 x double]* %73, i64 1
%75 = getelementptr inbounds [3 x double], [3 x double]* %74, i64 0, i64 2
%76 = load double, double* %75
%77 = load [3 x double]*, [3 x double]** %2
%78 = getelementptr inbounds [3 x double], [3 x double]* %77, i64 1
%79 = getelementptr inbounds [3 x double], [3 x double]* %78, i64 0, i64 2
%80 = load double, double* %79
%81 = call double @llvm.fmuladd.f64(double %76, double %80, double %72)
%82 = fdiv double %54, %81
%83 = call double @sqrt(double %82)
ret double %83
}

LLVM IR (-O2):
define double @calculate_volume_factor_2d([3 x double]* %0) {
%2 = alloca [3 x double]
%3 = bitcast [3 x double]* %2 to i8*
%4 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 0
%5 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 0
%6 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 0
%7 = call i32 @vector_product(double* %4, double* %5, double* %6)
%8 = bitcast [3 x double]* %2 to <2 x double>*
%9 = load <2 x double>, <2 x double>* %8
%10 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 1
%11 = bitcast double* %10 to <2 x double>*
%12 = load <2 x double>, <2 x double>* %11
%13 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 2
%14 = load double, double* %13
%15 = load double, double* %4
%16 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 1
%17 = load double, double* %16
%18 = insertelement <2 x double> %12, double %17, i64 1
%19 = fmul <2 x double> %18, %18
%20 = insertelement <2 x double> %9, double %15, i64 1
%21 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %20, <2 x double> %20, <2 x double> %19)
%22 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 2
%23 = load double, double* %22
%24 = insertelement <2 x double> poison, double %14, i64 0
%25 = insertelement <2 x double> %24, double %23, i64 1
%26 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %25, <2 x double> %25, <2 x double> %21)
%27 = extractelement <2 x double> %26, i64 0
%28 = extractelement <2 x double> %26, i64 1
%29 = fdiv double %27, %28
%30 = load double, double* %5
%31 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 1
%32 = load double, double* %31
%33 = fmul double %32, %32
%34 = call double @llvm.fmuladd.f64(double %30, double %30, double %33)
%35 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 2
%36 = load double, double* %35
%37 = call double @llvm.fmuladd.f64(double %36, double %36, double %34)
%38 = fdiv double %29, %37
%39 = call double @sqrt(double %38)
ret double %39
}