#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);
scalar_t__ rtIsNaN(double);
double sqrt(double);
double rt_hypotd_snf(double u0, double u1) {
  double y;
  double a;
  double b;
  a = fabs(u0);
  b = fabs(u1);
  if (a < b) {
    a /= b;
    y = b * sqrt(a * a + 1.0);
  } else if (a > b) {
    b /= a;
    y = a * sqrt(b * b + 1.0);
  } else if (rtIsNaN(b)) {
    y = b;
  } else {
    y = a * 1.4142135623730951;
  }
  return y;
}


x86 assembly (clang, -O0):
<rt_hypotd_snf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movaps 0xec2(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movaps 0xead(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11c2 <rt_hypotd_snf+0xa2>
movsd  -0x28(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe75(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1263 <rt_hypotd_snf+0x143>
movsd  -0x20(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    1224 <rt_hypotd_snf+0x104>
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe13(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    125e <rt_hypotd_snf+0x13e>
movsd  -0x28(%rbp),%xmm0
call   1030 <rtIsNaN@plt>
cmp    $0x0,%rax
je     1247 <rt_hypotd_snf+0x127>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1259 <rt_hypotd_snf+0x139>
movsd  0xdc1(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    125e <rt_hypotd_snf+0x13e>
jmp    1263 <rt_hypotd_snf+0x143>
movsd  -0x18(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rt_hypotd_snf>:
sub    $0x28,%rsp
movapd %xmm0,%xmm2
movapd 0xed0(%rip),%xmm0
andpd  %xmm0,%xmm2
andpd  %xmm0,%xmm1
ucomisd %xmm2,%xmm1
jbe    1161 <rt_hypotd_snf+0x41>
divsd  %xmm1,%xmm2
mulsd  %xmm2,%xmm2
addsd  0xeca(%rip),%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jb     118a <rt_hypotd_snf+0x6a>
xorps  %xmm0,%xmm0
sqrtsd %xmm2,%xmm0
jmp    119f <rt_hypotd_snf+0x7f>
ucomisd %xmm1,%xmm2
jbe    11a8 <rt_hypotd_snf+0x88>
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm1
addsd  0xea1(%rip),%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jb     11cb <rt_hypotd_snf+0xab>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
jmp    11de <rt_hypotd_snf+0xbe>
movapd %xmm2,%xmm0
movapd %xmm1,0x10(%rsp)
call   1040 <sqrt@plt>
movapd 0x10(%rsp),%xmm1
mulsd  %xmm1,%xmm0
add    $0x28,%rsp
ret
movapd %xmm2,(%rsp)
movapd %xmm1,0x10(%rsp)
movapd %xmm1,%xmm0
call   1030 <rtIsNaN@plt>
test   %rax,%rax
je     11e7 <rt_hypotd_snf+0xc7>
movaps 0x10(%rsp),%xmm0
add    $0x28,%rsp
ret
movapd %xmm1,%xmm0
movapd %xmm2,(%rsp)
call   1040 <sqrt@plt>
movapd (%rsp),%xmm2
mulsd  %xmm2,%xmm0
add    $0x28,%rsp
ret
movsd  0xe21(%rip),%xmm0
mulsd  (%rsp),%xmm0
add    $0x28,%rsp
ret

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

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