#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 */
scalar_t__ pow(float, double);
float sqrt(scalar_t__);
float dist_ponto_plano(float *x, float *y, float *z, float *d) {
  float modulo;
  modulo = x[0] * x[1] + y[0] * y[1] + z[0] * z[1] + d[0];
  if (modulo < 0)
    modulo *= -1;
  return modulo / sqrt(pow(x[0], 2.0) + pow(y[0], 2.0) + pow(z[0], 2.0));
}


x86 assembly (clang, -O0):
<dist_ponto_plano>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm2
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
mulss  0x4(%rax),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movss  0x4(%rax),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
addss  (%rax),%xmm0
movss  %xmm0,-0x24(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x24(%rbp),%xmm0
jbe    11a7 <dist_ponto_plano+0x87>
movss  0xe63(%rip),%xmm0
mulss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
movsd  0xe47(%rip),%xmm1
call   1030 <pow@plt>
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movsd  0xe2e(%rip),%xmm1
call   1030 <pow@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
movsd  0xe0b(%rip),%xmm1
call   1030 <pow@plt>
mov    -0x30(%rbp),%rdi
add    %rax,%rdi
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x28(%rbp),%xmm0
divss  %xmm1,%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dist_ponto_plano>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
movss  (%rdi),%xmm0
movss  (%rsi),%xmm1
mulss  0x4(%rsi),%xmm1
movss  0x4(%rdi),%xmm2
mulss  %xmm0,%xmm2
movss  (%rdx),%xmm3
mulss  0x4(%rdx),%xmm3
addss  %xmm1,%xmm2
addss  %xmm2,%xmm3
addss  (%rcx),%xmm3
movaps 0xe9f(%rip),%xmm1
xorps  %xmm3,%xmm1
xorps  %xmm2,%xmm2
movaps %xmm3,%xmm4
cmpltss %xmm2,%xmm4
andps  %xmm4,%xmm1
andnps %xmm3,%xmm4
orps   %xmm1,%xmm4
movaps %xmm4,(%rsp)
movsd  0xe8c(%rip),%xmm1
call   1030 <pow@plt>
mov    %rax,%rbx
movss  (%r15),%xmm0
movsd  0xe77(%rip),%xmm1
call   1030 <pow@plt>
add    %rax,%rbx
movss  (%r14),%xmm0
movsd  0xe62(%rip),%xmm1
call   1030 <pow@plt>
add    %rax,%rbx
mov    %rbx,%rdi
call   1040 <sqrt@plt>
movaps (%rsp),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define float @dist_ponto_plano(float* %0, float* %1, float* %2, float* %3) {
%5 = alloca float*
%6 = alloca float*
%7 = alloca float*
%8 = alloca float*
%9 = alloca float
store float* %0, float** %5
store float* %1, float** %6
store float* %2, float** %7
store float* %3, float** %8
%10 = load float*, float** %5
%11 = getelementptr inbounds float, float* %10, i64 0
%12 = load float, float* %11
%13 = load float*, float** %5
%14 = getelementptr inbounds float, float* %13, i64 1
%15 = load float, float* %14
%16 = load float*, float** %6
%17 = getelementptr inbounds float, float* %16, i64 0
%18 = load float, float* %17
%19 = load float*, float** %6
%20 = getelementptr inbounds float, float* %19, i64 1
%21 = load float, float* %20
%22 = fmul float %18, %21
%23 = call float @llvm.fmuladd.f32(float %12, float %15, float %22)
%24 = load float*, float** %7
%25 = getelementptr inbounds float, float* %24, i64 0
%26 = load float, float* %25
%27 = load float*, float** %7
%28 = getelementptr inbounds float, float* %27, i64 1
%29 = load float, float* %28
%30 = call float @llvm.fmuladd.f32(float %26, float %29, float %23)
%31 = load float*, float** %8
%32 = getelementptr inbounds float, float* %31, i64 0
%33 = load float, float* %32
%34 = fadd float %30, %33
store float %34, float* %9
%35 = load float, float* %9
%36 = fcmp olt float %35, 0.000000e+00
br i1 %36, label %37, label %40
37: ; preds = %4
%38 = load float, float* %9
%39 = fmul float %38, -1.000000e+00
store float %39, float* %9
br label %40
40: ; preds = %37, %4
%41 = load float, float* %9
%42 = load float*, float** %5
%43 = getelementptr inbounds float, float* %42, i64 0
%44 = load float, float* %43
%45 = call i64 @pow(float %44, double 2.000000e+00)
%46 = load float*, float** %6
%47 = getelementptr inbounds float, float* %46, i64 0
%48 = load float, float* %47
%49 = call i64 @pow(float %48, double 2.000000e+00)
%50 = add nsw i64 %45, %49
%51 = load float*, float** %7
%52 = getelementptr inbounds float, float* %51, i64 0
%53 = load float, float* %52
%54 = call i64 @pow(float %53, double 2.000000e+00)
%55 = add nsw i64 %50, %54
%56 = call float @sqrt(i64 %55)
%57 = fdiv float %41, %56
ret float %57
}

LLVM IR (-O2):
define float @dist_ponto_plano(float* nocapture %0, float* nocapture %1, float* nocapture %2, float* nocapture %3) {
%5 = load float, float* %0
%6 = getelementptr inbounds float, float* %0, i64 1
%7 = load float, float* %6
%8 = load float, float* %1
%9 = getelementptr inbounds float, float* %1, i64 1
%10 = load float, float* %9
%11 = fmul float %8, %10
%12 = tail call float @llvm.fmuladd.f32(float %5, float %7, float %11)
%13 = load float, float* %2
%14 = getelementptr inbounds float, float* %2, i64 1
%15 = load float, float* %14
%16 = tail call float @llvm.fmuladd.f32(float %13, float %15, float %12)
%17 = load float, float* %3
%18 = fadd float %16, %17
%19 = fcmp olt float %18, 0.000000e+00
%20 = fneg float %18
%21 = select i1 %19, float %20, float %18
%22 = tail call i64 @pow(float %5, double 2.000000e+00)
%23 = load float, float* %1
%24 = tail call i64 @pow(float %23, double 2.000000e+00)
%25 = add nsw i64 %24, %22
%26 = load float, float* %2
%27 = tail call i64 @pow(float %26, double 2.000000e+00)
%28 = add nsw i64 %25, %27
%29 = tail call float @sqrt(i64 %28)
%30 = fdiv float %21, %29
ret float %30
}