int main() {
  volatile float a = __builtin_inff();
  if (!__builtin_isinf(a)) {
    return 1;
  }
  volatile double b = __builtin_inf();
  if (!__builtin_isinf(b)) {
    return 1;
  }
  volatile float d = __builtin_nanf("");
  if (__builtin_isinf(d)) {
    return 1;
  }
  volatile double e = __builtin_nan("");
  if (__builtin_isinf(e)) {
    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
movaps 0xeec(%rip),%xmm1
pand   %xmm1,%xmm0
movss  0xed0(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    1144 <main+0x44>
jp     1144 <main+0x44>
jmp    1150 <main+0x50>
movl   $0x1,-0x4(%rbp)
jmp    121e <main+0x11e>
movsd  0xed8(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movaps 0xeb7(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xebb(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    118a <main+0x8a>
jp     118a <main+0x8a>
jmp    1196 <main+0x96>
movl   $0x1,-0x4(%rbp)
jmp    121e <main+0x11e>
movss  0xe66(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movaps 0xe61(%rip),%xmm1
pand   %xmm1,%xmm0
movss  0xe45(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    11d6 <main+0xd6>
jp     11d6 <main+0xd6>
movl   $0x1,-0x4(%rbp)
jmp    121e <main+0x11e>
movsd  0xe5a(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movaps 0xe31(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xe35(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1217 <main+0x117>
jp     1217 <main+0x117>
movl   $0x1,-0x4(%rbp)
jmp    121e <main+0x11e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
movl   $0x7f800000,-0x14(%rsp)
7f
movss  -0x14(%rsp),%xmm0
andps  0xeeb(%rip),%xmm0
ucomiss 0xf04(%rip),%xmm0
jb     1169 <main+0x69>
movabs $0x7ff0000000000000,%rax
mov    %rax,-0x8(%rsp)
movsd  -0x8(%rsp),%xmm0
andpd  0xed5(%rip),%xmm0
ucomisd 0xee5(%rip),%xmm0
jb     1169 <main+0x69>
movl   $0x7fc00000,-0x18(%rsp)
7f
movss  -0x18(%rsp),%xmm0
andps  0xea6(%rip),%xmm0
mov    $0x1,%eax
ucomiss 0xeba(%rip),%xmm0
jb     116f <main+0x6f>
ret
mov    $0x1,%eax
ret
movabs $0x7ff8000000000000,%rax
mov    %rax,-0x10(%rsp)
movsd  -0x10(%rsp),%xmm0
andpd  0xe84(%rip),%xmm0
xor    %eax,%eax
ucomisd 0xe92(%rip),%xmm0
setae  %al
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca double
%4 = alloca float
%5 = alloca double
store i32 0, i32* %1
store volatile float 0x7FF0000000000000, float* %2
%6 = load volatile float, float* %2
%7 = call float @llvm.fabs.f32(float %6)
%8 = fcmp oeq float %7, 0x7FF0000000000000
br i1 %8, label %10, label %9
9: ; preds = %0
store i32 1, i32* %1
br label %26
10: ; preds = %0
store volatile double 0x7FF0000000000000, double* %3
%11 = load volatile double, double* %3
%12 = call double @llvm.fabs.f64(double %11)
%13 = fcmp oeq double %12, 0x7FF0000000000000
br i1 %13, label %15, label %14
14: ; preds = %10
store i32 1, i32* %1
br label %26
15: ; preds = %10
store volatile float 0x7FF8000000000000, float* %4
%16 = load volatile float, float* %4
%17 = call float @llvm.fabs.f32(float %16)
%18 = fcmp oeq float %17, 0x7FF0000000000000
br i1 %18, label %19, label %20
19: ; preds = %15
store i32 1, i32* %1
br label %26
20: ; preds = %15
store volatile double 0x7FF8000000000000, double* %5
%21 = load volatile double, double* %5
%22 = call double @llvm.fabs.f64(double %21)
%23 = fcmp oeq double %22, 0x7FF0000000000000
br i1 %23, label %24, label %25
24: ; preds = %20
store i32 1, i32* %1
br label %26
25: ; preds = %20
store i32 0, i32* %1
br label %26
26: ; preds = %25, %24, %19, %14, %9
%27 = load i32, i32* %1
ret i32 %27
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca float
%2 = alloca double
%3 = alloca float
%4 = alloca double
%5 = bitcast float* %1 to i8*
store volatile float 0x7FF0000000000000, float* %1
%6 = load volatile float, float* %1
%7 = tail call float @llvm.fabs.f32(float %6)
%8 = fcmp oeq float %7, 0x7FF0000000000000
br i1 %8, label %9, label %29
9: ; preds = %0
%10 = bitcast double* %2 to i8*
store volatile double 0x7FF0000000000000, double* %2
%11 = load volatile double, double* %2
%12 = tail call double @llvm.fabs.f64(double %11)
%13 = fcmp oeq double %12, 0x7FF0000000000000
br i1 %13, label %14, label %27
14: ; preds = %9
%15 = bitcast float* %3 to i8*
store volatile float 0x7FF8000000000000, float* %3
%16 = load volatile float, float* %3
%17 = tail call float @llvm.fabs.f32(float %16)
%18 = fcmp oeq float %17, 0x7FF0000000000000
br i1 %18, label %25, label %19
19: ; preds = %14
%20 = bitcast double* %4 to i8*
store volatile double 0x7FF8000000000000, double* %4
%21 = load volatile double, double* %4
%22 = tail call double @llvm.fabs.f64(double %21)
%23 = fcmp oeq double %22, 0x7FF0000000000000
%24 = zext i1 %23 to i32
br label %25
25: ; preds = %14, %19
%26 = phi i32 [ %24, %19 ], [ 1, %14 ]
br label %27
27: ; preds = %9, %25
%28 = phi i32 [ %26, %25 ], [ 1, %9 ]
br label %29
29: ; preds = %0, %27
%30 = phi i32 [ %28, %27 ], [ 1, %0 ]
ret i32 %30
}