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

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

%"struct.Catch::Matchers::Floating::WithinRelMatcher" = type { %"struct.Catch::Matchers::Impl::MatcherBase.153", double, double }
%"struct.Catch::Matchers::Impl::MatcherBase.153" = type { %"class.Catch::Matchers::Impl::MatcherUntypedBase", %"struct.Catch::Matchers::Impl::MatcherMethod.154" }
%"class.Catch::Matchers::Impl::MatcherUntypedBase" = type { ptr, %"class.std::__cxx11::basic_string" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon.0 }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon.0 = type { i64, [8 x i8] }
%"struct.Catch::Matchers::Impl::MatcherMethod.154" = type { ptr }

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK5Catch8Matchers8Floating16WithinRelMatcher5matchERKd(ptr noundef nonnull align 8 dereferenceable(64) %0, ptr noundef nonnull align 8 dereferenceable(8) %1) unnamed_addr #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %8 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %9 = getelementptr inbounds %"struct.Catch::Matchers::Floating::WithinRelMatcher", ptr %8, i32 0, i32 2
  %10 = load double, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = load double, ptr %11, align 8, !tbaa !18
  %13 = call double @llvm.fabs.f64(double %12)
  store double %13, ptr %6, align 8, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %14 = getelementptr inbounds %"struct.Catch::Matchers::Floating::WithinRelMatcher", ptr %8, i32 0, i32 1
  %15 = load double, ptr %14, align 8, !tbaa !19
  %16 = call double @llvm.fabs.f64(double %15)
  store double %16, ptr %7, align 8, !tbaa !18
  %17 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %18 = load double, ptr %17, align 8, !tbaa !18
  %19 = fmul double %10, %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  store double %19, ptr %5, align 8, !tbaa !18
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = load double, ptr %20, align 8, !tbaa !18
  %22 = getelementptr inbounds %"struct.Catch::Matchers::Floating::WithinRelMatcher", ptr %8, i32 0, i32 1
  %23 = load double, ptr %22, align 8, !tbaa !19
  %24 = load double, ptr %5, align 8, !tbaa !18
  %25 = call noundef zeroext i1 @_ZSt5isinfd(double noundef %24)
  br i1 %25, label %26, label %27

26:                                               ; preds = %2
  br label %29

27:                                               ; preds = %2
  %28 = load double, ptr %5, align 8, !tbaa !18
  br label %29

29:                                               ; preds = %27, %26
  %30 = phi double [ 0.000000e+00, %26 ], [ %28, %27 ]
  %31 = call noundef zeroext i1 @_ZN5Catch12_GLOBAL__N_116marginComparisonEddd(double noundef %21, double noundef %23, double noundef %30)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  ret i1 %31
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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) }
attributes #3 = { 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 #4 = { inlinehint 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 #5 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !17, i64 56}
!10 = !{!"_ZTSN5Catch8Matchers8Floating16WithinRelMatcherE", !11, i64 0, !17, i64 48, !17, i64 56}
!11 = !{!"_ZTSN5Catch8Matchers4Impl11MatcherBaseIdEE", !12, i64 0, !16, i64 40}
!12 = !{!"_ZTSN5Catch8Matchers4Impl18MatcherUntypedBaseE", !13, i64 8}
!13 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !14, i64 0, !15, i64 8, !7, i64 16}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!"_ZTSN5Catch8Matchers4Impl13MatcherMethodIdEE"}
!17 = !{!"double", !7, i64 0}
!18 = !{!17, !17, i64 0}
!19 = !{!10, !17, i64 48}


; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZNK5Catch8Matchers8Floating16WithinRelMatcher5matchERKd(ptr nocapture noundef nonnull readonly align 8 dereferenceable(64) %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(8) %1) unnamed_addr #1 align 2 {
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = getelementptr inbounds i8, ptr %0, i64 56
  %6 = load double, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  %7 = load double, ptr %1, align 8, !tbaa !17
  %8 = tail call double @llvm.fabs.f64(double %7)
  store double %8, ptr %3, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %9 = getelementptr inbounds i8, ptr %0, i64 48
  %10 = load double, ptr %9, align 8, !tbaa !18
  %11 = tail call double @llvm.fabs.f64(double %10)
  store double %11, ptr %4, align 8, !tbaa !17
  %12 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %13 = load double, ptr %12, align 8, !tbaa !17
  %14 = fmul double %6, %13
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  %15 = load double, ptr %1, align 8, !tbaa !17
  %16 = load double, ptr %9, align 8, !tbaa !18
  %17 = call noundef zeroext i1 @_ZSt5isinfd(double noundef %14)
  %18 = select i1 %17, double 0.000000e+00, double %14
  %19 = call noundef zeroext i1 @_ZN5Catch12_GLOBAL__N_116marginComparisonEddd(double noundef %15, double noundef %16, double noundef %18)
  ret i1 %19
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { inlinehint 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 #4 = { 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, !16, i64 56}
!6 = !{!"_ZTSN5Catch8Matchers8Floating16WithinRelMatcherE", !7, i64 0, !16, i64 48, !16, i64 56}
!7 = !{!"_ZTSN5Catch8Matchers4Impl11MatcherBaseIdEE", !8, i64 0, !15, i64 40}
!8 = !{!"_ZTSN5Catch8Matchers4Impl18MatcherUntypedBaseE", !9, i64 8}
!9 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !10, i64 0, !14, i64 8, !12, i64 16}
!10 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !11, i64 0}
!11 = !{!"any pointer", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C++ TBAA"}
!14 = !{!"long", !12, i64 0}
!15 = !{!"_ZTSN5Catch8Matchers4Impl13MatcherMethodIdEE"}
!16 = !{!"double", !12, i64 0}
!17 = !{!16, !16, i64 0}
!18 = !{!6, !16, i64 48}


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