#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 */
int FP_INFINITE;
int FP_NAN;
double HUGE_VAL;
double NAN;
double _hypot(double, double);
int fpclassify(double);
double hypot(double x, double y) {
  int x_class = fpclassify(x);
  int y_class = fpclassify(y);
  if (x_class == FP_INFINITE || y_class == FP_INFINITE)
    return HUGE_VAL;
  else if (x_class == FP_NAN || y_class == FP_NAN)
    return NAN;
  return _hypot(x, y);
}


x86 assembly (clang, -O0):
<hypot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <fpclassify@plt>
mov    %eax,-0x1c(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <fpclassify@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2e82(%rip),%rcx
cmp    (%rcx),%eax
je     1170 <hypot+0x50>
mov    -0x20(%rbp),%eax
mov    0x2e70(%rip),%rcx
cmp    (%rcx),%eax
jne    1185 <hypot+0x65>
mov    0x2e59(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11d7 <hypot+0xb7>
mov    -0x1c(%rbp),%eax
mov    0x2e51(%rip),%rcx
cmp    (%rcx),%eax
je     11a9 <hypot+0x89>
mov    -0x20(%rbp),%eax
mov    0x2e3f(%rip),%rcx
cmp    (%rcx),%eax
jne    11be <hypot+0x9e>
mov    0x2e48(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11d7 <hypot+0xb7>
jmp    11c3 <hypot+0xa3>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1040 <_hypot@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hypot>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm1,(%rsp)
movsd  %xmm0,0x8(%rsp)
call   1030 <fpclassify@plt>
mov    %eax,%ebx
movsd  (%rsp),%xmm0
call   1030 <fpclassify@plt>
mov    0x2e90(%rip),%rcx
mov    (%rcx),%ecx
cmp    %ecx,%ebx
je     1178 <hypot+0x58>
cmp    %ecx,%eax
je     1178 <hypot+0x58>
mov    0x2e87(%rip),%rcx
mov    (%rcx),%ecx
cmp    %ecx,%ebx
je     1181 <hypot+0x61>
cmp    %ecx,%eax
je     1181 <hypot+0x61>
movsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
add    $0x10,%rsp
pop    %rbx
jmp    1040 <_hypot@plt>
mov    0x2e51(%rip),%rax
jmp    1188 <hypot+0x68>
mov    0x2e70(%rip),%rax
movsd  (%rax),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@FP_INFINITE = global i32 0
@HUGE_VAL = global double 0.000000e+00
@FP_NAN = global i32 0
@NAN = global double 0.000000e+00
define double @hypot(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca i32
%7 = alloca i32
store double %0, double* %4
store double %1, double* %5
%8 = load double, double* %4
%9 = call i32 @fpclassify(double %8)
store i32 %9, i32* %6
%10 = load double, double* %5
%11 = call i32 @fpclassify(double %10)
store i32 %11, i32* %7
%12 = load i32, i32* %6
%13 = load i32, i32* @FP_INFINITE
%14 = icmp eq i32 %12, %13
br i1 %14, label %19, label %15
15: ; preds = %2
%16 = load i32, i32* %7
%17 = load i32, i32* @FP_INFINITE
%18 = icmp eq i32 %16, %17
br i1 %18, label %19, label %21
19: ; preds = %15, %2
%20 = load double, double* @HUGE_VAL
store double %20, double* %3
br label %36
21: ; preds = %15
%22 = load i32, i32* %6
%23 = load i32, i32* @FP_NAN
%24 = icmp eq i32 %22, %23
br i1 %24, label %29, label %25
25: ; preds = %21
%26 = load i32, i32* %7
%27 = load i32, i32* @FP_NAN
%28 = icmp eq i32 %26, %27
br i1 %28, label %29, label %31
29: ; preds = %25, %21
%30 = load double, double* @NAN
store double %30, double* %3
br label %36
31: ; preds = %25
br label %32
32: ; preds = %31
%33 = load double, double* %4
%34 = load double, double* %5
%35 = call double @_hypot(double %33, double %34)
store double %35, double* %3
br label %36
36: ; preds = %32, %29, %19
%37 = load double, double* %3
ret double %37
}

LLVM IR (-O2):
@FP_INFINITE = global i32 0
@HUGE_VAL = global double 0.000000e+00
@FP_NAN = global i32 0
@NAN = global double 0.000000e+00
define double @hypot(double %0, double %1) {
%3 = tail call i32 @fpclassify(double %0)
%4 = tail call i32 @fpclassify(double %1)
%5 = load i32, i32* @FP_INFINITE
%6 = icmp eq i32 %3, %5
%7 = icmp eq i32 %4, %5
%8 = select i1 %6, i1 true, i1 %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load double, double* @HUGE_VAL
br label %20
11: ; preds = %2
%12 = load i32, i32* @FP_NAN
%13 = icmp eq i32 %3, %12
%14 = icmp eq i32 %4, %12
%15 = select i1 %13, i1 true, i1 %14
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = load double, double* @NAN
br label %20
18: ; preds = %11
%19 = tail call double @_hypot(double %0, double %1)
br label %20
20: ; preds = %18, %16, %9
%21 = phi double [ %10, %9 ], [ %17, %16 ], [ %19, %18 ]
ret double %21
}