#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 /*<<< orphan*/ CTEST_ERR(char *, char const *, int, double, double, double,
                             double);
void assert_dbl_far(double exp, double real, double tol, const char *caller,
                    int line) {
  double diff = exp - real;
  double absdiff = diff;
  if (diff < 0) {
    absdiff *= -1;
  }
  if (absdiff <= tol) {
    CTEST_ERR("%s:%d  expected %0.3e, got %0.3e (diff %0.3e, tol %0.3e)",
              caller, line, exp, real, diff, tol);
  }
}


x86 assembly (clang, -O0):
<assert_dbl_far>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
mov    %esi,-0x24(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x30(%rbp),%xmm0
jbe    1167 <assert_dbl_far+0x57>
movsd  0xea3(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     11a2 <assert_dbl_far+0x92>
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm3
lea    0xe6b(%rip),%rdi
call   1030 <CTEST_ERR@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert_dbl_far>:
movapd %xmm2,%xmm3
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
movapd 0xedc(%rip),%xmm4
xorpd  %xmm2,%xmm4
xorpd  %xmm5,%xmm5
movapd %xmm2,%xmm6
cmpltsd %xmm5,%xmm6
andpd  %xmm6,%xmm4
andnpd %xmm2,%xmm6
orpd   %xmm4,%xmm6
ucomisd %xmm6,%xmm3
jae    1148 <assert_dbl_far+0x38>
ret
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xebc(%rip),%rdi
jmp    1030 <CTEST_ERR@plt>

LLVM IR (-O0):
@.str = [57 x i8] c"%s:%d expected %0.3e, got %0.3e (diff %0.3e, tol %0.3e)\00"
define void @assert_dbl_far(double %0, double %1, double %2, i8* %3, i32 %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca i8*
%10 = alloca i32
%11 = alloca double
%12 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%13 = load double, double* %6
%14 = load double, double* %7
%15 = fsub double %13, %14
store double %15, double* %11
%16 = load double, double* %11
store double %16, double* %12
%17 = load double, double* %11
%18 = fcmp olt double %17, 0.000000e+00
br i1 %18, label %19, label %22
19: ; preds = %5
%20 = load double, double* %12
%21 = fmul double %20, -1.000000e+00
store double %21, double* %12
br label %22
22: ; preds = %19, %5
%23 = load double, double* %12
%24 = load double, double* %8
%25 = fcmp ole double %23, %24
br i1 %25, label %26, label %34
26: ; preds = %22
%27 = load i8*, i8** %9
%28 = load i32, i32* %10
%29 = load double, double* %6
%30 = load double, double* %7
%31 = load double, double* %11
%32 = load double, double* %8
%33 = call i32 @CTEST_ERR(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8* %27, i32 %28, double %29, double %30, double %31, double %32)
br label %34
34: ; preds = %26, %22
ret void
}

LLVM IR (-O2):
@.str = [57 x i8] c"%s:%d expected %0.3e, got %0.3e (diff %0.3e, tol %0.3e)\00"
define void @assert_dbl_far(double %0, double %1, double %2, i8* %3, i32 %4) {
%6 = fsub double %0, %1
%7 = fcmp olt double %6, 0.000000e+00
%8 = fneg double %6
%9 = select i1 %7, double %8, double %6
%10 = fcmp ugt double %9, %2
br i1 %10, label %13, label %11
11: ; preds = %5
%12 = tail call i32 @CTEST_ERR(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8* %3, i32 %4, double %0, double %1, double %6, double %2)
br label %13
13: ; preds = %11, %5
ret void
}