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


x86 assembly (clang, -O0):
<slapy2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <fabs@plt>
movss  %xmm0,0x2ef0(%rip)
movss  -0x8(%rbp),%xmm0
call   1030 <fabs@plt>
movss  %xmm0,0x2ee2(%rip)
movss  0x2ed6(%rip),%xmm0
ucomiss 0x2ed3(%rip),%xmm0
jbe    117d <slapy2+0x5d>
movss  0x2ec1(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    118a <slapy2+0x6a>
movss  0x2eb3(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,0x2ea5(%rip)
movss  0x2e95(%rip),%xmm1
movss  0x2e91(%rip),%xmm0
ucomiss %xmm1,%xmm0
jbe    11c2 <slapy2+0xa2>
movss  0x2e7c(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
jmp    11cf <slapy2+0xaf>
movss  0x2e6e(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,0x2e64(%rip)
movss  0x2e5c(%rip),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1208 <slapy2+0xe8>
jp     1208 <slapy2+0xe8>
movss  0x2e3e(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    125a <slapy2+0x13a>
movss  0x2e30(%rip),%xmm0
divss  0x2e24(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0x2e17(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x10(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xdc0(%rip),%xmm1
addss  %xmm1,%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x1c(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slapy2>:
sub    $0x18,%rsp
movaps 0xee5(%rip),%xmm2
andps  %xmm2,%xmm0
andps  %xmm2,%xmm1
movaps %xmm0,%xmm2
maxss  %xmm1,%xmm2
minss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1136 <slapy2+0x26>
jnp    1162 <slapy2+0x52>
divss  %xmm2,%xmm0
mulss  %xmm0,%xmm0
addss  0xeca(%rip),%xmm0
ucomiss %xmm1,%xmm0
jb     1151 <slapy2+0x41>
sqrtss %xmm0,%xmm0
jmp    115e <slapy2+0x4e>
movaps %xmm2,(%rsp)
call   1030 <sqrt@plt>
movaps (%rsp),%xmm2
mulss  %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
add    $0x18,%rsp
ret

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

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