#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 fabs(double);
double sqrt(double);
double ElSuiteSparse_hypot(double x, double y) {
  double s, r;
  x = fabs(x);
  y = fabs(y);
  if (x >= y) {
    if (x + y == x) {
      s = x;
    } else {
      r = y / x;
      s = x * sqrt(1.0 + r * r);
    }
  } else {
    if (y + x == y) {
      s = y;
    } else {
      r = x / y;
      s = y * sqrt(1.0 + r * r);
    }
  }
  return (s);
}


x86 assembly (clang, -O0):
<ElSuiteSparse_hypot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movaps 0xed2(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x10(%rbp),%xmm0
movaps 0xebd(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     11d4 <ElSuiteSparse_hypot+0xc4>
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
ucomisd -0x8(%rbp),%xmm0
jne    1186 <ElSuiteSparse_hypot+0x76>
jp     1186 <ElSuiteSparse_hypot+0x76>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11cf <ElSuiteSparse_hypot+0xbf>
movsd  -0x10(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe5b(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    124c <ElSuiteSparse_hypot+0x13c>
movsd  -0x10(%rbp),%xmm0
addsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jne    11fe <ElSuiteSparse_hypot+0xee>
jp     11fe <ElSuiteSparse_hypot+0xee>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1247 <ElSuiteSparse_hypot+0x137>
movsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xde3(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    124c <ElSuiteSparse_hypot+0x13c>
movsd  -0x18(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ElSuiteSparse_hypot>:
sub    $0x18,%rsp
movapd %xmm0,%xmm2
movapd 0xee0(%rip),%xmm0
andpd  %xmm0,%xmm2
andpd  %xmm0,%xmm1
ucomisd %xmm1,%xmm2
movapd %xmm1,%xmm0
addsd  %xmm2,%xmm0
jae    1144 <ElSuiteSparse_hypot+0x34>
ucomisd %xmm1,%xmm0
jne    1162 <ElSuiteSparse_hypot+0x52>
jp     1162 <ElSuiteSparse_hypot+0x52>
movapd %xmm1,%xmm2
jmp    119d <ElSuiteSparse_hypot+0x8d>
ucomisd %xmm2,%xmm0
jne    114c <ElSuiteSparse_hypot+0x3c>
jnp    119d <ElSuiteSparse_hypot+0x8d>
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm1
addsd  0xeb4(%rip),%xmm1
movapd %xmm1,%xmm0
jmp    117a <ElSuiteSparse_hypot+0x6a>
divsd  %xmm1,%xmm2
mulsd  %xmm2,%xmm2
addsd  0xe9e(%rip),%xmm2
movapd %xmm2,%xmm0
movapd %xmm1,%xmm2
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     118a <ElSuiteSparse_hypot+0x7a>
sqrtsd %xmm0,%xmm0
jmp    1199 <ElSuiteSparse_hypot+0x89>
movapd %xmm2,(%rsp)
call   1030 <sqrt@plt>
movapd (%rsp),%xmm2
mulsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
add    $0x18,%rsp
ret

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

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