#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 */
float INFINITY;
scalar_t__ stdlib_base_is_infinitef(float const);
scalar_t__ stdlib_base_is_nanf(float const);
float stdlib_base_sqrtf(float);
float stdlib_base_hypotf(const float x, const float y) {
  float tmp;
  float a;
  float b;
  if (stdlib_base_is_nanf(x) || stdlib_base_is_nanf(y)) {
    return 0.0f / 0.0f;
  }
  if (stdlib_base_is_infinitef(x) || stdlib_base_is_infinitef(y)) {
    return INFINITY;
  }
  a = x;
  b = y;
  if (a < 0.0f) {
    a = -a;
  }
  if (b < 0.0f) {
    b = -b;
  }
  if (a < b) {
    tmp = b;
    b = a;
    a = tmp;
  }
  if (a == 0.0f) {
    return 0.0f;
  }
  b /= a;
  return a * stdlib_base_sqrtf(1.0f + (b * b));
}


x86 assembly (clang, -O0):
<stdlib_base_hypotf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <stdlib_base_is_nanf@plt>
cmp    $0x0,%rax
jne    116a <stdlib_base_hypotf+0x3a>
movss  -0xc(%rbp),%xmm0
call   1030 <stdlib_base_is_nanf@plt>
cmp    $0x0,%rax
je     117c <stdlib_base_hypotf+0x4c>
movss  0xe92(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    12b7 <stdlib_base_hypotf+0x187>
movss  -0x8(%rbp),%xmm0
call   1050 <stdlib_base_is_infinitef@plt>
cmp    $0x0,%rax
jne    11a4 <stdlib_base_hypotf+0x74>
movss  -0xc(%rbp),%xmm0
call   1050 <stdlib_base_is_infinitef@plt>
cmp    $0x0,%rax
je     11b9 <stdlib_base_hypotf+0x89>
mov    0x2e3d(%rip),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    12b7 <stdlib_base_hypotf+0x187>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x14(%rbp),%xmm0
jbe    11f1 <stdlib_base_hypotf+0xc1>
movss  -0x14(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x14(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x18(%rbp),%xmm0
jbe    1215 <stdlib_base_hypotf+0xe5>
movss  -0x18(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm1
movss  -0x18(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1246 <stdlib_base_hypotf+0x116>
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    126a <stdlib_base_hypotf+0x13a>
jp     126a <stdlib_base_hypotf+0x13a>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    12b7 <stdlib_base_hypotf+0x187>
movss  -0x14(%rbp),%xmm1
movss  -0x18(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xd63(%rip),%xmm1
addss  %xmm1,%xmm0
call   1040 <stdlib_base_sqrtf@plt>
movaps %xmm0,%xmm1
movss  -0x1c(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stdlib_base_hypotf>:
sub    $0x28,%rsp
movaps %xmm1,(%rsp)
movaps %xmm0,0x10(%rsp)
call   1030 <stdlib_base_is_nanf@plt>
movss  0xeb6(%rip),%xmm4
test   %rax,%rax
jne    118d <stdlib_base_hypotf+0x5d>
movaps (%rsp),%xmm0
call   1030 <stdlib_base_is_nanf@plt>
movss  0xea0(%rip),%xmm4
test   %rax,%rax
jne    118d <stdlib_base_hypotf+0x5d>
movaps 0x10(%rsp),%xmm0
call   1050 <stdlib_base_is_infinitef@plt>
test   %rax,%rax
jne    1182 <stdlib_base_hypotf+0x52>
movaps (%rsp),%xmm0
call   1050 <stdlib_base_is_infinitef@plt>
test   %rax,%rax
je     1195 <stdlib_base_hypotf+0x65>
mov    0x2e5f(%rip),%rax
movss  (%rax),%xmm4
movaps %xmm4,%xmm0
add    $0x28,%rsp
ret
movaps 0xe74(%rip),%xmm2
movaps 0x10(%rsp),%xmm3
movaps %xmm3,%xmm1
xorps  %xmm2,%xmm1
xorps  %xmm4,%xmm4
movaps %xmm3,%xmm0
cmpltss %xmm4,%xmm0
andps  %xmm0,%xmm1
andnps %xmm3,%xmm0
orps   %xmm1,%xmm0
movaps (%rsp),%xmm3
xorps  %xmm3,%xmm2
movaps %xmm3,%xmm1
cmpltss %xmm4,%xmm1
andps  %xmm1,%xmm2
andnps %xmm3,%xmm1
orps   %xmm2,%xmm1
movaps %xmm1,%xmm2
maxss  %xmm0,%xmm2
ucomiss %xmm4,%xmm2
jne    11e1 <stdlib_base_hypotf+0xb1>
jnp    118d <stdlib_base_hypotf+0x5d>
minss  %xmm1,%xmm0
divss  %xmm2,%xmm0
mulss  %xmm0,%xmm0
addss  0xe0f(%rip),%xmm0
movaps %xmm2,(%rsp)
call   1040 <stdlib_base_sqrtf@plt>
movaps %xmm0,%xmm4
mulss  (%rsp),%xmm4
jmp    118d <stdlib_base_hypotf+0x5d>

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

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