; LLVM IR from gulrak/filesystem :: test/filesystem_test.ll (ZNK5Catch6Detail6Approx22equalityComparisonImplEd)

; 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"

%"class.Catch::Detail::Approx" = type { double, double, double, double }

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK5Catch6Detail6Approx22equalityComparisonImplEd(ptr noundef nonnull align 8 dereferenceable(32) %0, double noundef %1) #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca double, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store double %1, ptr %4, align 8, !tbaa !9
  %5 = load ptr, ptr %3, align 8
  %6 = getelementptr inbounds %"class.Catch::Detail::Approx", ptr %5, i32 0, i32 3
  %7 = load double, ptr %6, align 8, !tbaa !11
  %8 = load double, ptr %4, align 8, !tbaa !9
  %9 = getelementptr inbounds %"class.Catch::Detail::Approx", ptr %5, i32 0, i32 1
  %10 = load double, ptr %9, align 8, !tbaa !13
  %11 = call noundef zeroext i1 @_ZN12_GLOBAL__N_116marginComparisonEddd(double noundef %7, double noundef %8, double noundef %10)
  br i1 %11, label %33, label %12

12:                                               ; preds = %2
  %13 = getelementptr inbounds %"class.Catch::Detail::Approx", ptr %5, i32 0, i32 3
  %14 = load double, ptr %13, align 8, !tbaa !11
  %15 = load double, ptr %4, align 8, !tbaa !9
  %16 = getelementptr inbounds %"class.Catch::Detail::Approx", ptr %5, i32 0, i32 0
  %17 = load double, ptr %16, align 8, !tbaa !14
  %18 = getelementptr inbounds %"class.Catch::Detail::Approx", ptr %5, i32 0, i32 2
  %19 = load double, ptr %18, align 8, !tbaa !15
  %20 = getelementptr inbounds %"class.Catch::Detail::Approx", ptr %5, i32 0, i32 3
  %21 = load double, ptr %20, align 8, !tbaa !11
  %22 = call noundef zeroext i1 @_ZSt5isinfd(double noundef %21)
  br i1 %22, label %23, label %24

23:                                               ; preds = %12
  br label %27

24:                                               ; preds = %12
  %25 = getelementptr inbounds %"class.Catch::Detail::Approx", ptr %5, i32 0, i32 3
  %26 = load double, ptr %25, align 8, !tbaa !11
  br label %27

27:                                               ; preds = %24, %23
  %28 = phi double [ 0.000000e+00, %23 ], [ %26, %24 ]
  %29 = call double @llvm.fabs.f64(double %28)
  %30 = fadd double %19, %29
  %31 = fmul double %17, %30
  %32 = call noundef zeroext i1 @_ZN12_GLOBAL__N_116marginComparisonEddd(double noundef %14, double noundef %15, double noundef %31)
  br label %33

33:                                               ; preds = %27, %2
  %34 = phi i1 [ true, %2 ], [ %32, %27 ]
  ret i1 %34
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZN12_GLOBAL__N_116marginComparisonEddd(double noundef, double noundef, double noundef) #1

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #2

attributes #0 = { 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 #1 = { 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 #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !10, i64 24}
!12 = !{!"_ZTSN5Catch6Detail6ApproxE", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!13 = !{!12, !10, i64 8}
!14 = !{!12, !10, i64 0}
!15 = !{!12, !10, i64 16}


; 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"

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZNK5Catch6Detail6Approx22equalityComparisonImplEd(ptr nocapture noundef nonnull readonly align 8 dereferenceable(32) %0, double noundef %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 24
  %4 = load double, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = load double, ptr %5, align 8, !tbaa !10
  %7 = tail call noundef zeroext i1 @_ZN12_GLOBAL__N_116marginComparisonEddd(double noundef %4, double noundef %1, double noundef %6)
  br i1 %7, label %20, label %8

8:                                                ; preds = %2
  %9 = load double, ptr %3, align 8, !tbaa !5
  %10 = load double, ptr %0, align 8, !tbaa !11
  %11 = getelementptr inbounds i8, ptr %0, i64 16
  %12 = load double, ptr %11, align 8, !tbaa !12
  %13 = tail call noundef zeroext i1 @_ZSt5isinfd(double noundef %9)
  %14 = load double, ptr %3, align 8
  %15 = tail call double @llvm.fabs.f64(double %14)
  %16 = select i1 %13, double 0.000000e+00, double %15
  %17 = fadd double %12, %16
  %18 = fmul double %10, %17
  %19 = tail call noundef zeroext i1 @_ZN12_GLOBAL__N_116marginComparisonEddd(double noundef %9, double noundef %1, double noundef %18)
  br label %20

20:                                               ; preds = %8, %2
  %21 = phi i1 [ true, %2 ], [ %19, %8 ]
  ret i1 %21
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZN12_GLOBAL__N_116marginComparisonEddd(double noundef, double noundef, double noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #1

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" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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, !7, i64 24}
!6 = !{!"_ZTSN5Catch6Detail6ApproxE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!6, !7, i64 0}
!12 = !{!6, !7, i64 16}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass