#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 _cargo_nearly_equal(double a, double b, double epsilon) {
  double largest;
  double diff = fabs(a - b);
  a = (double)fabs(a);
  b = (double)fabs(b);
  largest = (b > a) ? b : a;
  if (diff <= (largest * epsilon))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<_cargo_nearly_equal>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movaps 0xedc(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movaps 0xec7(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm0
movaps 0xeb2(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1176 <_cargo_nearly_equal+0x76>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    1180 <_cargo_nearly_equal+0x80>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     11af <_cargo_nearly_equal+0xaf>
movl   $0x1,-0x4(%rbp)
jmp    11b6 <_cargo_nearly_equal+0xb6>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_cargo_nearly_equal>:
movapd %xmm0,%xmm3
subsd  %xmm1,%xmm3
movapd 0xef0(%rip),%xmm4
andpd  %xmm4,%xmm3
andpd  %xmm4,%xmm0
andpd  %xmm4,%xmm1
maxsd  %xmm0,%xmm1
mulsd  %xmm2,%xmm1
xor    %eax,%eax
ucomisd %xmm3,%xmm1
setae  %al
ret

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

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