#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 DBL_EPSILON;
double DBL_MIN;
double fabs(double);
int double_equal(double a, double b) {
  double abs_diff, aa, bb, abs_max;
  if (a == b)
    return 1;
  abs_diff = fabs(a - b);
  aa = fabs(a);
  bb = fabs(b);
  abs_max = aa > bb ? aa : bb;
  if (abs_max < DBL_MIN)
    abs_max = DBL_MIN;
  return (abs_diff / abs_max) <= (100.0 * DBL_EPSILON);
}


x86 assembly (clang, -O0):
<double_equal>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jne    1130 <double_equal+0x30>
jp     1130 <double_equal+0x30>
movl   $0x1,-0x4(%rbp)
jmp    11fd <double_equal+0xfd>
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movaps 0xebf(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movaps 0xeaa(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movaps 0xe95(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
ucomisd -0x30(%rbp),%xmm0
jbe    1193 <double_equal+0x93>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    119d <double_equal+0x9d>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm1
mov    0x2e25(%rip),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    11d1 <double_equal+0xd1>
mov    0x2e10(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm1
divsd  -0x38(%rbp),%xmm1
movsd  0xe2d(%rip),%xmm0
mov    0x2dfe(%rip),%rax
mulsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<double_equal>:
mov    $0x1,%eax
ucomisd %xmm1,%xmm0
jne    110e <double_equal+0xe>
jp     110e <double_equal+0xe>
ret
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
movapd 0xee2(%rip),%xmm3
andpd  %xmm3,%xmm2
andpd  %xmm3,%xmm0
andpd  %xmm3,%xmm1
maxsd  %xmm1,%xmm0
mov    0x2ea3(%rip),%rax
movsd  (%rax),%xmm1
maxsd  %xmm0,%xmm1
divsd  %xmm1,%xmm2
mov    0x2ea0(%rip),%rax
movsd  (%rax),%xmm0
mulsd  0xebc(%rip),%xmm0
xor    %eax,%eax
ucomisd %xmm2,%xmm0
setae  %al
ret

LLVM IR (-O0):
@DBL_MIN = global double 0.000000e+00
@DBL_EPSILON = global double 0.000000e+00
define i32 @double_equal(double %0, double %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %4
store double %1, double* %5
%10 = load double, double* %4
%11 = load double, double* %5
%12 = fcmp oeq double %10, %11
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 1, i32* %3
br label %45
14: ; preds = %2
%15 = load double, double* %4
%16 = load double, double* %5
%17 = fsub double %15, %16
%18 = call double @llvm.fabs.f64(double %17)
store double %18, double* %6
%19 = load double, double* %4
%20 = call double @llvm.fabs.f64(double %19)
store double %20, double* %7
%21 = load double, double* %5
%22 = call double @llvm.fabs.f64(double %21)
store double %22, double* %8
%23 = load double, double* %7
%24 = load double, double* %8
%25 = fcmp ogt double %23, %24
br i1 %25, label %26, label %28
26: ; preds = %14
%27 = load double, double* %7
br label %30
28: ; preds = %14
%29 = load double, double* %8
br label %30
30: ; preds = %28, %26
%31 = phi double [ %27, %26 ], [ %29, %28 ]
store double %31, double* %9
%32 = load double, double* %9
%33 = load double, double* @DBL_MIN
%34 = fcmp olt double %32, %33
br i1 %34, label %35, label %37
35: ; preds = %30
%36 = load double, double* @DBL_MIN
store double %36, double* %9
br label %37
37: ; preds = %35, %30
%38 = load double, double* %6
%39 = load double, double* %9
%40 = fdiv double %38, %39
%41 = load double, double* @DBL_EPSILON
%42 = fmul double 1.000000e+02, %41
%43 = fcmp ole double %40, %42
%44 = zext i1 %43 to i32
store i32 %44, i32* %3
br label %45
45: ; preds = %37, %13
%46 = load i32, i32* %3
ret i32 %46
}

LLVM IR (-O2):
@DBL_MIN = global double 0.000000e+00
@DBL_EPSILON = global double 0.000000e+00
define i32 @double_equal(double %0, double %1) {
%3 = fcmp oeq double %0, %1
br i1 %3, label %19, label %4
4: ; preds = %2
%5 = fsub double %0, %1
%6 = tail call double @llvm.fabs.f64(double %5)
%7 = tail call double @llvm.fabs.f64(double %0)
%8 = tail call double @llvm.fabs.f64(double %1)
%9 = fcmp ogt double %7, %8
%10 = select i1 %9, double %7, double %8
%11 = load double, double* @DBL_MIN
%12 = fcmp olt double %10, %11
%13 = select i1 %12, double %11, double %10
%14 = fdiv double %6, %13
%15 = load double, double* @DBL_EPSILON
%16 = fmul double %15, 1.000000e+02
%17 = fcmp ole double %14, %16
%18 = zext i1 %17 to i32
br label %19
19: ; preds = %2, %4
%20 = phi i32 [ %18, %4 ], [ 1, %2 ]
ret i32 %20
}