#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 hypot(double x, double y) {
  double abig = fabs(x), asmall = fabs(y);
  double ratio;
  if (abig < asmall) {
    double temp = abig;
    abig = asmall;
    asmall = temp;
  }
  if (asmall == 0.)
    return abig;
  if ((ratio = asmall / abig) > 2.3e-162 && abig < 1.3e+154)
    return abig * sqrt(1.0 + ratio * ratio);
  else {
    double r = ratio * ratio, t, s, p = abig, q = asmall;
    do {
      t = 4. + r;
      if (t == 4.)
        break;
      s = r / t;
      p += 2. * s * p;
      q *= s;
      r = (q / p) * (q / p);
    } while (1);
    return p;
  }
}


x86 assembly (clang, -O0):
<hypot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movaps 0xed2(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movaps 0xebd(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    117e <hypot+0x6e>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11a5 <hypot+0x95>
jp     11a5 <hypot+0x95>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12e7 <hypot+0x1d7>
movsd  -0x28(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe54(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1218 <hypot+0x108>
movsd  0xe4a(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1218 <hypot+0x108>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe37(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12e7 <hypot+0x1d7>
movsd  -0x30(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xddd(%rip),%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  0xdc6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    126f <hypot+0x15f>
jp     126f <hypot+0x15f>
jmp    12dd <hypot+0x1cd>
movsd  -0x40(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xda2(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
divsd  -0x58(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
divsd  -0x58(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    $0x1,%al
test   $0x1,%al
jne    123b <hypot+0x12b>
jmp    12dd <hypot+0x1cd>
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hypot>:
sub    $0x18,%rsp
movapd %xmm1,%xmm4
movapd 0xee0(%rip),%xmm1
andpd  %xmm1,%xmm0
andpd  %xmm1,%xmm4
movapd %xmm0,%xmm1
minsd  %xmm4,%xmm1
maxsd  %xmm0,%xmm4
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    1149 <hypot+0x39>
jp     1149 <hypot+0x39>
movapd %xmm4,%xmm0
add    $0x18,%rsp
ret
movapd %xmm1,%xmm0
divsd  %xmm4,%xmm0
movsd  0xeb7(%rip),%xmm2
ucomisd %xmm4,%xmm2
jbe    1189 <hypot+0x79>
ucomisd 0xeb1(%rip),%xmm0
jbe    1189 <hypot+0x79>
mulsd  %xmm0,%xmm0
addsd  0xeb3(%rip),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11d2 <hypot+0xc2>
sqrtsd %xmm0,%xmm0
mulsd  %xmm0,%xmm4
jmp    1140 <hypot+0x30>
mulsd  %xmm0,%xmm0
movsd  0xe8b(%rip),%xmm2
cs nopw 0x0(%rax,%rax,1)
nop
movapd %xmm0,%xmm3
addsd  %xmm2,%xmm3
ucomisd %xmm2,%xmm3
jne    11b0 <hypot+0xa0>
jnp    1140 <hypot+0x30>
divsd  %xmm3,%xmm0
mulsd  %xmm0,%xmm1
addsd  %xmm0,%xmm0
mulsd  %xmm4,%xmm0
addsd  %xmm0,%xmm4
movapd %xmm1,%xmm0
divsd  %xmm4,%xmm0
mulsd  %xmm0,%xmm0
jmp    11a0 <hypot+0x90>
movapd %xmm4,(%rsp)
call   1030 <sqrt@plt>
movapd (%rsp),%xmm4
mulsd  %xmm0,%xmm4
jmp    1140 <hypot+0x30>

LLVM IR (-O0):
define double @hypot(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
store double %0, double* %4
store double %1, double* %5
%15 = load double, double* %4
%16 = call double @llvm.fabs.f64(double %15)
store double %16, double* %6
%17 = load double, double* %5
%18 = call double @llvm.fabs.f64(double %17)
store double %18, double* %7
%19 = load double, double* %6
%20 = load double, double* %7
%21 = fcmp olt double %19, %20
br i1 %21, label %22, label %26
22: ; preds = %2
%23 = load double, double* %6
store double %23, double* %9
%24 = load double, double* %7
store double %24, double* %6
%25 = load double, double* %9
store double %25, double* %7
br label %26
26: ; preds = %22, %2
%27 = load double, double* %7
%28 = fcmp oeq double %27, 0.000000e+00
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = load double, double* %6
store double %30, double* %3
br label %80
31: ; preds = %26
%32 = load double, double* %7
%33 = load double, double* %6
%34 = fdiv double %32, %33
store double %34, double* %8
%35 = fcmp ogt double %34, 2.300000e-162
br i1 %35, label %36, label %46
36: ; preds = %31
%37 = load double, double* %6
%38 = fcmp olt double %37, 1.300000e+154
br i1 %38, label %39, label %46
39: ; preds = %36
%40 = load double, double* %6
%41 = load double, double* %8
%42 = load double, double* %8
%43 = call double @llvm.fmuladd.f64(double %41, double %42, double 1.000000e+00)
%44 = call double @sqrt(double %43)
%45 = fmul double %40, %44
store double %45, double* %3
br label %80
46: ; preds = %36, %31
%47 = load double, double* %8
%48 = load double, double* %8
%49 = fmul double %47, %48
store double %49, double* %10
%50 = load double, double* %6
store double %50, double* %13
%51 = load double, double* %7
store double %51, double* %14
br label %52
52: ; preds = %77, %46
%53 = load double, double* %10
%54 = fadd double 4.000000e+00, %53
store double %54, double* %11
%55 = load double, double* %11
%56 = fcmp oeq double %55, 4.000000e+00
br i1 %56, label %57, label %58
57: ; preds = %52
br label %78
58: ; preds = %52
%59 = load double, double* %10
%60 = load double, double* %11
%61 = fdiv double %59, %60
store double %61, double* %12
%62 = load double, double* %12
%63 = fmul double 2.000000e+00, %62
%64 = load double, double* %13
%65 = load double, double* %13
%66 = call double @llvm.fmuladd.f64(double %63, double %64, double %65)
store double %66, double* %13
%67 = load double, double* %12
%68 = load double, double* %14
%69 = fmul double %68, %67
store double %69, double* %14
%70 = load double, double* %14
%71 = load double, double* %13
%72 = fdiv double %70, %71
%73 = load double, double* %14
%74 = load double, double* %13
%75 = fdiv double %73, %74
%76 = fmul double %72, %75
store double %76, double* %10
br label %77
77: ; preds = %58
br i1 true, label %52, label %78
78: ; preds = %77, %57
%79 = load double, double* %13
store double %79, double* %3
br label %80
80: ; preds = %78, %39, %29
%81 = load double, double* %3
ret double %81
}

LLVM IR (-O2):
define double @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 olt double %3, %4
%6 = select i1 %5, double %3, double %4
%7 = select i1 %5, double %4, double %3
%8 = fcmp oeq double %6, 0.000000e+00
br i1 %8, label %35, label %9
9: ; preds = %2
%10 = fdiv double %6, %7
%11 = fcmp ogt double %10, 2.300000e-162
%12 = fcmp olt double %7, 1.300000e+154
%13 = and i1 %12, %11
br i1 %13, label %14, label %18
14: ; preds = %9
%15 = tail call double @llvm.fmuladd.f64(double %10, double %10, double 1.000000e+00)
%16 = tail call double @sqrt(double %15)
%17 = fmul double %7, %16
br label %35
18: ; preds = %9
%19 = fmul double %10, %10
%20 = fadd double %19, 4.000000e+00
%21 = fcmp oeq double %20, 4.000000e+00
br i1 %21, label %35, label %22
22: ; preds = %18, %22
%23 = phi double [ %33, %22 ], [ %20, %18 ]
%24 = phi double [ %30, %22 ], [ %6, %18 ]
%25 = phi double [ %29, %22 ], [ %7, %18 ]
%26 = phi double [ %32, %22 ], [ %19, %18 ]
%27 = fdiv double %26, %23
%28 = fmul double %27, 2.000000e+00
%29 = tail call double @llvm.fmuladd.f64(double %28, double %25, double %25)
%30 = fmul double %24, %27
%31 = fdiv double %30, %29
%32 = fmul double %31, %31
%33 = fadd double %32, 4.000000e+00
%34 = fcmp oeq double %33, 4.000000e+00
br i1 %34, label %35, label %22
35: ; preds = %22, %18, %2, %14
%36 = phi double [ %17, %14 ], [ %7, %2 ], [ %7, %18 ], [ %29, %22 ]
ret double %36
}