; LLVM IR from interpretml/interpret :: shared/libebm/tests/libebm_test.ll (Z13IsApproxEqualddd)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@_ZL23g_countEqualityFailures = external hidden global i32, align 4

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z13IsApproxEqualddd(double noundef %0, double noundef %1, double noundef %2) #1 {
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca i8, align 1
  %8 = alloca double, align 8
  store double %0, ptr %4, align 8, !tbaa !5
  store double %1, ptr %5, align 8, !tbaa !5
  store double %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #3
  %9 = load double, ptr %4, align 8, !tbaa !5
  %10 = call noundef zeroext i1 @_ZSt5isnand(double noundef %9)
  br i1 %10, label %11, label %15

11:                                               ; preds = %3
  %12 = load double, ptr %5, align 8, !tbaa !5
  %13 = call noundef zeroext i1 @_ZSt5isnand(double noundef %12)
  %14 = zext i1 %13 to i8
  store i8 %14, ptr %7, align 1, !tbaa !9
  br label %58

15:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %16 = load double, ptr %6, align 8, !tbaa !5
  %17 = fadd double 1.000000e+00, %16
  store double %17, ptr %8, align 8, !tbaa !5
  %18 = load double, ptr %4, align 8, !tbaa !5
  %19 = load double, ptr %5, align 8, !tbaa !5
  %20 = fcmp olt double %18, %19
  br i1 %20, label %21, label %39

21:                                               ; preds = %15
  %22 = load double, ptr %5, align 8, !tbaa !5
  %23 = fcmp olt double 0.000000e+00, %22
  br i1 %23, label %24, label %31

24:                                               ; preds = %21
  %25 = load double, ptr %5, align 8, !tbaa !5
  %26 = load double, ptr %4, align 8, !tbaa !5
  %27 = load double, ptr %8, align 8, !tbaa !5
  %28 = fmul double %26, %27
  %29 = fcmp ole double %25, %28
  %30 = zext i1 %29 to i8
  store i8 %30, ptr %7, align 1, !tbaa !9
  br label %38

31:                                               ; preds = %21
  %32 = load double, ptr %5, align 8, !tbaa !5
  %33 = load double, ptr %8, align 8, !tbaa !5
  %34 = fmul double %32, %33
  %35 = load double, ptr %4, align 8, !tbaa !5
  %36 = fcmp ole double %34, %35
  %37 = zext i1 %36 to i8
  store i8 %37, ptr %7, align 1, !tbaa !9
  br label %38

38:                                               ; preds = %31, %24
  br label %57

39:                                               ; preds = %15
  %40 = load double, ptr %4, align 8, !tbaa !5
  %41 = fcmp olt double 0.000000e+00, %40
  br i1 %41, label %42, label %49

42:                                               ; preds = %39
  %43 = load double, ptr %4, align 8, !tbaa !5
  %44 = load double, ptr %5, align 8, !tbaa !5
  %45 = load double, ptr %8, align 8, !tbaa !5
  %46 = fmul double %44, %45
  %47 = fcmp ole double %43, %46
  %48 = zext i1 %47 to i8
  store i8 %48, ptr %7, align 1, !tbaa !9
  br label %56

49:                                               ; preds = %39
  %50 = load double, ptr %4, align 8, !tbaa !5
  %51 = load double, ptr %8, align 8, !tbaa !5
  %52 = fmul double %50, %51
  %53 = load double, ptr %5, align 8, !tbaa !5
  %54 = fcmp ole double %52, %53
  %55 = zext i1 %54 to i8
  store i8 %55, ptr %7, align 1, !tbaa !9
  br label %56

56:                                               ; preds = %49, %42
  br label %57

57:                                               ; preds = %56, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %58

58:                                               ; preds = %57, %11
  %59 = load i8, ptr %7, align 1, !tbaa !9, !range !11, !noundef !12
  %60 = trunc i8 %59 to i1
  br i1 %60, label %64, label %61

61:                                               ; preds = %58
  %62 = load i32, ptr @_ZL23g_countEqualityFailures, align 4, !tbaa !13
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr @_ZL23g_countEqualityFailures, align 4, !tbaa !13
  br label %64

64:                                               ; preds = %61, %58
  %65 = load i8, ptr %7, align 1, !tbaa !9, !range !11, !noundef !12
  %66 = trunc i8 %65 to i1
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #3
  ret i1 %66
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZSt5isnand(double noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@_ZL23g_countEqualityFailures = external hidden local_unnamed_addr global i32, align 4

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_Z13IsApproxEqualddd(double noundef %0, double noundef %1, double noundef %2) local_unnamed_addr #0 {
  %4 = tail call noundef zeroext i1 @_ZSt5isnand(double noundef %0)
  br i1 %4, label %5, label %7

5:                                                ; preds = %3
  %6 = tail call noundef zeroext i1 @_ZSt5isnand(double noundef %1)
  br i1 %6, label %29, label %26

7:                                                ; preds = %3
  %8 = fadd double %2, 1.000000e+00
  %9 = fcmp olt double %0, %1
  br i1 %9, label %10, label %18

10:                                               ; preds = %7
  %11 = fcmp ogt double %1, 0.000000e+00
  br i1 %11, label %12, label %15

12:                                               ; preds = %10
  %13 = fmul double %8, %0
  %14 = fcmp ult double %13, %1
  br i1 %14, label %26, label %29

15:                                               ; preds = %10
  %16 = fmul double %8, %1
  %17 = fcmp ugt double %16, %0
  br i1 %17, label %26, label %29

18:                                               ; preds = %7
  %19 = fcmp ogt double %0, 0.000000e+00
  br i1 %19, label %20, label %23

20:                                               ; preds = %18
  %21 = fmul double %8, %1
  %22 = fcmp ult double %21, %0
  br i1 %22, label %26, label %29

23:                                               ; preds = %18
  %24 = fmul double %8, %0
  %25 = fcmp ugt double %24, %1
  br i1 %25, label %26, label %29

26:                                               ; preds = %20, %15, %12, %5, %23
  %27 = load i32, ptr @_ZL23g_countEqualityFailures, align 4, !tbaa !5
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr @_ZL23g_countEqualityFailures, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %20, %15, %12, %5, %26, %23
  %.1.in24 = phi i1 [ true, %5 ], [ false, %26 ], [ true, %23 ], [ true, %12 ], [ true, %15 ], [ true, %20 ]
  ret i1 %.1.in24
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZSt5isnand(double noundef) local_unnamed_addr #0

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass