#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 *Cross_lf(double *, double *, double *);
int /*<<< orphan*/ Diff_lf(double *, double *, double *, int);
double Norm_lf(double *, int, int);
double *Normal_lf(double *x, double *y, double *z, double *n_out) {
  double v0[3];
  double v1[3];
  double *normal;
  double inv_mag;
  normal = n_out;
  Diff_lf(y, x, v0, 3);
  Diff_lf(z, x, v1, 3);
  normal = Cross_lf(v0, v1, normal);
  inv_mag = 1.0 / Norm_lf(normal, 3, 2);
  normal[0] *= inv_mag;
  normal[1] *= inv_mag;
  normal[2] *= inv_mag;
  return normal;
}


x86 assembly (clang, -O0):
<Normal_lf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
lea    -0x40(%rbp),%rdx
mov    $0x3,%ecx
call   1050 <Diff_lf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
lea    -0x60(%rbp),%rdx
mov    $0x3,%ecx
call   1050 <Diff_lf@plt>
lea    -0x40(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    -0x68(%rbp),%rdx
call   1040 <Cross_lf@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rdi
mov    $0x3,%esi
mov    $0x2,%edx
call   1030 <Norm_lf@plt>
movaps %xmm0,%xmm1
movsd  0xe51(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
mov    -0x68(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movsd  -0x70(%rbp),%xmm0
mov    -0x68(%rbp),%rax
mulsd  0x8(%rax),%xmm0
movsd  %xmm0,0x8(%rax)
movsd  -0x70(%rbp),%xmm0
mov    -0x68(%rbp),%rax
mulsd  0x10(%rax),%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x68(%rbp),%rax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Normal_lf>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x40,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rdi,%rbx
lea    0x20(%rsp),%r12
mov    %rsi,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    $0x3,%ecx
call   1050 <Diff_lf@plt>
mov    %rsp,%r13
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
mov    $0x3,%ecx
call   1050 <Diff_lf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
call   1040 <Cross_lf@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x3,%esi
mov    $0x2,%edx
call   1030 <Norm_lf@plt>
movsd  0xe61(%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)
mov    %rbx,%rax
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define double* @Normal_lf(double* %0, double* %1, double* %2, double* %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca [3 x double]
%10 = alloca [3 x double]
%11 = alloca double*
%12 = alloca double
store double* %0, double** %5
store double* %1, double** %6
store double* %2, double** %7
store double* %3, double** %8
%13 = load double*, double** %8
store double* %13, double** %11
%14 = load double*, double** %6
%15 = load double*, double** %5
%16 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%17 = call i32 @Diff_lf(double* %14, double* %15, double* %16, i32 3)
%18 = load double*, double** %7
%19 = load double*, double** %5
%20 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 0
%21 = call i32 @Diff_lf(double* %18, double* %19, double* %20, i32 3)
%22 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%23 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 0
%24 = load double*, double** %11
%25 = call double* @Cross_lf(double* %22, double* %23, double* %24)
store double* %25, double** %11
%26 = load double*, double** %11
%27 = call double @Norm_lf(double* %26, i32 3, i32 2)
%28 = fdiv double 1.000000e+00, %27
store double %28, double* %12
%29 = load double, double* %12
%30 = load double*, double** %11
%31 = getelementptr inbounds double, double* %30, i64 0
%32 = load double, double* %31
%33 = fmul double %32, %29
store double %33, double* %31
%34 = load double, double* %12
%35 = load double*, double** %11
%36 = getelementptr inbounds double, double* %35, i64 1
%37 = load double, double* %36
%38 = fmul double %37, %34
store double %38, double* %36
%39 = load double, double* %12
%40 = load double*, double** %11
%41 = getelementptr inbounds double, double* %40, i64 2
%42 = load double, double* %41
%43 = fmul double %42, %39
store double %43, double* %41
%44 = load double*, double** %11
ret double* %44
}

LLVM IR (-O2):
define double* @Normal_lf(double* %0, double* %1, double* %2, double* %3) {
%5 = alloca [3 x double]
%6 = alloca [3 x double]
%7 = bitcast [3 x double]* %5 to i8*
%8 = bitcast [3 x double]* %6 to i8*
%9 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%10 = call i32 @Diff_lf(double* %1, double* %0, double* %9, i32 3)
%11 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%12 = call i32 @Diff_lf(double* %2, double* %0, double* %11, i32 3)
%13 = call double* @Cross_lf(double* %9, double* %11, double* %3)
%14 = call double @Norm_lf(double* %13, i32 3, i32 2)
%15 = fdiv double 1.000000e+00, %14
%16 = bitcast double* %13 to <2 x double>*
%17 = load <2 x double>, <2 x double>* %16
%18 = insertelement <2 x double> poison, double %15, i64 0
%19 = shufflevector <2 x double> %18, <2 x double> poison, <2 x i32> zeroinitializer
%20 = fmul <2 x double> %17, %19
%21 = bitcast double* %13 to <2 x double>*
store <2 x double> %20, <2 x double>* %21
%22 = getelementptr inbounds double, double* %13, i64 2
%23 = load double, double* %22
%24 = fmul double %15, %23
store double %24, double* %22
ret double* %13
}