#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 /*<<< orphan*/ printf(char *, double, char *);
int stdlib_base_is_negative_zero(double);
int main() {
  double x[] = {0.0, -0.0, 3.14, 0.0 / 0.0};
  bool b;
  int i;
  for (i = 0; i < 4; i++) {
    b = stdlib_base_is_negative_zero(x[i]);
    printf("Value: %lf. Is -0? %s.\n", x[i], (b) ? "True" : "False");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec1(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x38(%rbp)
cmpl   $0x4,-0x38(%rbp)
jge    11ba <main+0x9a>
movslq -0x38(%rbp),%rax
movsd  -0x30(%rbp,%rax,8),%xmm0
call   1040 <stdlib_base_is_negative_zero@plt>
mov    %eax,-0x34(%rbp)
movslq -0x38(%rbp),%rax
movsd  -0x30(%rbp,%rax,8),%xmm0
mov    -0x34(%rbp),%ecx
lea    0xeab(%rip),%rsi
lea    0xe9f(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1162 <main+0x42>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xorps  %xmm0,%xmm0
call   1040 <stdlib_base_is_negative_zero@plt>
test   %eax,%eax
lea    0xeff(%rip),%r15
lea    0xef3(%rip),%rbx
mov    %rbx,%rsi
cmove  %r15,%rsi
lea    0xecd(%rip),%r14
xorps  %xmm0,%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
movsd  0xea2(%rip),%xmm0
call   1040 <stdlib_base_is_negative_zero@plt>
test   %eax,%eax
mov    %rbx,%rsi
cmove  %r15,%rsi
mov    %r14,%rdi
movsd  0xe89(%rip),%xmm0
call   1030 <printf@plt>
movsd  0xe84(%rip),%xmm0
call   1040 <stdlib_base_is_negative_zero@plt>
test   %eax,%eax
mov    %rbx,%rsi
cmove  %r15,%rsi
mov    %r14,%rdi
movsd  0xe6b(%rip),%xmm0
call   1030 <printf@plt>
movsd  0xe66(%rip),%xmm0
call   1040 <stdlib_base_is_negative_zero@plt>
test   %eax,%eax
cmove  %r15,%rbx
mov    %r14,%rdi
movsd  0xe50(%rip),%xmm0
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.x = [4 x double] [double 0.000000e+00, double -0.000000e+00, double 3.140000e+00, double 0x7FF8000000000000]
@.str = [24 x i8] c"Value: %lf. Is -0? %s.\0A\00"
@.str.1 = [5 x i8] c"True\00"
@.str.2 = [6 x i8] c"False\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x double]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [4 x double]* %2 to i8*
store i32 0, i32* %4
br label %6
6: ; preds = %24, %0
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 4
br i1 %8, label %9, label %27
9: ; preds = %6
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 0, i64 %11
%13 = load double, double* %12
%14 = call i32 @stdlib_base_is_negative_zero(double %13)
store i32 %14, i32* %3
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 0, i64 %16
%18 = load double, double* %17
%19 = load i32, i32* %3
%20 = icmp ne i32 %19, 0
%21 = zext i1 %20 to i64
%22 = select i1 %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0)
%23 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), double %18, i8* %22)
br label %24
24: ; preds = %9
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %6
27: ; preds = %6
%28 = load i32, i32* %1
ret i32 %28
}

LLVM IR (-O2):
@.str = [24 x i8] c"Value: %lf. Is -0? %s.\0A\00"
@.str.1 = [5 x i8] c"True\00"
@.str.2 = [6 x i8] c"False\00"
define i32 @main() {
%1 = tail call i32 @stdlib_base_is_negative_zero(double 0.000000e+00)
%2 = icmp eq i32 %1, 0
%3 = select i1 %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), double 0.000000e+00, i8* %3)
%5 = tail call i32 @stdlib_base_is_negative_zero(double -0.000000e+00)
%6 = icmp eq i32 %5, 0
%7 = select i1 %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), double -0.000000e+00, i8* %7)
%9 = tail call i32 @stdlib_base_is_negative_zero(double 3.140000e+00)
%10 = icmp eq i32 %9, 0
%11 = select i1 %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), double 3.140000e+00, i8* %11)
%13 = tail call i32 @stdlib_base_is_negative_zero(double 0x7FF8000000000000)
%14 = icmp eq i32 %13, 0
%15 = select i1 %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), double 0x7FF8000000000000, i8* %15)
ret i32 0
}