#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 sqrtf(float);
float c_vector3_distance(const float *a, const float *b) {
  float dx = b[0] - a[0];
  float dy = b[1] - a[1];
  float dz = b[2] - a[2];
  return sqrtf(dx * dx + dy * dy + dz * dz);
}


x86 assembly (clang, -O0):
<c_vector3_distance>:
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,-0x14(%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,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
movss  -0x18(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x1c(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <sqrtf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_vector3_distance>:
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 <c_vector3_distance+0x3d>
sqrtss %xmm0,%xmm0
ret
jmp    1030 <sqrtf@plt>

LLVM IR (-O0):
define float @c_vector3_distance(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float* %0, float** %3
store float* %1, float** %4
%8 = load float*, float** %4
%9 = getelementptr inbounds float, float* %8, i64 0
%10 = load float, float* %9
%11 = load float*, float** %3
%12 = getelementptr inbounds float, float* %11, i64 0
%13 = load float, float* %12
%14 = fsub float %10, %13
store float %14, float* %5
%15 = load float*, float** %4
%16 = getelementptr inbounds float, float* %15, i64 1
%17 = load float, float* %16
%18 = load float*, float** %3
%19 = getelementptr inbounds float, float* %18, i64 1
%20 = load float, float* %19
%21 = fsub float %17, %20
store float %21, float* %6
%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
store float %28, float* %7
%29 = load float, float* %5
%30 = load float, float* %5
%31 = load float, float* %6
%32 = load float, float* %6
%33 = fmul float %31, %32
%34 = call float @llvm.fmuladd.f32(float %29, float %30, float %33)
%35 = load float, float* %7
%36 = load float, float* %7
%37 = call float @llvm.fmuladd.f32(float %35, float %36, float %34)
%38 = call float @sqrtf(float %37)
ret float %38
}

LLVM IR (-O2):
define float @c_vector3_distance(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 @sqrtf(float %18)
ret float %19
}