#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 const logf(double const);
double sqrt(double const);
double thinplate_kernel(const double *x, const double *y) {
  const double r =
      sqrt((x[0] - y[0]) * (x[0] - y[0]) + (x[1] - y[1]) * (x[1] - y[1]) +
           (x[2] - y[2]) * (x[2] - y[2]));
  return r * r * logf(((1e-8f) < (r) ? (r) : (1e-8f)));
}


x86 assembly (clang, -O0):
<thinplate_kernel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm3
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm3
mulsd  %xmm3,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x10(%rbp),%rax
subsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe2e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11eb <thinplate_kernel+0xcb>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    11fd <thinplate_kernel+0xdd>
movsd  0xe0d(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    11fd <thinplate_kernel+0xdd>
movsd  -0x28(%rbp),%xmm0
call   1030 <logf@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thinplate_kernel>:
push   %rax
movsd  (%rdi),%xmm1
movsd  0x8(%rdi),%xmm0
subsd  (%rsi),%xmm1
subsd  0x8(%rsi),%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rdi),%xmm0
subsd  0x10(%rsi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1161 <thinplate_kernel+0x41>
sqrtsd %xmm0,%xmm0
jmp    1166 <thinplate_kernel+0x46>
call   1040 <sqrt@plt>
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
maxsd  0xe85(%rip),%xmm0
call   1030 <logf@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @thinplate_kernel(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
store double* %0, double** %3
store double* %1, double** %4
%6 = load double*, double** %3
%7 = getelementptr inbounds double, double* %6, i64 0
%8 = load double, double* %7
%9 = load double*, double** %4
%10 = getelementptr inbounds double, double* %9, i64 0
%11 = load double, double* %10
%12 = fsub double %8, %11
%13 = load double*, double** %3
%14 = getelementptr inbounds double, double* %13, i64 0
%15 = load double, double* %14
%16 = load double*, double** %4
%17 = getelementptr inbounds double, double* %16, i64 0
%18 = load double, double* %17
%19 = fsub double %15, %18
%20 = load double*, double** %3
%21 = getelementptr inbounds double, double* %20, i64 1
%22 = load double, double* %21
%23 = load double*, double** %4
%24 = getelementptr inbounds double, double* %23, i64 1
%25 = load double, double* %24
%26 = fsub double %22, %25
%27 = load double*, double** %3
%28 = getelementptr inbounds double, double* %27, i64 1
%29 = load double, double* %28
%30 = load double*, double** %4
%31 = getelementptr inbounds double, double* %30, i64 1
%32 = load double, double* %31
%33 = fsub double %29, %32
%34 = fmul double %26, %33
%35 = call double @llvm.fmuladd.f64(double %12, double %19, double %34)
%36 = load double*, double** %3
%37 = getelementptr inbounds double, double* %36, i64 2
%38 = load double, double* %37
%39 = load double*, double** %4
%40 = getelementptr inbounds double, double* %39, i64 2
%41 = load double, double* %40
%42 = fsub double %38, %41
%43 = load double*, double** %3
%44 = getelementptr inbounds double, double* %43, i64 2
%45 = load double, double* %44
%46 = load double*, double** %4
%47 = getelementptr inbounds double, double* %46, i64 2
%48 = load double, double* %47
%49 = fsub double %45, %48
%50 = call double @llvm.fmuladd.f64(double %42, double %49, double %35)
%51 = call double @sqrt(double %50)
store double %51, double* %5
%52 = load double, double* %5
%53 = load double, double* %5
%54 = fmul double %52, %53
%55 = load double, double* %5
%56 = fcmp olt double 0x3E45798EE0000000, %55
br i1 %56, label %57, label %59
57: ; preds = %2
%58 = load double, double* %5
br label %60
59: ; preds = %2
br label %60
60: ; preds = %59, %57
%61 = phi double [ %58, %57 ], [ 0x3E45798EE0000000, %59 ]
%62 = call double @logf(double %61)
%63 = fmul double %54, %62
ret double %63
}

LLVM IR (-O2):
define double @thinplate_kernel(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = fsub double %3, %4
%6 = getelementptr inbounds double, double* %0, i64 1
%7 = load double, double* %6
%8 = getelementptr inbounds double, double* %1, i64 1
%9 = load double, double* %8
%10 = fsub double %7, %9
%11 = fmul double %10, %10
%12 = tail call double @llvm.fmuladd.f64(double %5, double %5, double %11)
%13 = getelementptr inbounds double, double* %0, i64 2
%14 = load double, double* %13
%15 = getelementptr inbounds double, double* %1, i64 2
%16 = load double, double* %15
%17 = fsub double %14, %16
%18 = tail call double @llvm.fmuladd.f64(double %17, double %17, double %12)
%19 = tail call double @sqrt(double %18)
%20 = fmul double %19, %19
%21 = fcmp ogt double %19, 0x3E45798EE0000000
%22 = select i1 %21, double %19, double 0x3E45798EE0000000
%23 = tail call double @logf(double %22)
%24 = fmul double %20, %23
ret double %24
}