#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 getLocalNormal_tria3(double X[3][3], double *normal) {
  double dx1, dx2, dy1, dy2, dz1, dz2, normalmod;
  dx1 = X[0][0] - X[2][0];
  dx2 = X[1][0] - X[2][0];
  dy1 = X[0][1] - X[2][1];
  dy2 = X[1][1] - X[2][1];
  dz1 = X[0][2] - X[2][2];
  dz2 = X[1][2] - X[2][2];
  normal[0] = dy1 * dz2 - dy2 * dz1;
  normal[1] = dx2 * dz1 - dx1 * dz2;
  normal[2] = dx1 * dy2 - dx2 * dy1;
  normalmod = 1.0 / sqrt(normal[0] * normal[0] + normal[1] * normal[1] +
                         normal[2] * normal[2]);
  normal[0] = normal[0] * normalmod;
  normal[1] = normal[1] * normalmod;
  normal[2] = normal[2] * normalmod;
  return 0;
}


x86 assembly (clang, -O0):
<getLocalNormal_tria3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x30(%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x30(%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x38(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x38(%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x40(%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x28(%rax),%xmm0
mov    -0x8(%rbp),%rax
subsd  0x40(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x20(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x18(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xd50(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mulsd  -0x48(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mulsd  -0x48(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mulsd  -0x48(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getLocalNormal_tria3>:
push   %rbx
mov    %rsi,%rbx
movupd 0x30(%rdi),%xmm0
shufpd $0x1,%xmm0,%xmm0
movsd  0x8(%rdi),%xmm2
movsd  0x20(%rdi),%xmm1
movsd  0x28(%rdi),%xmm3
movhpd 0x18(%rdi),%xmm2
subpd  %xmm0,%xmm2
movhpd (%rdi),%xmm1
movhpd 0x10(%rdi),%xmm3
subpd  %xmm0,%xmm1
movsd  0x40(%rdi),%xmm0
unpcklpd %xmm0,%xmm0
subpd  %xmm0,%xmm3
movapd %xmm2,%xmm4
unpckhpd %xmm2,%xmm4
mulsd  %xmm2,%xmm4
mulpd  %xmm3,%xmm2
shufpd $0x1,%xmm3,%xmm3
mulpd  %xmm1,%xmm3
subpd  %xmm3,%xmm2
movupd %xmm2,(%rsi)
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
mulsd  %xmm1,%xmm0
subsd  %xmm4,%xmm0
movsd  %xmm0,0x10(%rsi)
movapd %xmm2,%xmm1
mulpd  %xmm2,%xmm1
unpckhpd %xmm1,%xmm1
mulsd  %xmm2,%xmm2
addsd  %xmm1,%xmm2
mulsd  %xmm0,%xmm0
addsd  %xmm2,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11b2 <getLocalNormal_tria3+0xa2>
sqrtsd %xmm0,%xmm0
jmp    11b7 <getLocalNormal_tria3+0xa7>
call   1030 <sqrt@plt>
movsd  0xe41(%rip),%xmm1
divsd  %xmm0,%xmm1
movupd (%rbx),%xmm0
movapd %xmm1,%xmm2
unpcklpd %xmm1,%xmm2
mulpd  %xmm0,%xmm2
movupd %xmm2,(%rbx)
mulsd  0x10(%rbx),%xmm1
movsd  %xmm1,0x10(%rbx)
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @getLocalNormal_tria3([3 x double]* %0, double* %1) {
%3 = alloca [3 x double]*
%4 = alloca double*
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
store [3 x double]* %0, [3 x double]** %3
store double* %1, double** %4
%12 = load [3 x double]*, [3 x double]** %3
%13 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 0
%14 = getelementptr inbounds [3 x double], [3 x double]* %13, i64 0, i64 0
%15 = load double, double* %14
%16 = load [3 x double]*, [3 x double]** %3
%17 = getelementptr inbounds [3 x double], [3 x double]* %16, i64 2
%18 = getelementptr inbounds [3 x double], [3 x double]* %17, i64 0, i64 0
%19 = load double, double* %18
%20 = fsub double %15, %19
store double %20, double* %5
%21 = load [3 x double]*, [3 x double]** %3
%22 = getelementptr inbounds [3 x double], [3 x double]* %21, i64 1
%23 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 0
%24 = load double, double* %23
%25 = load [3 x double]*, [3 x double]** %3
%26 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 2
%27 = getelementptr inbounds [3 x double], [3 x double]* %26, i64 0, i64 0
%28 = load double, double* %27
%29 = fsub double %24, %28
store double %29, double* %6
%30 = load [3 x double]*, [3 x double]** %3
%31 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0
%32 = getelementptr inbounds [3 x double], [3 x double]* %31, i64 0, i64 1
%33 = load double, double* %32
%34 = load [3 x double]*, [3 x double]** %3
%35 = getelementptr inbounds [3 x double], [3 x double]* %34, i64 2
%36 = getelementptr inbounds [3 x double], [3 x double]* %35, i64 0, i64 1
%37 = load double, double* %36
%38 = fsub double %33, %37
store double %38, double* %7
%39 = load [3 x double]*, [3 x double]** %3
%40 = getelementptr inbounds [3 x double], [3 x double]* %39, i64 1
%41 = getelementptr inbounds [3 x double], [3 x double]* %40, i64 0, i64 1
%42 = load double, double* %41
%43 = load [3 x double]*, [3 x double]** %3
%44 = getelementptr inbounds [3 x double], [3 x double]* %43, i64 2
%45 = getelementptr inbounds [3 x double], [3 x double]* %44, i64 0, i64 1
%46 = load double, double* %45
%47 = fsub double %42, %46
store double %47, double* %8
%48 = load [3 x double]*, [3 x double]** %3
%49 = getelementptr inbounds [3 x double], [3 x double]* %48, i64 0
%50 = getelementptr inbounds [3 x double], [3 x double]* %49, i64 0, i64 2
%51 = load double, double* %50
%52 = load [3 x double]*, [3 x double]** %3
%53 = getelementptr inbounds [3 x double], [3 x double]* %52, i64 2
%54 = getelementptr inbounds [3 x double], [3 x double]* %53, i64 0, i64 2
%55 = load double, double* %54
%56 = fsub double %51, %55
store double %56, double* %9
%57 = load [3 x double]*, [3 x double]** %3
%58 = getelementptr inbounds [3 x double], [3 x double]* %57, i64 1
%59 = getelementptr inbounds [3 x double], [3 x double]* %58, i64 0, i64 2
%60 = load double, double* %59
%61 = load [3 x double]*, [3 x double]** %3
%62 = getelementptr inbounds [3 x double], [3 x double]* %61, i64 2
%63 = getelementptr inbounds [3 x double], [3 x double]* %62, i64 0, i64 2
%64 = load double, double* %63
%65 = fsub double %60, %64
store double %65, double* %10
%66 = load double, double* %7
%67 = load double, double* %10
%68 = load double, double* %8
%69 = load double, double* %9
%70 = fmul double %68, %69
%71 = fneg double %70
%72 = call double @llvm.fmuladd.f64(double %66, double %67, double %71)
%73 = load double*, double** %4
%74 = getelementptr inbounds double, double* %73, i64 0
store double %72, double* %74
%75 = load double, double* %6
%76 = load double, double* %9
%77 = load double, double* %5
%78 = load double, double* %10
%79 = fmul double %77, %78
%80 = fneg double %79
%81 = call double @llvm.fmuladd.f64(double %75, double %76, double %80)
%82 = load double*, double** %4
%83 = getelementptr inbounds double, double* %82, i64 1
store double %81, double* %83
%84 = load double, double* %5
%85 = load double, double* %8
%86 = load double, double* %6
%87 = load double, double* %7
%88 = fmul double %86, %87
%89 = fneg double %88
%90 = call double @llvm.fmuladd.f64(double %84, double %85, double %89)
%91 = load double*, double** %4
%92 = getelementptr inbounds double, double* %91, i64 2
store double %90, double* %92
%93 = load double*, double** %4
%94 = getelementptr inbounds double, double* %93, i64 0
%95 = load double, double* %94
%96 = load double*, double** %4
%97 = getelementptr inbounds double, double* %96, i64 0
%98 = load double, double* %97
%99 = load double*, double** %4
%100 = getelementptr inbounds double, double* %99, i64 1
%101 = load double, double* %100
%102 = load double*, double** %4
%103 = getelementptr inbounds double, double* %102, i64 1
%104 = load double, double* %103
%105 = fmul double %101, %104
%106 = call double @llvm.fmuladd.f64(double %95, double %98, double %105)
%107 = load double*, double** %4
%108 = getelementptr inbounds double, double* %107, i64 2
%109 = load double, double* %108
%110 = load double*, double** %4
%111 = getelementptr inbounds double, double* %110, i64 2
%112 = load double, double* %111
%113 = call double @llvm.fmuladd.f64(double %109, double %112, double %106)
%114 = call double @sqrt(double %113)
%115 = fdiv double 1.000000e+00, %114
store double %115, double* %11
%116 = load double*, double** %4
%117 = getelementptr inbounds double, double* %116, i64 0
%118 = load double, double* %117
%119 = load double, double* %11
%120 = fmul double %118, %119
%121 = load double*, double** %4
%122 = getelementptr inbounds double, double* %121, i64 0
store double %120, double* %122
%123 = load double*, double** %4
%124 = getelementptr inbounds double, double* %123, i64 1
%125 = load double, double* %124
%126 = load double, double* %11
%127 = fmul double %125, %126
%128 = load double*, double** %4
%129 = getelementptr inbounds double, double* %128, i64 1
store double %127, double* %129
%130 = load double*, double** %4
%131 = getelementptr inbounds double, double* %130, i64 2
%132 = load double, double* %131
%133 = load double, double* %11
%134 = fmul double %132, %133
%135 = load double*, double** %4
%136 = getelementptr inbounds double, double* %135, i64 2
store double %134, double* %136
ret i32 0
}

LLVM IR (-O2):
define i32 @getLocalNormal_tria3([3 x double]* nocapture %0, double* nocapture %1) {
%3 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 0
%4 = load double, double* %3
%5 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 0
%6 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 0
%7 = load double, double* %6
%8 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 1
%9 = load double, double* %8
%10 = bitcast double* %5 to <2 x double>*
%11 = load <2 x double>, <2 x double>* %10
%12 = shufflevector <2 x double> %11, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%13 = insertelement <2 x double> poison, double %9, i64 0
%14 = insertelement <2 x double> %13, double %7, i64 1
%15 = fsub <2 x double> %14, %12
%16 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 1
%17 = load double, double* %16
%18 = insertelement <2 x double> poison, double %17, i64 0
%19 = insertelement <2 x double> %18, double %4, i64 1
%20 = fsub <2 x double> %19, %12
%21 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 2
%22 = load double, double* %21
%23 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 2
%24 = load double, double* %23
%25 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 2
%26 = load double, double* %25
%27 = insertelement <2 x double> poison, double %26, i64 0
%28 = insertelement <2 x double> %27, double %22, i64 1
%29 = insertelement <2 x double> poison, double %24, i64 0
%30 = shufflevector <2 x double> %29, <2 x double> poison, <2 x i32> zeroinitializer
%31 = fsub <2 x double> %28, %30
%32 = fneg <2 x double> %20
%33 = shufflevector <2 x double> %31, <2 x double> undef, <2 x i32> <i32 1, i32 0>
%34 = fmul <2 x double> %33, %32
%35 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %15, <2 x double> %31, <2 x double> %34)
%36 = bitcast double* %1 to <2 x double>*
store <2 x double> %35, <2 x double>* %36
%37 = extractelement <2 x double> %15, i64 1
%38 = fneg double %37
%39 = extractelement <2 x double> %15, i64 0
%40 = fmul double %39, %38
%41 = extractelement <2 x double> %20, i64 0
%42 = extractelement <2 x double> %20, i64 1
%43 = tail call double @llvm.fmuladd.f64(double %42, double %41, double %40)
%44 = getelementptr inbounds double, double* %1, i64 2
store double %43, double* %44
%45 = fmul <2 x double> %35, %35
%46 = extractelement <2 x double> %45, i64 1
%47 = extractelement <2 x double> %35, i64 0
%48 = tail call double @llvm.fmuladd.f64(double %47, double %47, double %46)
%49 = tail call double @llvm.fmuladd.f64(double %43, double %43, double %48)
%50 = tail call double @sqrt(double %49)
%51 = fdiv double 1.000000e+00, %50
%52 = bitcast double* %1 to <2 x double>*
%53 = load <2 x double>, <2 x double>* %52
%54 = insertelement <2 x double> poison, double %51, i64 0
%55 = shufflevector <2 x double> %54, <2 x double> poison, <2 x i32> zeroinitializer
%56 = fmul <2 x double> %53, %55
%57 = bitcast double* %1 to <2 x double>*
store <2 x double> %56, <2 x double>* %57
%58 = load double, double* %44
%59 = fmul double %51, %58
store double %59, double* %44
ret i32 0
}