#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 fabs(float);
float sqrt(float);
double slapy3(float x, float y, float z) {
  float ret_val, r__1, r__2, r__3;
  static float xabs, yabs, zabs, w;
  xabs = fabs(x);
  yabs = fabs(y);
  zabs = fabs(z);
  r__1 = (((xabs) > (yabs)) ? (xabs) : (yabs));
  w = (((r__1) > (zabs)) ? (r__1) : (zabs));
  if (w == 0.f) {
    ret_val = 0.f;
  } else {
    r__1 = xabs / w;
    r__2 = yabs / w;
    r__3 = zabs / w;
    ret_val = w * sqrt(r__1 * r__1 + r__2 * r__2 + r__3 * r__3);
  }
  return ret_val;
}


x86 assembly (clang, -O0):
<slapy3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <fabs@plt>
movss  %xmm0,0x2eeb(%rip)
movss  -0x8(%rbp),%xmm0
call   1030 <fabs@plt>
movss  %xmm0,0x2edd(%rip)
movss  -0xc(%rbp),%xmm0
call   1030 <fabs@plt>
movss  %xmm0,0x2ecf(%rip)
movss  0x2ebf(%rip),%xmm0
ucomiss 0x2ebc(%rip),%xmm0
jbe    1194 <slapy3+0x74>
movss  0x2eaa(%rip),%xmm0
movss  %xmm0,-0x20(%rbp)
jmp    11a1 <slapy3+0x81>
movss  0x2e9c(%rip),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
ucomiss 0x2e85(%rip),%xmm0
jbe    11cc <slapy3+0xac>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    11d9 <slapy3+0xb9>
movss  0x2e68(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
movss  %xmm0,0x2e5a(%rip)
movss  0x2e52(%rip),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    120d <slapy3+0xed>
jp     120d <slapy3+0xed>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    129d <slapy3+0x17d>
movss  0x2e1f(%rip),%xmm0
divss  0x2e23(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0x2e0e(%rip),%xmm0
divss  0x2e0e(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  0x2dfd(%rip),%xmm0
divss  0x2df9(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  0x2dec(%rip),%xmm0
movss  %xmm0,-0x28(%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   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x28(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slapy3>:
sub    $0x18,%rsp
movaps 0xee5(%rip),%xmm3
andps  %xmm3,%xmm0
andps  %xmm3,%xmm1
andps  %xmm3,%xmm2
movaps %xmm0,%xmm5
maxss  %xmm1,%xmm5
maxss  %xmm2,%xmm5
xorps  %xmm3,%xmm3
xorps  %xmm4,%xmm4
ucomiss %xmm4,%xmm5
jne    113c <slapy3+0x2c>
jnp    1185 <slapy3+0x75>
divss  %xmm5,%xmm0
divss  %xmm5,%xmm1
divss  %xmm5,%xmm2
mulss  %xmm1,%xmm1
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
mulss  %xmm2,%xmm2
addss  %xmm0,%xmm2
ucomiss %xmm4,%xmm2
jb     116a <slapy3+0x5a>
xorps  %xmm0,%xmm0
sqrtss %xmm2,%xmm0
jmp    117a <slapy3+0x6a>
movaps %xmm2,%xmm0
movaps %xmm5,(%rsp)
call   1030 <sqrt@plt>
movaps (%rsp),%xmm5
mulss  %xmm0,%xmm5
xorps  %xmm3,%xmm3
cvtss2sd %xmm5,%xmm3
movaps %xmm3,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@slapy3.xabs = internal global float 0.000000e+00
@slapy3.yabs = internal global float 0.000000e+00
@slapy3.zabs = internal global float 0.000000e+00
@slapy3.w = internal global float 0.000000e+00
define double @slapy3(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%11 = load float, float* %4
%12 = call float @fabs(float %11)
store float %12, float* @slapy3.xabs
%13 = load float, float* %5
%14 = call float @fabs(float %13)
store float %14, float* @slapy3.yabs
%15 = load float, float* %6
%16 = call float @fabs(float %15)
store float %16, float* @slapy3.zabs
%17 = load float, float* @slapy3.xabs
%18 = load float, float* @slapy3.yabs
%19 = fcmp ogt float %17, %18
br i1 %19, label %20, label %22
20: ; preds = %3
%21 = load float, float* @slapy3.xabs
br label %24
22: ; preds = %3
%23 = load float, float* @slapy3.yabs
br label %24
24: ; preds = %22, %20
%25 = phi float [ %21, %20 ], [ %23, %22 ]
store float %25, float* %8
%26 = load float, float* %8
%27 = load float, float* @slapy3.zabs
%28 = fcmp ogt float %26, %27
br i1 %28, label %29, label %31
29: ; preds = %24
%30 = load float, float* %8
br label %33
31: ; preds = %24
%32 = load float, float* @slapy3.zabs
br label %33
33: ; preds = %31, %29
%34 = phi float [ %30, %29 ], [ %32, %31 ]
store float %34, float* @slapy3.w
%35 = load float, float* @slapy3.w
%36 = fcmp oeq float %35, 0.000000e+00
br i1 %36, label %37, label %38
37: ; preds = %33
store float 0.000000e+00, float* %7
br label %60
38: ; preds = %33
%39 = load float, float* @slapy3.xabs
%40 = load float, float* @slapy3.w
%41 = fdiv float %39, %40
store float %41, float* %8
%42 = load float, float* @slapy3.yabs
%43 = load float, float* @slapy3.w
%44 = fdiv float %42, %43
store float %44, float* %9
%45 = load float, float* @slapy3.zabs
%46 = load float, float* @slapy3.w
%47 = fdiv float %45, %46
store float %47, float* %10
%48 = load float, float* @slapy3.w
%49 = load float, float* %8
%50 = load float, float* %8
%51 = load float, float* %9
%52 = load float, float* %9
%53 = fmul float %51, %52
%54 = call float @llvm.fmuladd.f32(float %49, float %50, float %53)
%55 = load float, float* %10
%56 = load float, float* %10
%57 = call float @llvm.fmuladd.f32(float %55, float %56, float %54)
%58 = call float @sqrt(float %57)
%59 = fmul float %48, %58
store float %59, float* %7
br label %60
60: ; preds = %38, %37
%61 = load float, float* %7
%62 = fpext float %61 to double
ret double %62
}

LLVM IR (-O2):
define double @slapy3(float %0, float %1, float %2) {
%4 = tail call float @llvm.fabs.f32(float %0)
%5 = tail call float @llvm.fabs.f32(float %1)
%6 = tail call float @llvm.fabs.f32(float %2)
%7 = fcmp ogt float %4, %5
%8 = select i1 %7, float %4, float %5
%9 = fcmp ogt float %8, %6
%10 = select i1 %9, float %8, float %6
%11 = fcmp oeq float %10, 0.000000e+00
br i1 %11, label %22, label %12
12: ; preds = %3
%13 = fdiv float %4, %10
%14 = fdiv float %5, %10
%15 = fdiv float %6, %10
%16 = fmul float %14, %14
%17 = tail call float @llvm.fmuladd.f32(float %13, float %13, float %16)
%18 = tail call float @llvm.fmuladd.f32(float %15, float %15, float %17)
%19 = tail call float @sqrt(float %18)
%20 = fmul float %10, %19
%21 = fpext float %20 to double
br label %22
22: ; preds = %3, %12
%23 = phi double [ %21, %12 ], [ 0.000000e+00, %3 ]
ret double %23
}