#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 sqrt(double);
double SFMHypot3(double dx, double dy, double dz) {
  return (((((dx * dx) + (dy * dy) + (dz * dz)) > 0.0f)
               ? sqrt((dx * dx) + (dy * dy) + (dz * dz))
               : 0.0f));
}


x86 assembly (clang, -O0):
<SFMHypot3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    119f <SFMHypot3+0x8f>
movsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x20(%rbp)
jmp    11ac <SFMHypot3+0x9c>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    11ac <SFMHypot3+0x9c>
movsd  -0x20(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SFMHypot3>:
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm2
addsd  %xmm0,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jbe    113f <SFMHypot3+0x2f>
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jb     1140 <SFMHypot3+0x30>
xorps  %xmm0,%xmm0
sqrtsd %xmm2,%xmm0
ret
movapd %xmm2,%xmm0
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define double @SFMHypot3(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %4
%9 = load double, double* %5
%10 = load double, double* %5
%11 = fmul double %9, %10
%12 = call double @llvm.fmuladd.f64(double %7, double %8, double %11)
%13 = load double, double* %6
%14 = load double, double* %6
%15 = call double @llvm.fmuladd.f64(double %13, double %14, double %12)
%16 = fcmp ogt double %15, 0.000000e+00
br i1 %16, label %17, label %28
17: ; preds = %3
%18 = load double, double* %4
%19 = load double, double* %4
%20 = load double, double* %5
%21 = load double, double* %5
%22 = fmul double %20, %21
%23 = call double @llvm.fmuladd.f64(double %18, double %19, double %22)
%24 = load double, double* %6
%25 = load double, double* %6
%26 = call double @llvm.fmuladd.f64(double %24, double %25, double %23)
%27 = call double @sqrt(double %26)
br label %29
28: ; preds = %3
br label %29
29: ; preds = %28, %17
%30 = phi double [ %27, %17 ], [ 0.000000e+00, %28 ]
ret double %30
}

LLVM IR (-O2):
define double @SFMHypot3(double %0, double %1, double %2) {
%4 = fmul double %1, %1
%5 = tail call double @llvm.fmuladd.f64(double %0, double %0, double %4)
%6 = tail call double @llvm.fmuladd.f64(double %2, double %2, double %5)
%7 = fcmp ogt double %6, 0.000000e+00
br i1 %7, label %8, label %10
8: ; preds = %3
%9 = tail call double @sqrt(double %6)
br label %10
10: ; preds = %3, %8
%11 = phi double [ %9, %8 ], [ 0.000000e+00, %3 ]
ret double %11
}