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

; 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::results_reporter::(anonymous namespace)::results_reporter_impl" = type { %"class.boost::unit_test::test_tree_visitor", ptr, %"class.boost::scoped_ptr.223", i32, %"class.boost::scoped_ptr.224" }
%"class.boost::unit_test::test_tree_visitor" = type { ptr }
%"class.boost::scoped_ptr.223" = type { ptr }
%"class.boost::scoped_ptr.224" = type { ptr }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5boost9unit_test16results_reporter10set_streamERSo(ptr noundef nonnull align 8 dereferenceable(8) %0) #0 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8, !tbaa !5
  %6 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZN5boost9unit_test16results_reporter12_GLOBAL__N_19s_rr_implEv()
  %7 = getelementptr inbounds %"struct.boost::unit_test::results_reporter::(anonymous namespace)::results_reporter_impl", ptr %6, i32 0, i32 1
  store ptr %5, ptr %7, align 8, !tbaa !9
  %8 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZN5boost9unit_test16results_reporter12_GLOBAL__N_19s_rr_implEv()
  %9 = getelementptr inbounds %"struct.boost::unit_test::results_reporter::(anonymous namespace)::results_reporter_impl", ptr %8, i32 0, i32 2
  %10 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 32) #4
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = load ptr, ptr %11, align 8, !tbaa !15
  %13 = getelementptr i8, ptr %12, i64 -24
  %14 = load i64, ptr %13, align 8
  %15 = getelementptr inbounds i8, ptr %11, i64 %14
  invoke void @_ZN5boost2io18ios_base_all_saverC2ERSt8ios_base(ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef nonnull align 8 dereferenceable(216) %15)
          to label %16 unwind label %17

16:                                               ; preds = %1
  call void @_ZN5boost10scoped_ptrINS_2io18ios_base_all_saverEE5resetEPS2_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef %10) #5
  ret void

17:                                               ; preds = %1
  %18 = landingpad { ptr, i32 }
          cleanup
  %19 = extractvalue { ptr, i32 } %18, 0
  store ptr %19, ptr %3, align 8
  %20 = extractvalue { ptr, i32 } %18, 1
  store i32 %20, ptr %4, align 4
  call void @_ZdlPvm(ptr noundef %10, i64 noundef 32) #6
  br label %21

21:                                               ; preds = %17
  %22 = load ptr, ptr %3, align 8
  %23 = load i32, ptr %4, align 4
  %24 = insertvalue { ptr, i32 } poison, ptr %22, 0
  %25 = insertvalue { ptr, i32 } %24, i32 %23, 1
  resume { ptr, i32 } %25
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #1

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden noundef nonnull align 8 dereferenceable(40) ptr @_ZN5boost9unit_test16results_reporter12_GLOBAL__N_19s_rr_implEv() #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5boost10scoped_ptrINS_2io18ios_base_all_saverEE5resetEPS2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5boost2io18ios_base_all_saverC2ERSt8ios_base(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(216)) unnamed_addr #0 align 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 = { nobuiltin allocsize(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 = { nobuiltin nounwind "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 = { 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 = { builtin allocsize(0) }
attributes #5 = { nounwind }
attributes #6 = { builtin 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, !6, i64 8}
!10 = !{!"_ZTSN5boost9unit_test16results_reporter12_GLOBAL__N_121results_reporter_implE", !11, i64 0, !6, i64 8, !12, i64 16, !13, i64 24, !14, i64 32}
!11 = !{!"_ZTSN5boost9unit_test17test_tree_visitorE"}
!12 = !{!"_ZTSN5boost10scoped_ptrINS_2io18ios_base_all_saverEEE", !6, i64 0}
!13 = !{!"_ZTSN5boost9unit_test12report_levelE", !7, i64 0}
!14 = !{!"_ZTSN5boost10scoped_ptrINS_9unit_test16results_reporter6formatEEE", !6, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"vtable pointer", !8, 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"

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5boost9unit_test16results_reporter10set_streamERSo(ptr noundef nonnull align 8 dereferenceable(8) %0) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %2 = tail call noundef nonnull align 8 dereferenceable(40) ptr @_ZN5boost9unit_test16results_reporter12_GLOBAL__N_19s_rr_implEv()
  %3 = getelementptr inbounds i8, ptr %2, i64 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %4 = tail call noundef nonnull align 8 dereferenceable(40) ptr @_ZN5boost9unit_test16results_reporter12_GLOBAL__N_19s_rr_implEv()
  %5 = tail call noalias noundef nonnull dereferenceable(32) ptr @_Znwm(i64 noundef 32) #4
  %6 = load ptr, ptr %0, align 8, !tbaa !14
  %7 = getelementptr i8, ptr %6, i64 -24
  %8 = load i64, ptr %7, align 8
  %9 = getelementptr inbounds i8, ptr %0, i64 %8
  invoke void @_ZN5boost2io18ios_base_all_saverC2ERSt8ios_base(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef nonnull align 8 dereferenceable(216) %9)
          to label %10 unwind label %12

10:                                               ; preds = %1
  %11 = getelementptr inbounds i8, ptr %4, i64 16
  tail call void @_ZN5boost10scoped_ptrINS_2io18ios_base_all_saverEE5resetEPS2_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull %5) #5
  ret void

12:                                               ; preds = %1
  %13 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %5, i64 noundef 32) #6
  resume { ptr, i32 } %13
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #1

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare hidden noundef nonnull align 8 dereferenceable(40) ptr @_ZN5boost9unit_test16results_reporter12_GLOBAL__N_19s_rr_implEv() local_unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5boost2io18ios_base_all_saverC2ERSt8ios_base(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(216)) unnamed_addr #0 align 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 = { nobuiltin allocsize(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 = { nobuiltin nounwind "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 = { 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 = { builtin allocsize(0) }
attributes #5 = { nounwind }
attributes #6 = { builtin 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, !8, i64 8}
!6 = !{!"_ZTSN5boost9unit_test16results_reporter12_GLOBAL__N_121results_reporter_implE", !7, i64 0, !8, i64 8, !11, i64 16, !12, i64 24, !13, i64 32}
!7 = !{!"_ZTSN5boost9unit_test17test_tree_visitorE"}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"_ZTSN5boost10scoped_ptrINS_2io18ios_base_all_saverEEE", !8, i64 0}
!12 = !{!"_ZTSN5boost9unit_test12report_levelE", !9, i64 0}
!13 = !{!"_ZTSN5boost10scoped_ptrINS_9unit_test16results_reporter6formatEEE", !8, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"vtable pointer", !10, i64 0}


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