#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 fabs(double);
int approx(double a, double b) {
  double da = fabs(a);
  double db = fabs(b);
  int samesigns = (da == a) == (db == b);
  if (da > db) {
    double tmp = da;
    da = db;
    db = tmp;
  }
  return samesigns && da >= (db * .9999999);
}


x86 assembly (clang, -O0):
<approx>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movaps 0xee6(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movaps 0xed1(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
ucomisd -0x8(%rbp),%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%eax
movsd  -0x20(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
sete   %cl
setnp  %dl
and    %dl,%cl
and    $0x1,%cl
movzbl %cl,%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x24(%rbp)
movsd  -0x18(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11a2 <approx+0xa2>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x24(%rbp)
mov    %al,-0x31(%rbp)
je     11cd <approx+0xcd>
movsd  -0x18(%rbp),%xmm0
movsd  0xe52(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
ucomisd %xmm1,%xmm0
setae  %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<approx>:
movapd 0xef8(%rip),%xmm2
movapd %xmm0,%xmm3
andpd  %xmm2,%xmm3
andpd  %xmm1,%xmm2
movapd %xmm3,%xmm4
maxsd  %xmm2,%xmm4
ucomisd %xmm1,%xmm2
minsd  %xmm3,%xmm2
setnp  %al
sete   %cl
and    %al,%cl
ucomisd %xmm0,%xmm3
setp   %al
setne  %dl
or     %al,%dl
xor    %cl,%dl
mulsd  0xece(%rip),%xmm4
ucomisd %xmm4,%xmm2
setae  %al
and    %dl,%al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @approx(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i32
%8 = alloca double
store double %0, double* %3
store double %1, double* %4
%9 = load double, double* %3
%10 = call double @llvm.fabs.f64(double %9)
store double %10, double* %5
%11 = load double, double* %4
%12 = call double @llvm.fabs.f64(double %11)
store double %12, double* %6
%13 = load double, double* %5
%14 = load double, double* %3
%15 = fcmp oeq double %13, %14
%16 = zext i1 %15 to i32
%17 = load double, double* %6
%18 = load double, double* %4
%19 = fcmp oeq double %17, %18
%20 = zext i1 %19 to i32
%21 = icmp eq i32 %16, %20
%22 = zext i1 %21 to i32
store i32 %22, i32* %7
%23 = load double, double* %5
%24 = load double, double* %6
%25 = fcmp ogt double %23, %24
br i1 %25, label %26, label %30
26: ; preds = %2
%27 = load double, double* %5
store double %27, double* %8
%28 = load double, double* %6
store double %28, double* %5
%29 = load double, double* %8
store double %29, double* %6
br label %30
30: ; preds = %26, %2
%31 = load i32, i32* %7
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %38
33: ; preds = %30
%34 = load double, double* %5
%35 = load double, double* %6
%36 = fmul double %35, 0x3FEFFFFFCA501ACB
%37 = fcmp oge double %34, %36
br label %38
38: ; preds = %33, %30
%39 = phi i1 [ false, %30 ], [ %37, %33 ]
%40 = zext i1 %39 to i32
ret i32 %40
}

LLVM IR (-O2):
define i32 @approx(double %0, double %1) {
%3 = tail call double @llvm.fabs.f64(double %0)
%4 = tail call double @llvm.fabs.f64(double %1)
%5 = fcmp ogt double %3, %4
%6 = select i1 %5, double %3, double %4
%7 = select i1 %5, double %4, double %3
%8 = fcmp oeq double %4, %1
%9 = fcmp une double %3, %0
%10 = xor i1 %9, %8
%11 = fmul double %6, 0x3FEFFFFFCA501ACB
%12 = fcmp oge double %7, %11
%13 = select i1 %10, i1 %12, i1 false
%14 = zext i1 %13 to i32
ret i32 %14
}