#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 approximatelyEqual(double x, double y) {
  double appr;
  appr = fabs(x - y) / ((fabs(x) > fabs(y) ? fabs(x) : fabs(y)));
  if (appr < 0.000001)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<approximatelyEqual>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movaps 0xee1(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movaps 0xecc(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
movaps 0xebc(%rip),%xmm2
pand   %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    116c <approximatelyEqual+0x6c>
movsd  -0x10(%rbp),%xmm0
movaps 0xea2(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1181 <approximatelyEqual+0x81>
movsd  -0x18(%rbp),%xmm0
movaps 0xe88(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe74(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11b3 <approximatelyEqual+0xb3>
movl   $0x1,-0x4(%rbp)
jmp    11ba <approximatelyEqual+0xba>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<approximatelyEqual>:
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
movapd 0xef0(%rip),%xmm3
andpd  %xmm3,%xmm2
andpd  %xmm3,%xmm0
andpd  %xmm3,%xmm1
maxsd  %xmm1,%xmm0
divsd  %xmm0,%xmm2
movsd  0xee4(%rip),%xmm0
xor    %eax,%eax
ucomisd %xmm2,%xmm0
seta   %al
ret

LLVM IR (-O0):
define i32 @approximatelyEqual(double %0, double %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
%7 = load double, double* %4
%8 = load double, double* %5
%9 = fsub double %7, %8
%10 = call double @llvm.fabs.f64(double %9)
%11 = load double, double* %4
%12 = call double @llvm.fabs.f64(double %11)
%13 = load double, double* %5
%14 = call double @llvm.fabs.f64(double %13)
%15 = fcmp ogt double %12, %14
br i1 %15, label %16, label %19
16: ; preds = %2
%17 = load double, double* %4
%18 = call double @llvm.fabs.f64(double %17)
br label %22
19: ; preds = %2
%20 = load double, double* %5
%21 = call double @llvm.fabs.f64(double %20)
br label %22
22: ; preds = %19, %16
%23 = phi double [ %18, %16 ], [ %21, %19 ]
%24 = fdiv double %10, %23
store double %24, double* %6
%25 = load double, double* %6
%26 = fcmp olt double %25, 0x3EB0C6F7A0B5ED8D
br i1 %26, label %27, label %28
27: ; preds = %22
store i32 1, i32* %3
br label %29
28: ; preds = %22
store i32 0, i32* %3
br label %29
29: ; preds = %28, %27
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
define i32 @approximatelyEqual(double %0, double %1) {
%3 = fsub double %0, %1
%4 = tail call double @llvm.fabs.f64(double %3)
%5 = tail call double @llvm.fabs.f64(double %0)
%6 = tail call double @llvm.fabs.f64(double %1)
%7 = fcmp ogt double %5, %6
%8 = select i1 %7, double %5, double %6
%9 = fdiv double %4, %8
%10 = fcmp olt double %9, 0x3EB0C6F7A0B5ED8D
%11 = zext i1 %10 to i32
ret i32 %11
}