#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(double);
char neq(double a, double b) {
  double m = fabs(((a) > (b) ? (a) : (b)));
  if (m < 1e3)
    return (fabs(a - b) <= 1e-6);
  else
    return (fabs(a - b) <= 1e-4 * m);
}


x86 assembly (clang, -O0):
<neq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1141 <neq+0x31>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    114b <neq+0x3b>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe9a(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11a0 <neq+0x90>
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe84(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
mov    %al,-0x1(%rbp)
jmp    11cf <neq+0xbf>
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe4d(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<neq>:
sub    $0x18,%rsp
movsd  %xmm0,0x8(%rsp)
movsd  %xmm1,(%rsp)
maxsd  %xmm1,%xmm0
call   1030 <fabs@plt>
cmp    $0x3e7,%eax
jg     1149 <neq+0x39>
movsd  0x8(%rsp),%xmm0
subsd  (%rsp),%xmm0
call   1030 <fabs@plt>
test   %eax,%eax
setle  %al
add    $0x18,%rsp
ret
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
subsd  (%rsp),%xmm0
call   1030 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x10(%rsp),%xmm1
mulsd  0xe85(%rip),%xmm1
ucomisd %xmm0,%xmm1
setae  %al
add    $0x18,%rsp
ret

LLVM IR (-O0):
define signext i8 @neq(double %0, double %1) {
%3 = alloca i8
%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 = fcmp ogt double %7, %8
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = load double, double* %4
br label %14
12: ; preds = %2
%13 = load double, double* %5
br label %14
14: ; preds = %12, %10
%15 = phi double [ %11, %10 ], [ %13, %12 ]
%16 = call i32 @fabs(double %15)
%17 = sitofp i32 %16 to double
store double %17, double* %6
%18 = load double, double* %6
%19 = fcmp olt double %18, 1.000000e+03
br i1 %19, label %20, label %29
20: ; preds = %14
%21 = load double, double* %4
%22 = load double, double* %5
%23 = fsub double %21, %22
%24 = call i32 @fabs(double %23)
%25 = sitofp i32 %24 to double
%26 = fcmp ole double %25, 0x3EB0C6F7A0B5ED8D
%27 = zext i1 %26 to i32
%28 = trunc i32 %27 to i8
store i8 %28, i8* %3
br label %40
29: ; preds = %14
%30 = load double, double* %4
%31 = load double, double* %5
%32 = fsub double %30, %31
%33 = call i32 @fabs(double %32)
%34 = sitofp i32 %33 to double
%35 = load double, double* %6
%36 = fmul double 1.000000e-04, %35
%37 = fcmp ole double %34, %36
%38 = zext i1 %37 to i32
%39 = trunc i32 %38 to i8
store i8 %39, i8* %3
br label %40
40: ; preds = %29, %20
%41 = load i8, i8* %3
ret i8 %41
}

LLVM IR (-O2):
define signext i8 @neq(double %0, double %1) {
%3 = fcmp ogt double %0, %1
%4 = select i1 %3, double %0, double %1
%5 = tail call i32 @fabs(double %4)
%6 = icmp slt i32 %5, 1000
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = fsub double %0, %1
%9 = tail call i32 @fabs(double %8)
%10 = icmp slt i32 %9, 1
br label %18
11: ; preds = %2
%12 = sitofp i32 %5 to double
%13 = fsub double %0, %1
%14 = tail call i32 @fabs(double %13)
%15 = sitofp i32 %14 to double
%16 = fmul double %12, 1.000000e-04
%17 = fcmp oge double %16, %15
br label %18
18: ; preds = %11, %7
%19 = phi i1 [ %10, %7 ], [ %17, %11 ]
%20 = zext i1 %19 to i8
ret i8 %20
}