#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 */
int fabs(int);
unsigned char DblEqual(double a, double b) {
  if ((fabs(a) < 1e-100) && (fabs(b) < 1e-100))
    return 1;
  if ((fabs(a - b) < fabs(1e-7 * a)) && (fabs(a - b) < fabs(1e-7 * b)))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<DblEqual>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
cvttsd2si -0x10(%rbp),%edi
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xec8(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    116b <DblEqual+0x5b>
cvttsd2si -0x18(%rbp),%edi
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xea8(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    116b <DblEqual+0x5b>
movb   $0x1,-0x1(%rbp)
jmp    11ea <DblEqual+0xda>
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <fabs@plt>
mov    %eax,-0x1c(%rbp)
movsd  0xe7f(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <fabs@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
jge    11e6 <DblEqual+0xd6>
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <fabs@plt>
mov    %eax,-0x20(%rbp)
movsd  0xe46(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <fabs@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
jge    11e6 <DblEqual+0xd6>
movb   $0x1,-0x1(%rbp)
jmp    11ea <DblEqual+0xda>
movb   $0x0,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DblEqual>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
cvttsd2si %xmm0,%edi
call   1030 <fabs@plt>
test   %eax,%eax
jg     113e <DblEqual+0x2e>
cvttsd2si 0x8(%rsp),%edi
call   1030 <fabs@plt>
test   %eax,%eax
jle    11a3 <DblEqual+0x93>
movsd  0x10(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%ebx
mov    %ebx,%edi
call   1030 <fabs@plt>
mov    %eax,%ebp
movsd  0x10(%rsp),%xmm0
mulsd  0xe9b(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <fabs@plt>
cmp    %eax,%ebp
jge    119a <DblEqual+0x8a>
mov    %ebx,%edi
call   1030 <fabs@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
mulsd  0xe77(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <fabs@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    %ecx,%ebx
jl     119c <DblEqual+0x8c>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret
mov    $0x1,%al
jmp    119c <DblEqual+0x8c>

LLVM IR (-O0):
define zeroext i8 @DblEqual(double %0, double %1) {
%3 = alloca i8
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %4
%7 = fptosi double %6 to i32
%8 = call i32 @fabs(i32 %7)
%9 = sitofp i32 %8 to double
%10 = fcmp olt double %9, 1.000000e-100
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = load double, double* %5
%13 = fptosi double %12 to i32
%14 = call i32 @fabs(i32 %13)
%15 = sitofp i32 %14 to double
%16 = fcmp olt double %15, 1.000000e-100
br i1 %16, label %17, label %18
17: ; preds = %11
store i8 1, i8* %3
br label %42
18: ; preds = %11, %2
%19 = load double, double* %4
%20 = load double, double* %5
%21 = fsub double %19, %20
%22 = fptosi double %21 to i32
%23 = call i32 @fabs(i32 %22)
%24 = load double, double* %4
%25 = fmul double 0x3E7AD7F29ABCAF48, %24
%26 = fptosi double %25 to i32
%27 = call i32 @fabs(i32 %26)
%28 = icmp slt i32 %23, %27
br i1 %28, label %29, label %41
29: ; preds = %18
%30 = load double, double* %4
%31 = load double, double* %5
%32 = fsub double %30, %31
%33 = fptosi double %32 to i32
%34 = call i32 @fabs(i32 %33)
%35 = load double, double* %5
%36 = fmul double 0x3E7AD7F29ABCAF48, %35
%37 = fptosi double %36 to i32
%38 = call i32 @fabs(i32 %37)
%39 = icmp slt i32 %34, %38
br i1 %39, label %40, label %41
40: ; preds = %29
store i8 1, i8* %3
br label %42
41: ; preds = %29, %18
store i8 0, i8* %3
br label %42
42: ; preds = %41, %40, %17
%43 = load i8, i8* %3
ret i8 %43
}

LLVM IR (-O2):
define zeroext i8 @DblEqual(double %0, double %1) {
%3 = fptosi double %0 to i32
%4 = tail call i32 @fabs(i32 %3)
%5 = icmp slt i32 %4, 1
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = fptosi double %1 to i32
%8 = tail call i32 @fabs(i32 %7)
%9 = icmp slt i32 %8, 1
br i1 %9, label %25, label %10
10: ; preds = %6, %2
%11 = fsub double %0, %1
%12 = fptosi double %11 to i32
%13 = tail call i32 @fabs(i32 %12)
%14 = fmul double %0, 0x3E7AD7F29ABCAF48
%15 = fptosi double %14 to i32
%16 = tail call i32 @fabs(i32 %15)
%17 = icmp slt i32 %13, %16
br i1 %17, label %18, label %24
18: ; preds = %10
%19 = tail call i32 @fabs(i32 %12)
%20 = fmul double %1, 0x3E7AD7F29ABCAF48
%21 = fptosi double %20 to i32
%22 = tail call i32 @fabs(i32 %21)
%23 = icmp slt i32 %19, %22
br i1 %23, label %25, label %24
24: ; preds = %18, %10
br label %25
25: ; preds = %18, %6, %24
%26 = phi i8 [ 0, %24 ], [ 1, %6 ], [ 1, %18 ]
ret i8 %26
}