#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 HUGE_VAL;
scalar_t__ stdlib_base_is_infinite(double const);
scalar_t__ stdlib_base_is_nan(double const);
double stdlib_base_sqrt(double);
double stdlib_base_hypot(const double x, const double y) {
  double tmp;
  double a;
  double b;
  if (stdlib_base_is_nan(x) || stdlib_base_is_nan(y)) {
    return 0.0 / 0.0;
  }
  if (stdlib_base_is_infinite(x) || stdlib_base_is_infinite(y)) {
    return HUGE_VAL;
  }
  a = x;
  b = y;
  if (a < 0.0) {
    a = -a;
  }
  if (b < 0.0) {
    b = -b;
  }
  if (a < b) {
    tmp = b;
    b = a;
    a = tmp;
  }
  if (a == 0.0) {
    return 0.0;
  }
  b /= a;
  return a * stdlib_base_sqrt(1.0 + (b * b));
}


x86 assembly (clang, -O0):
<stdlib_base_hypot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <stdlib_base_is_nan@plt>
cmp    $0x0,%rax
jne    116a <stdlib_base_hypot+0x3a>
movsd  -0x18(%rbp),%xmm0
call   1050 <stdlib_base_is_nan@plt>
cmp    $0x0,%rax
je     117c <stdlib_base_hypot+0x4c>
movsd  0xe96(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12cf <stdlib_base_hypot+0x19f>
movsd  -0x10(%rbp),%xmm0
call   1030 <stdlib_base_is_infinite@plt>
cmp    $0x0,%rax
jne    11a4 <stdlib_base_hypot+0x74>
movsd  -0x18(%rbp),%xmm0
call   1030 <stdlib_base_is_infinite@plt>
cmp    $0x0,%rax
je     11b9 <stdlib_base_hypot+0x89>
mov    0x2e3d(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12cf <stdlib_base_hypot+0x19f>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    11fc <stdlib_base_hypot+0xcc>
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x30(%rbp),%xmm0
jbe    122b <stdlib_base_hypot+0xfb>
movsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    125d <stdlib_base_hypot+0x12d>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1282 <stdlib_base_hypot+0x152>
jp     1282 <stdlib_base_hypot+0x152>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12cf <stdlib_base_hypot+0x19f>
movsd  -0x28(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd4b(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1040 <stdlib_base_sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stdlib_base_hypot>:
sub    $0x28,%rsp
movapd %xmm1,(%rsp)
movapd %xmm0,0x10(%rsp)
call   1050 <stdlib_base_is_nan@plt>
movsd  0xeb4(%rip),%xmm4
test   %rax,%rax
jne    1192 <stdlib_base_hypot+0x62>
movapd (%rsp),%xmm0
call   1050 <stdlib_base_is_nan@plt>
movsd  0xe9d(%rip),%xmm4
test   %rax,%rax
jne    1192 <stdlib_base_hypot+0x62>
movapd 0x10(%rsp),%xmm0
call   1030 <stdlib_base_is_infinite@plt>
test   %rax,%rax
jne    1187 <stdlib_base_hypot+0x57>
movapd (%rsp),%xmm0
call   1030 <stdlib_base_is_infinite@plt>
test   %rax,%rax
je     119b <stdlib_base_hypot+0x6b>
mov    0x2e5a(%rip),%rax
movsd  (%rax),%xmm4
movapd %xmm4,%xmm0
add    $0x28,%rsp
ret
movapd 0xe6d(%rip),%xmm2
movapd 0x10(%rsp),%xmm3
movapd %xmm3,%xmm1
xorpd  %xmm2,%xmm1
xorpd  %xmm4,%xmm4
movapd %xmm3,%xmm0
cmpltsd %xmm4,%xmm0
andpd  %xmm0,%xmm1
andnpd %xmm3,%xmm0
orpd   %xmm1,%xmm0
movapd (%rsp),%xmm3
xorpd  %xmm3,%xmm2
movapd %xmm3,%xmm1
cmpltsd %xmm4,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm3,%xmm1
orpd   %xmm2,%xmm1
movapd %xmm1,%xmm2
maxsd  %xmm0,%xmm2
ucomisd %xmm4,%xmm2
jne    11f8 <stdlib_base_hypot+0xc8>
jnp    1192 <stdlib_base_hypot+0x62>
minsd  %xmm1,%xmm0
divsd  %xmm2,%xmm0
mulsd  %xmm0,%xmm0
addsd  0xdfc(%rip),%xmm0
movapd %xmm2,(%rsp)
call   1040 <stdlib_base_sqrt@plt>
movapd %xmm0,%xmm4
mulsd  (%rsp),%xmm4
jmp    1192 <stdlib_base_hypot+0x62>

LLVM IR (-O0):
@HUGE_VAL = global double 0.000000e+00
define double @stdlib_base_hypot(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %4
store double %1, double* %5
%9 = load double, double* %4
%10 = call i64 @stdlib_base_is_nan(double %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %2
%13 = load double, double* %5
%14 = call i64 @stdlib_base_is_nan(double %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %12, %2
store double 0x7FF8000000000000, double* %3
br label %63
17: ; preds = %12
%18 = load double, double* %4
%19 = call i64 @stdlib_base_is_infinite(double %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %25, label %21
21: ; preds = %17
%22 = load double, double* %5
%23 = call i64 @stdlib_base_is_infinite(double %22)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %21, %17
%26 = load double, double* @HUGE_VAL
store double %26, double* %3
br label %63
27: ; preds = %21
%28 = load double, double* %4
store double %28, double* %7
%29 = load double, double* %5
store double %29, double* %8
%30 = load double, double* %7
%31 = fcmp olt double %30, 0.000000e+00
br i1 %31, label %32, label %35
32: ; preds = %27
%33 = load double, double* %7
%34 = fneg double %33
store double %34, double* %7
br label %35
35: ; preds = %32, %27
%36 = load double, double* %8
%37 = fcmp olt double %36, 0.000000e+00
br i1 %37, label %38, label %41
38: ; preds = %35
%39 = load double, double* %8
%40 = fneg double %39
store double %40, double* %8
br label %41
41: ; preds = %38, %35
%42 = load double, double* %7
%43 = load double, double* %8
%44 = fcmp olt double %42, %43
br i1 %44, label %45, label %49
45: ; preds = %41
%46 = load double, double* %8
store double %46, double* %6
%47 = load double, double* %7
store double %47, double* %8
%48 = load double, double* %6
store double %48, double* %7
br label %49
49: ; preds = %45, %41
%50 = load double, double* %7
%51 = fcmp oeq double %50, 0.000000e+00
br i1 %51, label %52, label %53
52: ; preds = %49
store double 0.000000e+00, double* %3
br label %63
53: ; preds = %49
%54 = load double, double* %7
%55 = load double, double* %8
%56 = fdiv double %55, %54
store double %56, double* %8
%57 = load double, double* %7
%58 = load double, double* %8
%59 = load double, double* %8
%60 = call double @llvm.fmuladd.f64(double %58, double %59, double 1.000000e+00)
%61 = call double @stdlib_base_sqrt(double %60)
%62 = fmul double %57, %61
store double %62, double* %3
br label %63
63: ; preds = %53, %52, %25, %16
%64 = load double, double* %3
ret double %64
}

LLVM IR (-O2):
@HUGE_VAL = global double 0.000000e+00
define double @stdlib_base_hypot(double %0, double %1) {
%3 = tail call i64 @stdlib_base_is_nan(double %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %32
5: ; preds = %2
%6 = tail call i64 @stdlib_base_is_nan(double %1)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %32
8: ; preds = %5
%9 = tail call i64 @stdlib_base_is_infinite(double %0)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = tail call i64 @stdlib_base_is_infinite(double %1)
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %11, %8
%15 = load double, double* @HUGE_VAL
br label %32
16: ; preds = %11
%17 = fcmp olt double %0, 0.000000e+00
%18 = fneg double %0
%19 = select i1 %17, double %18, double %0
%20 = fcmp olt double %1, 0.000000e+00
%21 = fneg double %1
%22 = select i1 %20, double %21, double %1
%23 = fcmp olt double %19, %22
%24 = select i1 %23, double %22, double %19
%25 = fcmp oeq double %24, 0.000000e+00
br i1 %25, label %32, label %26
26: ; preds = %16
%27 = select i1 %23, double %19, double %22
%28 = fdiv double %27, %24
%29 = tail call double @llvm.fmuladd.f64(double %28, double %28, double 1.000000e+00)
%30 = tail call double @stdlib_base_sqrt(double %29)
%31 = fmul double %24, %30
br label %32
32: ; preds = %16, %2, %5, %26, %14
%33 = phi double [ %15, %14 ], [ %31, %26 ], [ 0x7FF8000000000000, %5 ], [ 0x7FF8000000000000, %2 ], [ 0.000000e+00, %16 ]
ret double %33
}