#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 */
int /*<<< orphan*/ cross(double *, double *, double *);
int /*<<< orphan*/ diff_3d(double *, double *, double *);
double norm_3d(double *);
double p_l_dist(double *p0, double *x0, double *x1) {
  double p[3], x[3], u[3];
  diff_3d(x, x1, x0);
  diff_3d(p, p0, x0);
  cross(u, x, p);
  return norm_3d(u) / norm_3d(x);
}


x86 assembly (clang, -O0):
<p_l_dist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1050 <diff_3d@plt>
lea    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1050 <diff_3d@plt>
lea    -0x70(%rbp),%rdi
lea    -0x50(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1040 <cross@plt>
lea    -0x70(%rbp),%rdi
call   1030 <norm_3d@plt>
movsd  %xmm0,-0x78(%rbp)
lea    -0x50(%rbp),%rdi
call   1030 <norm_3d@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<p_l_dist>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0x30(%rsp),%r15
mov    %r15,%rdi
mov    %rdx,%rsi
mov    %rbx,%rdx
call   1050 <diff_3d@plt>
lea    0x50(%rsp),%r12
mov    %r12,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1050 <diff_3d@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1040 <cross@plt>
mov    %rbx,%rdi
call   1030 <norm_3d@plt>
movsd  %xmm0,0x8(%rsp)
mov    %r15,%rdi
call   1030 <norm_3d@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define double @p_l_dist(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca [3 x double]
%8 = alloca [3 x double]
%9 = alloca [3 x double]
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%10 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%11 = load double*, double** %6
%12 = load double*, double** %5
%13 = call i32 @diff_3d(double* %10, double* %11, double* %12)
%14 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%15 = load double*, double** %4
%16 = load double*, double** %5
%17 = call i32 @diff_3d(double* %14, double* %15, double* %16)
%18 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%19 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%20 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%21 = call i32 @cross(double* %18, double* %19, double* %20)
%22 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%23 = call double @norm_3d(double* %22)
%24 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%25 = call double @norm_3d(double* %24)
%26 = fdiv double %23, %25
ret double %26
}

LLVM IR (-O2):
define double @p_l_dist(double* %0, double* %1, double* %2) {
%4 = alloca [3 x double]
%5 = alloca [3 x double]
%6 = alloca [3 x double]
%7 = bitcast [3 x double]* %4 to i8*
%8 = bitcast [3 x double]* %5 to i8*
%9 = bitcast [3 x double]* %6 to i8*
%10 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%11 = call i32 @diff_3d(double* %10, double* %2, double* %1)
%12 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%13 = call i32 @diff_3d(double* %12, double* %0, double* %1)
%14 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%15 = call i32 @cross(double* %14, double* %10, double* %12)
%16 = call double @norm_3d(double* %14)
%17 = call double @norm_3d(double* %10)
%18 = fdiv double %16, %17
ret double %18
}