#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*/ assert(int /*<<< orphan*/);
double fabs(double);
int /*<<< orphan*/ printf(char *, double, double, double);
void checkTolerance(double l1, double l2) {
  if (l1 < l2) {
    double tolerance = fabs((((l1) > (l2)) ? (l1) : (l2)) * 0.000000000001);
    if (fabs(l1 - l2) > (((0.1) < (tolerance)) ? (0.1) : (tolerance))) {
      printf("Likelihood problem in model optimization l1: %1.40f l2: %1.40f "
             "tolerance: %1.40f\n",
             l1, l2, tolerance);
      assert(0);
    }
  }
}


x86 assembly (clang, -O0):
<checkTolerance>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1218 <checkTolerance+0xf8>
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1165 <checkTolerance+0x45>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    116f <checkTolerance+0x4f>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe8c(%rip),%xmm1
mulsd  %xmm1,%xmm0
movaps 0xe89(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movaps 0xe6f(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe49(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11d3 <checkTolerance+0xb3>
movsd  0xe37(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    11dd <checkTolerance+0xbd>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    1213 <checkTolerance+0xf3>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
lea    0xe19(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <assert@plt>
jmp    1218 <checkTolerance+0xf8>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkTolerance>:
push   %rax
ucomisd %xmm0,%xmm1
jbe    1175 <checkTolerance+0x55>
movapd %xmm0,%xmm2
maxsd  %xmm1,%xmm2
mulsd  0xec9(%rip),%xmm2
movapd 0xed1(%rip),%xmm3
andpd  %xmm3,%xmm2
movapd %xmm0,%xmm4
subsd  %xmm1,%xmm4
andpd  %xmm3,%xmm4
movsd  0xeb1(%rip),%xmm3
minsd  %xmm2,%xmm3
ucomisd %xmm3,%xmm4
jbe    1175 <checkTolerance+0x55>
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <assert@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [82 x i8] c"Likelihood problem in model optimization l1: %1.40f l2: %1.40f tolerance: %1.40f\0A\00"
define void @checkTolerance(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %3
%7 = load double, double* %4
%8 = fcmp olt double %6, %7
br i1 %8, label %9, label %40
9: ; preds = %2
%10 = load double, double* %3
%11 = load double, double* %4
%12 = fcmp ogt double %10, %11
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = load double, double* %3
br label %17
15: ; preds = %9
%16 = load double, double* %4
br label %17
17: ; preds = %15, %13
%18 = phi double [ %14, %13 ], [ %16, %15 ]
%19 = fmul double %18, 0x3D719799812DEA11
%20 = call double @llvm.fabs.f64(double %19)
store double %20, double* %5
%21 = load double, double* %3
%22 = load double, double* %4
%23 = fsub double %21, %22
%24 = call double @llvm.fabs.f64(double %23)
%25 = load double, double* %5
%26 = fcmp olt double 1.000000e-01, %25
br i1 %26, label %27, label %28
27: ; preds = %17
br label %30
28: ; preds = %17
%29 = load double, double* %5
br label %30
30: ; preds = %28, %27
%31 = phi double [ 1.000000e-01, %27 ], [ %29, %28 ]
%32 = fcmp ogt double %24, %31
br i1 %32, label %33, label %39
33: ; preds = %30
%34 = load double, double* %3
%35 = load double, double* %4
%36 = load double, double* %5
%37 = call i32 @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0), double %34, double %35, double %36)
%38 = call i32 @assert(i32 0)
br label %39
39: ; preds = %33, %30
br label %40
40: ; preds = %39, %2
ret void
}

LLVM IR (-O2):
@.str = [82 x i8] c"Likelihood problem in model optimization l1: %1.40f l2: %1.40f tolerance: %1.40f\0A\00"
define void @checkTolerance(double %0, double %1) {
%3 = fcmp olt double %0, %1
br i1 %3, label %4, label %17
4: ; preds = %2
%5 = fcmp ogt double %0, %1
%6 = select i1 %5, double %0, double %1
%7 = fmul double %6, 0x3D719799812DEA11
%8 = tail call double @llvm.fabs.f64(double %7)
%9 = fsub double %0, %1
%10 = tail call double @llvm.fabs.f64(double %9)
%11 = fcmp ogt double %8, 1.000000e-01
%12 = select i1 %11, double 1.000000e-01, double %8
%13 = fcmp ogt double %10, %12
br i1 %13, label %14, label %17
14: ; preds = %4
%15 = tail call i32 @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0), double %0, double %1, double %8)
%16 = tail call i32 @assert(i32 0)
br label %17
17: ; preds = %4, %14, %2
ret void
}