#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;
float NAN;
scalar_t__ isinf(float);
scalar_t__ isnan(double);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  float a = NAN;
  if (isnan(a))
    printf("a is NAN\n");
  if (a != a)
    printf("a is NAN\n");
  if (!isinf(a))
    printf("a is not INF\n");
  float b = INFINITY;
  if (isinf(b))
    printf("b is INF\n");
  if (!isnan(b))
    printf("b is not NAN\n");
  double _NAN = 0.0 / 0.0;
  double POS_INF = 1.0 / 0.0;
  double NEG_INF = -1.0 / 0.0;
  printf("NAN: %f\n", _NAN);
  printf("POS_INF: %f\n", POS_INF);
  printf("NEG_INF: %f\n", NEG_INF);
  if (isnan(_NAN))
    printf("NAN is NAN\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eb2(%rip),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1040 <isnan@plt>
cmp    $0x0,%rax
je     1175 <main+0x45>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jne    118f <main+0x5f>
jp     118f <main+0x5f>
jmp    119d <main+0x6d>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
call   1050 <isinf@plt>
cmp    $0x0,%rax
jne    11bf <main+0x8f>
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e1a(%rip),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
call   1050 <isinf@plt>
cmp    $0x0,%rax
je     11f1 <main+0xc1>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1040 <isnan@plt>
cmp    $0x0,%rax
jne    1217 <main+0xe7>
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  0xdf1(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xddc(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xdc7(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xdfe(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm0
lea    0xdf4(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x28(%rbp),%xmm0
lea    0xdee(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
call   1040 <isnan@plt>
cmp    $0x0,%rax
je     1299 <main+0x169>
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2eb0(%rip),%rax
movss  (%rax),%xmm0
movss  %xmm0,0x4(%rsp)
cvtss2sd %xmm0,%xmm0
call   1050 <isnan@plt>
test   %rax,%rax
je     116c <main+0x2c>
lea    0xf02(%rip),%rdi
call   1030 <puts@plt>
movss  0x4(%rsp),%xmm0
ucomiss %xmm0,%xmm0
jp     123c <main+0xfc>
call   1060 <isinf@plt>
test   %rax,%rax
jne    1191 <main+0x51>
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e48(%rip),%rax
movss  (%rax),%xmm0
movss  %xmm0,0x4(%rsp)
call   1060 <isinf@plt>
test   %rax,%rax
je     11b8 <main+0x78>
lea    0xead(%rip),%rdi
call   1030 <puts@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1050 <isnan@plt>
test   %rax,%rax
jne    11d8 <main+0x98>
lea    0xe75(%rip),%rdi
call   1030 <puts@plt>
lea    0xe39(%rip),%rdi
movsd  0xe19(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe2c(%rip),%rdi
movsd  0xe0b(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe23(%rip),%rdi
movsd  0xdfd(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0xdde(%rip),%xmm0
call   1050 <isnan@plt>
test   %rax,%rax
je     1238 <main+0xf8>
lea    0xe22(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xe26(%rip),%rdi
call   1030 <puts@plt>
movss  0x4(%rsp),%xmm0
jmp    117b <main+0x3b>

LLVM IR (-O0):
@NAN = global float 0.000000e+00
@.str = [10 x i8] c"a is NAN\0A\00"
@.str.1 = [14 x i8] c"a is not INF\0A\00"
@INFINITY = global float 0.000000e+00
@.str.2 = [10 x i8] c"b is INF\0A\00"
@.str.3 = [14 x i8] c"b is not NAN\0A\00"
@.str.4 = [9 x i8] c"NAN: %f\0A\00"
@.str.5 = [13 x i8] c"POS_INF: %f\0A\00"
@.str.6 = [13 x i8] c"NEG_INF: %f\0A\00"
@.str.7 = [12 x i8] c"NAN is NAN\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca double
%5 = alloca double
%6 = alloca double
store i32 0, i32* %1
%7 = load float, float* @NAN
store float %7, float* %2
%8 = load float, float* %2
%9 = fpext float %8 to double
%10 = call i64 @isnan(double %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %0
%15 = load float, float* %2
%16 = load float, float* %2
%17 = fcmp une float %15, %16
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %18, %14
%21 = load float, float* %2
%22 = call i64 @isinf(float %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %26, label %24
24: ; preds = %20
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %26
26: ; preds = %24, %20
%27 = load float, float* @INFINITY
store float %27, float* %3
%28 = load float, float* %3
%29 = call i64 @isinf(float %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %26
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %33
33: ; preds = %31, %26
%34 = load float, float* %3
%35 = fpext float %34 to double
%36 = call i64 @isnan(double %35)
%37 = icmp ne i64 %36, 0
br i1 %37, label %40, label %38
38: ; preds = %33
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
br label %40
40: ; preds = %38, %33
store double 0x7FF8000000000000, double* %4
store double 0x7FF0000000000000, double* %5
store double 0xFFF0000000000000, double* %6
%41 = load double, double* %4
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), double %41)
%43 = load double, double* %5
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), double %43)
%45 = load double, double* %6
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), double %45)
%47 = load double, double* %4
%48 = call i64 @isnan(double %47)
%49 = icmp ne i64 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %40
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
br label %52
52: ; preds = %50, %40
%53 = load i32, i32* %1
ret i32 %53
}

LLVM IR (-O2):
@NAN = global float 0.000000e+00
@INFINITY = global float 0.000000e+00
@.str.4 = [9 x i8] c"NAN: %f\0A\00"
@.str.5 = [13 x i8] c"POS_INF: %f\0A\00"
@.str.6 = [13 x i8] c"NEG_INF: %f\0A\00"
@str = [13 x i8] c"a is not INF\00"
@str.8 = [13 x i8] c"b is not NAN\00"
@str.9 = [11 x i8] c"NAN is NAN\00"
@str.10 = [9 x i8] c"b is INF\00"
@str.12 = [9 x i8] c"a is NAN\00"
define i32 @main() {
%1 = load float, float* @NAN
%2 = fpext float %1 to double
%3 = tail call i64 @isnan(double %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.12, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
%8 = fcmp uno float %1, 0.000000e+00
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.12, i64 0, i64 0))
br label %11
11: ; preds = %9, %7
%12 = tail call i64 @isinf(float %1)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %16
16: ; preds = %14, %11
%17 = load float, float* @INFINITY
%18 = tail call i64 @isinf(float %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %16
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.10, i64 0, i64 0))
br label %22
22: ; preds = %20, %16
%23 = fpext float %17 to double
%24 = tail call i64 @isnan(double %23)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.8, i64 0, i64 0))
br label %28
28: ; preds = %26, %22
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), double 0x7FF8000000000000)
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), double 0x7FF0000000000000)
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), double 0xFFF0000000000000)
%32 = tail call i64 @isnan(double 0x7FF8000000000000)
%33 = icmp eq i64 %32, 0
br i1 %33, label %36, label %34
34: ; preds = %28
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.9, i64 0, i64 0))
br label %36
36: ; preds = %34, %28
ret i32 0
}