int main() {
  volatile double a = 0.125;
  if (__builtin_fabs(a) != 0.125) {
    return 1;
  }
  volatile double b = -0.125;
  if (__builtin_fabs(b) != 0.125) {
    return 1;
  }
  volatile double c = 0.;
  if (__builtin_fabs(c) != 0.) {
    return 1;
  }
  volatile double d = -0.;
  if (__builtin_fabs(d) != 0.) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movsd  0xeed(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movaps 0xefc(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xed0(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1145 <main+0x45>
jp     1145 <main+0x45>
jmp    1151 <main+0x51>
movl   $0x1,-0x4(%rbp)
jmp    121b <main+0x11b>
movsd  0xeaf(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movaps 0xeb6(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xe8a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    118b <main+0x8b>
jp     118b <main+0x8b>
jmp    1197 <main+0x97>
movl   $0x1,-0x4(%rbp)
jmp    121b <main+0x11b>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movaps 0xe75(%rip),%xmm1
pand   %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11c7 <main+0xc7>
jp     11c7 <main+0xc7>
jmp    11d3 <main+0xd3>
movl   $0x1,-0x4(%rbp)
jmp    121b <main+0x11b>
movsd  0xe35(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movaps 0xe34(%rip),%xmm1
pand   %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1208 <main+0x108>
jp     1208 <main+0x108>
jmp    1214 <main+0x114>
movl   $0x1,-0x4(%rbp)
jmp    121b <main+0x11b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
movabs $0x3fc0000000000000,%rax
mov    %rax,-0x8(%rsp)
movsd  -0x8(%rsp),%xmm0
andpd  0xee3(%rip),%xmm0
mov    $0x1,%eax
ucomisd 0xee6(%rip),%xmm0
jne    112e <main+0x2e>
jnp    112f <main+0x2f>
ret
movabs $0xbfc0000000000000,%rax
mov    %rax,-0x10(%rsp)
movsd  -0x10(%rsp),%xmm0
andpd  0xeb4(%rip),%xmm0
mov    $0x1,%eax
ucomisd 0xeb7(%rip),%xmm0
jne    112e <main+0x2e>
jp     112e <main+0x2e>
movq   $0x0,-0x18(%rsp)
movsd  -0x18(%rsp),%xmm1
mov    $0x1,%eax
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    112e <main+0x2e>
jp     112e <main+0x2e>
movabs $0x8000000000000000,%rax
mov    %rax,-0x20(%rsp)
cmpneqsd -0x20(%rsp),%xmm0
movq   %xmm0,%rax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
store volatile double 1.250000e-01, double* %2
%6 = load volatile double, double* %2
%7 = call double @llvm.fabs.f64(double %6)
%8 = fcmp une double %7, 1.250000e-01
br i1 %8, label %9, label %10
9: ; preds = %0
store i32 1, i32* %1
br label %26
10: ; preds = %0
store volatile double -1.250000e-01, double* %3
%11 = load volatile double, double* %3
%12 = call double @llvm.fabs.f64(double %11)
%13 = fcmp une double %12, 1.250000e-01
br i1 %13, label %14, label %15
14: ; preds = %10
store i32 1, i32* %1
br label %26
15: ; preds = %10
store volatile double 0.000000e+00, double* %4
%16 = load volatile double, double* %4
%17 = call double @llvm.fabs.f64(double %16)
%18 = fcmp une double %17, 0.000000e+00
br i1 %18, label %19, label %20
19: ; preds = %15
store i32 1, i32* %1
br label %26
20: ; preds = %15
store volatile double -0.000000e+00, double* %5
%21 = load volatile double, double* %5
%22 = call double @llvm.fabs.f64(double %21)
%23 = fcmp une double %22, 0.000000e+00
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 double
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = bitcast double* %1 to i8*
store volatile double 1.250000e-01, double* %1
%6 = load volatile double, double* %1
%7 = tail call double @llvm.fabs.f64(double %6)
%8 = fcmp une double %7, 1.250000e-01
br i1 %8, label %27, label %9
9: ; preds = %0
%10 = bitcast double* %2 to i8*
store volatile double -1.250000e-01, double* %2
%11 = load volatile double, double* %2
%12 = tail call double @llvm.fabs.f64(double %11)
%13 = fcmp une double %12, 1.250000e-01
br i1 %13, label %25, label %14
14: ; preds = %9
%15 = bitcast double* %3 to i8*
store volatile double 0.000000e+00, double* %3
%16 = load volatile double, double* %3
%17 = fcmp une double %16, 0.000000e+00
br i1 %17, label %23, label %18
18: ; preds = %14
%19 = bitcast double* %4 to i8*
store volatile double -0.000000e+00, double* %4
%20 = load volatile double, double* %4
%21 = fcmp une double %20, 0.000000e+00
%22 = zext i1 %21 to i32
br label %23
23: ; preds = %14, %18
%24 = phi i32 [ %22, %18 ], [ 1, %14 ]
br label %25
25: ; preds = %9, %23
%26 = phi i32 [ %24, %23 ], [ 1, %9 ]
br label %27
27: ; preds = %0, %25
%28 = phi i32 [ %26, %25 ], [ 1, %0 ]
ret i32 %28
}