#include <stdio.h>
#include <mpfr.h>
#include "fenv_mpfr.h"
#include <stdint.h>
typedef unsigned __int128 u128;
typedef uint64_t u64;
typedef union {u128 a; u64 b[2]; __float128 f;} b128u128_u;
__float128 ref_hypotq(__float128 x, __float128 y){
b128u128_u xi = {.f = x}, yi = {.f = y};
if((xi.a<<1)<((u128)0xffffull<<112) && (xi.a<<1)>((u128)0x7fffull<<113)){ xi.b[1] |= 1ull<<47;
return xi.f; }
if((yi.a<<1)<((u128)0xffffull<<112) && (yi.a<<1)>((u128)0x7fffull<<113)){ yi.b[1] |= 1ull<<47;
return yi.f; }
if((xi.a<<1) == 0){ yi.b[1] = (yi.b[1]<<1)>>1;
return yi.f;
}
if((yi.a<<1) == 0){ xi.b[1] = (xi.b[1]<<1)>>1;
return xi.f;
}
mpfr_t xm, ym;
mpfr_init2 (xm, 113);
mpfr_init2 (ym, 113);
mpfr_set_float128 (xm, x, MPFR_RNDN);
mpfr_set_float128 (ym, y, MPFR_RNDN);
int inex = mpfr_hypot (xm, xm, ym, rnd2[rnd]);
mpfr_subnormalize (xm, inex, rnd2[rnd]);
__float128 ret = mpfr_get_float128 (xm, MPFR_RNDN);
mpfr_clear (xm);
mpfr_clear (ym);
return ret;
}