; LLVM IR from AdaptiveCpp/AdaptiveCpp :: tests/pcuda (pcuda_test_suite)

; 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.boost::unit_test::(anonymous namespace)::results_collector_impl" = type { %"class.std::map.214" }
%"class.std::map.214" = type { %"class.std::_Rb_tree.215" }
%"class.std::_Rb_tree.215" = type { %"struct.std::_Rb_tree<unsigned long, std::pair<const unsigned long, boost::unit_test::test_results>, std::_Select1st<std::pair<const unsigned long, boost::unit_test::test_results>>, std::less<unsigned long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<unsigned long, std::pair<const unsigned long, boost::unit_test::test_results>, std::_Select1st<std::pair<const unsigned long, boost::unit_test::test_results>>, std::less<unsigned long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.boost::unit_test::test_results" = type <{ %"class.boost::unit_test::test_results::readonly_property59", %"class.boost::unit_test::test_results::readonly_property59", %"class.boost::unit_test::test_results::readonly_property59", %"class.boost::unit_test::test_results::readonly_property59", %"class.boost::unit_test::test_results::readonly_property59", %"class.boost::unit_test::test_results::readonly_property59", %"class.boost::unit_test::test_results::readonly_property59", %"class.boost::unit_test::test_results::readonly_property59", %"class.boost::unit_test::test_results::readonly_property59", %"class.boost::unit_test::test_results::readonly_property59", %"class.boost::unit_test::test_results::readonly_property59", %"class.boost::unit_test::test_results::readonly_property59", %"class.boost::unit_test::test_results::readonly_property59", %"class.boost::unit_test::test_results::readonly_property63", %"class.boost::unit_test::test_results::readonly_property63", %"class.boost::unit_test::test_results::readonly_property63", [5 x i8] }>
%"class.boost::unit_test::test_results::readonly_property59" = type { %"class.boost::unit_test::readonly_property" }
%"class.boost::unit_test::readonly_property" = type { %"class.boost::unit_test::class_property" }
%"class.boost::unit_test::class_property" = type { i64 }
%"class.boost::unit_test::test_results::readonly_property63" = type { %"class.boost::unit_test::readonly_property.213" }
%"class.boost::unit_test::readonly_property.213" = type { %"class.boost::unit_test::class_property.98" }
%"class.boost::unit_test::class_property.98" = type { i8 }

; 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 nonnull align 8 dereferenceable(8) ptr @_ZNK5boost9unit_test14class_propertyImEcvRKmEv(ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN5boost9unit_test9framework20current_test_case_idEv() #2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef nonnull align 8 dereferenceable(48) ptr @_ZN5boost9unit_test12_GLOBAL__N_19s_rc_implEv() #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5boost9unit_test19results_collector_t16assertion_resultENS0_16assertion_resultE(ptr noundef nonnull align 8 dereferenceable(8) %0, i32 noundef %1) unnamed_addr #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %7 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %8 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZN5boost9unit_test12_GLOBAL__N_19s_rc_implEv()
  %9 = getelementptr inbounds %"struct.boost::unit_test::(anonymous namespace)::results_collector_impl", ptr %8, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %10 = call noundef i64 @_ZN5boost9unit_test9framework20current_test_case_idEv()
  store i64 %10, ptr %6, align 8, !tbaa !11
  %11 = call noundef nonnull align 8 dereferenceable(107) ptr @_ZNSt3mapImN5boost9unit_test12test_resultsESt4lessImESaISt4pairIKmS2_EEEixEOm(ptr noundef nonnull align 8 dereferenceable(48) %9, ptr noundef nonnull align 8 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  store ptr %11, ptr %5, align 8, !tbaa !5
  %12 = load i32, ptr %4, align 4, !tbaa !9
  switch i32 %12, label %31 [
    i32 1, label %13
    i32 0, label %19
    i32 2, label %25
  ]

13:                                               ; preds = %2
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = getelementptr inbounds %"class.boost::unit_test::test_results", ptr %14, i32 0, i32 1
  %16 = getelementptr inbounds %"class.boost::unit_test::class_property", ptr %15, i32 0, i32 0
  %17 = load i64, ptr %16, align 8, !tbaa !13
  %18 = add i64 %17, 1
  store i64 %18, ptr %16, align 8, !tbaa !13
  br label %31

19:                                               ; preds = %2
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = getelementptr inbounds %"class.boost::unit_test::test_results", ptr %20, i32 0, i32 2
  %22 = getelementptr inbounds %"class.boost::unit_test::class_property", ptr %21, i32 0, i32 0
  %23 = load i64, ptr %22, align 8, !tbaa !13
  %24 = add i64 %23, 1
  store i64 %24, ptr %22, align 8, !tbaa !13
  br label %31

25:                                               ; preds = %2
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %"class.boost::unit_test::test_results", ptr %26, i32 0, i32 3
  %28 = getelementptr inbounds %"class.boost::unit_test::class_property", ptr %27, i32 0, i32 0
  %29 = load i64, ptr %28, align 8, !tbaa !13
  %30 = add i64 %29, 1
  store i64 %30, ptr %28, align 8, !tbaa !13
  br label %31

31:                                               ; preds = %25, %19, %13, %2
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds %"class.boost::unit_test::test_results", ptr %32, i32 0, i32 2
  %34 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK5boost9unit_test14class_propertyImEcvRKmEv(ptr noundef nonnull align 8 dereferenceable(8) %33)
  %35 = load i64, ptr %34, align 8, !tbaa !11
  %36 = icmp eq i64 %35, 1
  br i1 %36, label %37, label %38

37:                                               ; preds = %31
  call void @_ZN5boost9unit_test12_GLOBAL__N_122first_failed_assertionEv()
  br label %38

38:                                               ; preds = %37, %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(107) ptr @_ZNSt3mapImN5boost9unit_test12test_resultsESt4lessImESaISt4pairIKmS2_EEEixEOm(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @_ZN5boost9unit_test12_GLOBAL__N_122first_failed_assertionEv() #3

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 = { 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 #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, !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 = !{!"_ZTSN5boost9unit_test16assertion_resultE", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !12, i64 0}
!14 = !{!"_ZTSN5boost9unit_test14class_propertyImEE", !12, 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"

@switch.table._ZN5boost9unit_test19results_collector_t16assertion_resultENS0_16assertion_resultE = private unnamed_addr constant [3 x i64] [i64 16, i64 8, i64 24], align 8

; 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 nonnull align 8 dereferenceable(8) ptr @_ZNK5boost9unit_test14class_propertyImEcvRKmEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN5boost9unit_test9framework20current_test_case_idEv() local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef nonnull align 8 dereferenceable(48) ptr @_ZN5boost9unit_test12_GLOBAL__N_19s_rc_implEv() local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5boost9unit_test19results_collector_t16assertion_resultENS0_16assertion_resultE(ptr nocapture noundef nonnull readnone align 8 dereferenceable(8) %0, i32 noundef %1) unnamed_addr #2 align 2 {
  %3 = alloca i64, align 8
  %4 = tail call noundef nonnull align 8 dereferenceable(48) ptr @_ZN5boost9unit_test12_GLOBAL__N_19s_rc_implEv()
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  %5 = tail call noundef i64 @_ZN5boost9unit_test9framework20current_test_case_idEv()
  store i64 %5, ptr %3, align 8, !tbaa !5
  %6 = call noundef nonnull align 8 dereferenceable(107) ptr @_ZNSt3mapImN5boost9unit_test12test_resultsESt4lessImESaISt4pairIKmS2_EEEixEOm(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 8 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  %7 = icmp ult i32 %1, 3
  br i1 %7, label %switch.lookup, label %12

switch.lookup:                                    ; preds = %2
  %8 = zext nneg i32 %1 to i64
  %switch.gep = getelementptr inbounds [3 x i64], ptr @switch.table._ZN5boost9unit_test19results_collector_t16assertion_resultENS0_16assertion_resultE, i64 0, i64 %8
  %switch.load = load i64, ptr %switch.gep, align 8
  %9 = getelementptr inbounds i8, ptr %6, i64 %switch.load
  %10 = load i64, ptr %9, align 8, !tbaa !9
  %11 = add i64 %10, 1
  store i64 %11, ptr %9, align 8, !tbaa !9
  br label %12

12:                                               ; preds = %2, %switch.lookup
  %13 = getelementptr inbounds i8, ptr %6, i64 16
  %14 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK5boost9unit_test14class_propertyImEcvRKmEv(ptr noundef nonnull align 8 dereferenceable(8) %13)
  %15 = load i64, ptr %14, align 8, !tbaa !5
  %16 = icmp eq i64 %15, 1
  br i1 %16, label %17, label %18

17:                                               ; preds = %12
  call void @_ZN5boost9unit_test12_GLOBAL__N_122first_failed_assertionEv()
  br label %18

18:                                               ; preds = %17, %12
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(107) ptr @_ZNSt3mapImN5boost9unit_test12test_resultsESt4lessImESaISt4pairIKmS2_EEEixEOm(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @_ZN5boost9unit_test12_GLOBAL__N_122first_failed_assertionEv() local_unnamed_addr #3

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 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 = { 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, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"_ZTSN5boost9unit_test14class_propertyImEE", !6, i64 0}


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