#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 */
float sqrt(float);
float CalcLineSize(float pp[3], float lp[3]) {
  float vec[3];
  vec[0] = lp[0] - pp[0];
  vec[1] = lp[1] - pp[1];
  vec[2] = lp[2] - pp[2];
  return sqrt(vec[0] * vec[0] + vec[1] * vec[1] + vec[2] * vec[2]);
}


x86 assembly (clang, -O0):
<CalcLineSize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
subss  (%rax),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x8(%rbp),%rax
subss  0x4(%rax),%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
subss  0x8(%rax),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x1c(%rbp),%xmm1
movss  -0x1c(%rbp),%xmm2
movss  -0x18(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
movss  -0x14(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <sqrt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CalcLineSize>:
movss  (%rsi),%xmm1
movss  0x4(%rsi),%xmm2
subss  (%rdi),%xmm1
subss  0x4(%rdi),%xmm2
movss  0x8(%rsi),%xmm0
subss  0x8(%rdi),%xmm0
mulss  %xmm2,%xmm2
mulss  %xmm1,%xmm1
addss  %xmm2,%xmm1
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     114d <CalcLineSize+0x3d>
sqrtss %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define float @CalcLineSize(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
%5 = alloca [3 x float]
store float* %0, float** %3
store float* %1, float** %4
%6 = load float*, float** %4
%7 = getelementptr inbounds float, float* %6, i64 0
%8 = load float, float* %7
%9 = load float*, float** %3
%10 = getelementptr inbounds float, float* %9, i64 0
%11 = load float, float* %10
%12 = fsub float %8, %11
%13 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 0
store float %12, float* %13
%14 = load float*, float** %4
%15 = getelementptr inbounds float, float* %14, i64 1
%16 = load float, float* %15
%17 = load float*, float** %3
%18 = getelementptr inbounds float, float* %17, i64 1
%19 = load float, float* %18
%20 = fsub float %16, %19
%21 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 1
store float %20, float* %21
%22 = load float*, float** %4
%23 = getelementptr inbounds float, float* %22, i64 2
%24 = load float, float* %23
%25 = load float*, float** %3
%26 = getelementptr inbounds float, float* %25, i64 2
%27 = load float, float* %26
%28 = fsub float %24, %27
%29 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 2
store float %28, float* %29
%30 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 0
%31 = load float, float* %30
%32 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 0
%33 = load float, float* %32
%34 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 1
%35 = load float, float* %34
%36 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 1
%37 = load float, float* %36
%38 = fmul float %35, %37
%39 = call float @llvm.fmuladd.f32(float %31, float %33, float %38)
%40 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 2
%41 = load float, float* %40
%42 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 2
%43 = load float, float* %42
%44 = call float @llvm.fmuladd.f32(float %41, float %43, float %39)
%45 = call float @sqrt(float %44)
ret float %45
}

LLVM IR (-O2):
define float @CalcLineSize(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %1
%4 = load float, float* %0
%5 = fsub float %3, %4
%6 = getelementptr inbounds float, float* %1, i64 1
%7 = load float, float* %6
%8 = getelementptr inbounds float, float* %0, i64 1
%9 = load float, float* %8
%10 = fsub float %7, %9
%11 = getelementptr inbounds float, float* %1, i64 2
%12 = load float, float* %11
%13 = getelementptr inbounds float, float* %0, i64 2
%14 = load float, float* %13
%15 = fsub float %12, %14
%16 = fmul float %10, %10
%17 = tail call float @llvm.fmuladd.f32(float %5, float %5, float %16)
%18 = tail call float @llvm.fmuladd.f32(float %15, float %15, float %17)
%19 = tail call float @sqrt(float %18)
ret float %19
}