#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 */
double DBL_EPSILON;
scalar_t__ NAN;
int /*<<< orphan*/ check(char *, int);
void double_test_value(void) {
  volatile double Inf_var, NaN_var, zero_var, one_var;
  double x1, x2;
  zero_var = 0.0;
  one_var = 1.0;
  NaN_var = zero_var / zero_var;
  Inf_var = one_var / zero_var;
  (void)&zero_var;
  (void)&one_var;
  (void)&NaN_var;
  (void)&Inf_var;
  check("double"
        " inf == inf",
        Inf_var == Inf_var);
  check("double"
        " -inf == -inf",
        -Inf_var == -Inf_var);
  check("double"
        " inf != -inf",
        Inf_var != -Inf_var);
  check("double"
        " NaN != NaN",
        NaN_var != NaN_var);
  check("double"
        " NAN != NAN",
        NAN != NAN);
  x1 = 1.0;
  x2 = x1 + DBL_EPSILON;
  check("double"
        " 1 != 1+EPSILON",
        x1 != x2);
  x1 = 1.0;
  x2 = x1 - DBL_EPSILON;
  check("double"
        " 1 != 1-EPSILON",
        x1 != x2);
}


x86 assembly (clang, -O0):
<double_test_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xed8(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%esi
lea    0xe93(%rip),%rdi
call   1030 <check@plt>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x8(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%esi
lea    0xe50(%rip),%rdi
call   1030 <check@plt>
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
ucomisd %xmm1,%xmm0
setne  %al
setp   %cl
or     %cl,%al
and    $0x1,%al
movzbl %al,%esi
lea    0xe26(%rip),%rdi
call   1030 <check@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
ucomisd %xmm1,%xmm0
setne  %al
setp   %cl
or     %cl,%al
and    $0x1,%al
movzbl %al,%esi
lea    0xe12(%rip),%rdi
call   1030 <check@plt>
mov    0x2dbd(%rip),%rax
mov    (%rax),%rax
mov    0x2db3(%rip),%rcx
cmp    (%rcx),%rax
setne  %al
and    $0x1,%al
movzbl %al,%esi
lea    0xdfc(%rip),%rdi
call   1030 <check@plt>
movsd  0xd9c(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    0x2d6b(%rip),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
ucomisd -0x30(%rbp),%xmm0
setne  %al
setp   %cl
or     %cl,%al
and    $0x1,%al
movzbl %al,%esi
lea    0xdc9(%rip),%rdi
call   1030 <check@plt>
movsd  0xd57(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    0x2d26(%rip),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
ucomisd -0x30(%rbp),%xmm0
setne  %al
setp   %cl
or     %cl,%al
and    $0x1,%al
movzbl %al,%esi
lea    0xd9a(%rip),%rdi
call   1030 <check@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<double_test_value>:
push   %rbx
sub    $0x20,%rsp
movq   $0x0,0x8(%rsp)
movabs $0x3ff0000000000000,%rax
mov    %rax,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
divsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x18(%rsp),%xmm0
divsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  (%rsp),%xmm0
cmpeqsd (%rsp),%xmm0
movq   %xmm0,%rsi
and    $0x1,%esi
lea    0xeae(%rip),%rdi
call   1030 <check@plt>
movsd  (%rsp),%xmm0
cmpeqsd (%rsp),%xmm0
movq   %xmm0,%rsi
and    $0x1,%esi
lea    0xea1(%rip),%rdi
call   1030 <check@plt>
movsd  (%rsp),%xmm0
movsd  (%rsp),%xmm1
xorpd  0xe60(%rip),%xmm1
cmpneqsd %xmm0,%xmm1
movq   %xmm1,%rsi
and    $0x1,%esi
lea    0xe8a(%rip),%rdi
call   1030 <check@plt>
movsd  0x10(%rsp),%xmm0
cmpneqsd 0x10(%rsp),%xmm0
movq   %xmm0,%rsi
and    $0x1,%esi
lea    0xe7c(%rip),%rdi
call   1030 <check@plt>
lea    0xe82(%rip),%rdi
xor    %esi,%esi
call   1030 <check@plt>
mov    0x2df9(%rip),%rbx
movsd  0xe19(%rip),%xmm1
movsd  (%rbx),%xmm0
addsd  %xmm1,%xmm0
cmpneqsd %xmm1,%xmm0
movq   %xmm0,%rsi
and    $0x1,%esi
lea    0xe62(%rip),%rdi
call   1030 <check@plt>
movsd  0xdf0(%rip),%xmm1
movapd %xmm1,%xmm0
subsd  (%rbx),%xmm0
cmpneqsd %xmm1,%xmm0
movq   %xmm0,%rsi
and    $0x1,%esi
lea    0xe4f(%rip),%rdi
add    $0x20,%rsp
pop    %rbx
jmp    1030 <check@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"double inf == inf\00"
@.str.1 = [20 x i8] c"double -inf == -inf\00"
@.str.2 = [19 x i8] c"double inf != -inf\00"
@.str.3 = [18 x i8] c"double NaN != NaN\00"
@.str.4 = [18 x i8] c"double NAN != NAN\00"
@NAN = global i64 0
@DBL_EPSILON = global double 0.000000e+00
@.str.5 = [22 x i8] c"double 1 != 1+EPSILON\00"
@.str.6 = [22 x i8] c"double 1 != 1-EPSILON\00"
define void @double_test_value() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store volatile double 0.000000e+00, double* %3
store volatile double 1.000000e+00, double* %4
%7 = load volatile double, double* %3
%8 = load volatile double, double* %3
%9 = fdiv double %7, %8
store volatile double %9, double* %2
%10 = load volatile double, double* %4
%11 = load volatile double, double* %3
%12 = fdiv double %10, %11
store volatile double %12, double* %1
%13 = load volatile double, double* %1
%14 = load volatile double, double* %1
%15 = fcmp oeq double %13, %14
%16 = zext i1 %15 to i32
%17 = call i32 @check(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load volatile double, double* %1
%19 = fneg double %18
%20 = load volatile double, double* %1
%21 = fneg double %20
%22 = fcmp oeq double %19, %21
%23 = zext i1 %22 to i32
%24 = call i32 @check(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = load volatile double, double* %1
%26 = load volatile double, double* %1
%27 = fneg double %26
%28 = fcmp une double %25, %27
%29 = zext i1 %28 to i32
%30 = call i32 @check(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %29)
%31 = load volatile double, double* %2
%32 = load volatile double, double* %2
%33 = fcmp une double %31, %32
%34 = zext i1 %33 to i32
%35 = call i32 @check(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %34)
%36 = load i64, i64* @NAN
%37 = load i64, i64* @NAN
%38 = icmp ne i64 %36, %37
%39 = zext i1 %38 to i32
%40 = call i32 @check(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %39)
store double 1.000000e+00, double* %5
%41 = load double, double* %5
%42 = load double, double* @DBL_EPSILON
%43 = fadd double %41, %42
store double %43, double* %6
%44 = load double, double* %5
%45 = load double, double* %6
%46 = fcmp une double %44, %45
%47 = zext i1 %46 to i32
%48 = call i32 @check(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 %47)
store double 1.000000e+00, double* %5
%49 = load double, double* %5
%50 = load double, double* @DBL_EPSILON
%51 = fsub double %49, %50
store double %51, double* %6
%52 = load double, double* %5
%53 = load double, double* %6
%54 = fcmp une double %52, %53
%55 = zext i1 %54 to i32
%56 = call i32 @check(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i32 %55)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"double inf == inf\00"
@.str.1 = [20 x i8] c"double -inf == -inf\00"
@.str.2 = [19 x i8] c"double inf != -inf\00"
@.str.3 = [18 x i8] c"double NaN != NaN\00"
@.str.4 = [18 x i8] c"double NAN != NAN\00"
@NAN = global i64 0
@DBL_EPSILON = global double 0.000000e+00
@.str.5 = [22 x i8] c"double 1 != 1+EPSILON\00"
@.str.6 = [22 x i8] c"double 1 != 1-EPSILON\00"
define void @double_test_value() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = bitcast double* %1 to i8*
%6 = bitcast double* %2 to i8*
%7 = bitcast double* %3 to i8*
%8 = bitcast double* %4 to i8*
store volatile double 0.000000e+00, double* %3
store volatile double 1.000000e+00, double* %4
%9 = load volatile double, double* %3
%10 = load volatile double, double* %3
%11 = fdiv double %9, %10
store volatile double %11, double* %2
%12 = load volatile double, double* %4
%13 = load volatile double, double* %3
%14 = fdiv double %12, %13
store volatile double %14, double* %1
%15 = load volatile double, double* %1
%16 = load volatile double, double* %1
%17 = fcmp oeq double %15, %16
%18 = zext i1 %17 to i32
%19 = tail call i32 @check(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = load volatile double, double* %1
%21 = load volatile double, double* %1
%22 = fcmp oeq double %20, %21
%23 = zext i1 %22 to i32
%24 = tail call i32 @check(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = load volatile double, double* %1
%26 = load volatile double, double* %1
%27 = fneg double %26
%28 = fcmp une double %25, %27
%29 = zext i1 %28 to i32
%30 = tail call i32 @check(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %29)
%31 = load volatile double, double* %2
%32 = load volatile double, double* %2
%33 = fcmp une double %31, %32
%34 = zext i1 %33 to i32
%35 = tail call i32 @check(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %34)
%36 = tail call i32 @check(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 0)
%37 = load double, double* @DBL_EPSILON
%38 = fadd double %37, 1.000000e+00
%39 = fcmp une double %38, 1.000000e+00
%40 = zext i1 %39 to i32
%41 = tail call i32 @check(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 %40)
%42 = load double, double* @DBL_EPSILON
%43 = fsub double 1.000000e+00, %42
%44 = fcmp une double %43, 1.000000e+00
%45 = zext i1 %44 to i32
%46 = tail call i32 @check(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i32 %45)
ret void
}