int main() {
  volatile float a = __builtin_nanf("");
  if (!__builtin_isnan(a)) {
    return 1;
  }
  volatile float b = __builtin_nansf("");
  if (!__builtin_isnan(b)) {
    return 1;
  }
  volatile double c = __builtin_nan("");
  if (!__builtin_isnan(c)) {
    return 1;
  }
  volatile double d = __builtin_nans("");
  if (!__builtin_isnan(d)) {
    return 1;
  }
  volatile long double e = __builtin_nanl("");
  if (!__builtin_isnan(e)) {
    return 1;
  }
  volatile long double f = __builtin_nansl("");
  if (!__builtin_isnan(f)) {
    return 1;
  }
  volatile float g = 0;
  if (__builtin_isnan(g)) {
    return 1;
  }
  volatile double h = 0;
  if (__builtin_isnan(h)) {
    return 1;
  }
  volatile long double i = 0;
  if (__builtin_isnan(i)) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movss  0xeed(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
ucomiss %xmm0,%xmm0
jp     1132 <main+0x32>
movl   $0x1,-0x4(%rbp)
jmp    1260 <main+0x160>
movss  0xeca(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
ucomiss %xmm0,%xmm0
jp     1159 <main+0x59>
movl   $0x1,-0x4(%rbp)
jmp    1260 <main+0x160>
movsd  0xea7(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm0,%xmm0
jp     1181 <main+0x81>
movl   $0x1,-0x4(%rbp)
jmp    1260 <main+0x160>
movsd  0xe87(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm0,%xmm0
jp     11a9 <main+0xa9>
movl   $0x1,-0x4(%rbp)
jmp    1260 <main+0x160>
flds   0xe51(%rip)
fstpt  -0x30(%rbp)
fldt   -0x30(%rbp)
fucomip %st(0),%st
jp     11ce <main+0xce>
jmp    11c2 <main+0xc2>
movl   $0x1,-0x4(%rbp)
jmp    1260 <main+0x160>
fldt   0xe4c(%rip)
fstpt  -0x40(%rbp)
fldt   -0x40(%rbp)
fucomip %st(0),%st
jp     11f3 <main+0xf3>
jmp    11e7 <main+0xe7>
movl   $0x1,-0x4(%rbp)
jmp    1260 <main+0x160>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x44(%rbp)
movss  -0x44(%rbp),%xmm0
ucomiss %xmm0,%xmm0
jnp    1215 <main+0x115>
movl   $0x1,-0x4(%rbp)
jmp    1260 <main+0x160>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
ucomisd %xmm0,%xmm0
jnp    1238 <main+0x138>
movl   $0x1,-0x4(%rbp)
jmp    1260 <main+0x160>
fldz
fstpt  -0x60(%rbp)
fldt   -0x60(%rbp)
fucomip %st(0),%st
jnp    1259 <main+0x159>
jmp    124d <main+0x14d>
movl   $0x1,-0x4(%rbp)
jmp    1260 <main+0x160>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
movl   $0x7fc00000,-0x54(%rsp)
7f
movss  -0x54(%rsp),%xmm0
mov    $0x1,%eax
ucomiss %xmm0,%xmm0
jp     1119 <main+0x19>
ret
movl   $0x7fa00000,-0x58(%rsp)
7f
movss  -0x58(%rsp),%xmm0
mov    $0x1,%eax
ucomiss %xmm0,%xmm0
jnp    1118 <main+0x18>
movabs $0x7ff8000000000000,%rax
mov    %rax,-0x40(%rsp)
movsd  -0x40(%rsp),%xmm0
mov    $0x1,%eax
ucomisd %xmm0,%xmm0
jnp    1118 <main+0x18>
movabs $0x7ff4000000000000,%rax
mov    %rax,-0x48(%rsp)
movsd  -0x48(%rsp),%xmm0
mov    $0x1,%eax
ucomisd %xmm0,%xmm0
jnp    1118 <main+0x18>
flds   0xe89(%rip)
fstpt  -0x18(%rsp)
fldt   -0x18(%rsp)
mov    $0x1,%eax
fucomip %st(0),%st
jnp    1118 <main+0x18>
fldt   0xe82(%rip)
fstpt  -0x28(%rsp)
fldt   -0x28(%rsp)
mov    $0x1,%eax
fucomip %st(0),%st
jnp    1118 <main+0x18>
movl   $0x0,-0x5c(%rsp)
movss  -0x5c(%rsp),%xmm0
ucomiss %xmm0,%xmm0
jp     11dd <main+0xdd>
movq   $0x0,-0x50(%rsp)
movsd  -0x50(%rsp),%xmm0
ucomisd %xmm0,%xmm0
jp     11dd <main+0xdd>
fldz
fstpt  -0x38(%rsp)
fldt   -0x38(%rsp)
xor    %eax,%eax
fucomip %st(0),%st
setp   %al
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca double
%5 = alloca double
%6 = alloca x86_fp80
%7 = alloca x86_fp80
%8 = alloca float
%9 = alloca double
%10 = alloca x86_fp80
store i32 0, i32* %1
store volatile float 0x7FF8000000000000, float* %2
%11 = load volatile float, float* %2
%12 = fcmp uno float %11, %11
br i1 %12, label %14, label %13
13: ; preds = %0
store i32 1, i32* %1
br label %47
14: ; preds = %0
store volatile float 0x7FF4000000000000, float* %3
%15 = load volatile float, float* %3
%16 = fcmp uno float %15, %15
br i1 %16, label %18, label %17
17: ; preds = %14
store i32 1, i32* %1
br label %47
18: ; preds = %14
store volatile double 0x7FF8000000000000, double* %4
%19 = load volatile double, double* %4
%20 = fcmp uno double %19, %19
br i1 %20, label %22, label %21
21: ; preds = %18
store i32 1, i32* %1
br label %47
22: ; preds = %18
store volatile double 0x7FF4000000000000, double* %5
%23 = load volatile double, double* %5
%24 = fcmp uno double %23, %23
br i1 %24, label %26, label %25
25: ; preds = %22
store i32 1, i32* %1
br label %47
26: ; preds = %22
store volatile x86_fp80 0xK7FFFC000000000000000, x86_fp80* %6
%27 = load volatile x86_fp80, x86_fp80* %6
%28 = fcmp uno x86_fp80 %27, %27
br i1 %28, label %30, label %29
29: ; preds = %26
store i32 1, i32* %1
br label %47
30: ; preds = %26
store volatile x86_fp80 0xK7FFFA000000000000000, x86_fp80* %7
%31 = load volatile x86_fp80, x86_fp80* %7
%32 = fcmp uno x86_fp80 %31, %31
br i1 %32, label %34, label %33
33: ; preds = %30
store i32 1, i32* %1
br label %47
34: ; preds = %30
store volatile float 0.000000e+00, float* %8
%35 = load volatile float, float* %8
%36 = fcmp uno float %35, %35
br i1 %36, label %37, label %38
37: ; preds = %34
store i32 1, i32* %1
br label %47
38: ; preds = %34
store volatile double 0.000000e+00, double* %9
%39 = load volatile double, double* %9
%40 = fcmp uno double %39, %39
br i1 %40, label %41, label %42
41: ; preds = %38
store i32 1, i32* %1
br label %47
42: ; preds = %38
store volatile x86_fp80 0xK00000000000000000000, x86_fp80* %10
%43 = load volatile x86_fp80, x86_fp80* %10
%44 = fcmp uno x86_fp80 %43, %43
br i1 %44, label %45, label %46
45: ; preds = %42
store i32 1, i32* %1
br label %47
46: ; preds = %42
store i32 0, i32* %1
br label %47
47: ; preds = %46, %45, %41, %37, %33, %29, %25, %21, %17, %13
%48 = load i32, i32* %1
ret i32 %48
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca double
%4 = alloca double
%5 = alloca x86_fp80
%6 = alloca x86_fp80
%7 = alloca float
%8 = alloca double
%9 = alloca x86_fp80
%10 = bitcast float* %1 to i8*
store volatile float 0x7FF8000000000000, float* %1
%11 = load volatile float, float* %1
%12 = fcmp uno float %11, 0.000000e+00
br i1 %12, label %13, label %60
13: ; preds = %0
%14 = bitcast float* %2 to i8*
store volatile float 0x7FF4000000000000, float* %2
%15 = load volatile float, float* %2
%16 = fcmp uno float %15, 0.000000e+00
br i1 %16, label %17, label %58
17: ; preds = %13
%18 = bitcast double* %3 to i8*
store volatile double 0x7FF8000000000000, double* %3
%19 = load volatile double, double* %3
%20 = fcmp uno double %19, 0.000000e+00
br i1 %20, label %21, label %56
21: ; preds = %17
%22 = bitcast double* %4 to i8*
store volatile double 0x7FF4000000000000, double* %4
%23 = load volatile double, double* %4
%24 = fcmp uno double %23, 0.000000e+00
br i1 %24, label %25, label %54
25: ; preds = %21
%26 = bitcast x86_fp80* %5 to i8*
store volatile x86_fp80 0xK7FFFC000000000000000, x86_fp80* %5
%27 = load volatile x86_fp80, x86_fp80* %5
%28 = fcmp uno x86_fp80 %27, 0xK00000000000000000000
br i1 %28, label %29, label %52
29: ; preds = %25
%30 = bitcast x86_fp80* %6 to i8*
store volatile x86_fp80 0xK7FFFA000000000000000, x86_fp80* %6
%31 = load volatile x86_fp80, x86_fp80* %6
%32 = fcmp uno x86_fp80 %31, 0xK00000000000000000000
br i1 %32, label %33, label %50
33: ; preds = %29
%34 = bitcast float* %7 to i8*
store volatile float 0.000000e+00, float* %7
%35 = load volatile float, float* %7
%36 = fcmp uno float %35, 0.000000e+00
br i1 %36, label %48, label %37
37: ; preds = %33
%38 = bitcast double* %8 to i8*
store volatile double 0.000000e+00, double* %8
%39 = load volatile double, double* %8
%40 = fcmp uno double %39, 0.000000e+00
br i1 %40, label %46, label %41
41: ; preds = %37
%42 = bitcast x86_fp80* %9 to i8*
store volatile x86_fp80 0xK00000000000000000000, x86_fp80* %9
%43 = load volatile x86_fp80, x86_fp80* %9
%44 = fcmp uno x86_fp80 %43, 0xK00000000000000000000
%45 = zext i1 %44 to i32
br label %46
46: ; preds = %37, %41
%47 = phi i32 [ %45, %41 ], [ 1, %37 ]
br label %48
48: ; preds = %33, %46
%49 = phi i32 [ %47, %46 ], [ 1, %33 ]
br label %50
50: ; preds = %29, %48
%51 = phi i32 [ %49, %48 ], [ 1, %29 ]
br label %52
52: ; preds = %25, %50
%53 = phi i32 [ %51, %50 ], [ 1, %25 ]
br label %54
54: ; preds = %21, %52
%55 = phi i32 [ %53, %52 ], [ 1, %21 ]
br label %56
56: ; preds = %17, %54
%57 = phi i32 [ %55, %54 ], [ 1, %17 ]
br label %58
58: ; preds = %13, %56
%59 = phi i32 [ %57, %56 ], [ 1, %13 ]
br label %60
60: ; preds = %0, %58
%61 = phi i32 [ %59, %58 ], [ 1, %0 ]
ret i32 %61
}