#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 */
int is_na(int);
int isnan(double);
int /*<<< orphan*/ printf(char *, int);
double set_na();
int main() {
  double x = set_na();
  double y = x;
  printf("Is x=set_na() NA? %i\n", is_na(x));
  printf("Is x=set_na() NAN? %i\n", isnan(x));
  printf("Is y=x NA? %i\n", is_na(y));
  printf("Is 0/0 NA? %i\n", is_na(0 / 0.));
  printf("Is 8 NA? %i\n", is_na(8));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <set_na@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
cvttsd2si -0x8(%rbp),%edi
call   1030 <is_na@plt>
mov    %eax,%esi
lea    0xe8f(%rip),%rdi
call   1040 <printf@plt>
movsd  -0x8(%rbp),%xmm0
call   1060 <isnan@plt>
mov    %eax,%esi
lea    0xe8d(%rip),%rdi
call   1040 <printf@plt>
cvttsd2si -0x10(%rbp),%edi
call   1030 <is_na@plt>
mov    %eax,%esi
lea    0xe8c(%rip),%rdi
call   1040 <printf@plt>
call   1030 <is_na@plt>
mov    %eax,%esi
lea    0xe88(%rip),%rdi
call   1040 <printf@plt>
mov    $0x8,%edi
call   1030 <is_na@plt>
mov    %eax,%esi
lea    0xe7f(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1050 <set_na@plt>
movsd  %xmm0,0x8(%rsp)
cvttsd2si %xmm0,%ebx
mov    %ebx,%edi
call   1030 <is_na@plt>
lea    0xe9c(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
call   1060 <isnan@plt>
lea    0xe99(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %ebx,%edi
call   1030 <is_na@plt>
lea    0xe9b(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
call   1030 <is_na@plt>
lea    0xe97(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x8,%edi
call   1030 <is_na@plt>
lea    0xe8e(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Is x=set_na() NA? %i\0A\00"
@.str.1 = [23 x i8] c"Is x=set_na() NAN? %i\0A\00"
@.str.2 = [15 x i8] c"Is y=x NA? %i\0A\00"
@.str.3 = [15 x i8] c"Is 0/0 NA? %i\0A\00"
@.str.4 = [13 x i8] c"Is 8 NA? %i\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = call double (...) @set_na()
store double %3, double* %1
%4 = load double, double* %1
store double %4, double* %2
%5 = load double, double* %1
%6 = fptosi double %5 to i32
%7 = call i32 @is_na(i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load double, double* %1
%10 = call i32 @isnan(double %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = load double, double* %2
%13 = fptosi double %12 to i32
%14 = call i32 @is_na(i32 %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%16 = call i32 @is_na(i32 poison)
%17 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %16)
%18 = call i32 @is_na(i32 8)
%19 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %18)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Is x=set_na() NA? %i\0A\00"
@.str.1 = [23 x i8] c"Is x=set_na() NAN? %i\0A\00"
@.str.2 = [15 x i8] c"Is y=x NA? %i\0A\00"
@.str.3 = [15 x i8] c"Is 0/0 NA? %i\0A\00"
@.str.4 = [13 x i8] c"Is 8 NA? %i\0A\00"
define i32 @main() {
%1 = tail call double (...) @set_na()
%2 = fptosi double %1 to i32
%3 = tail call i32 @is_na(i32 %2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @isnan(double %1)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = tail call i32 @is_na(i32 %2)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = tail call i32 @is_na(i32 poison)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %9)
%11 = tail call i32 @is_na(i32 8)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %11)
ret i32 0
}