; LLVM IR from Dimandragon/non-parametric-dsp :: alglib-cpp/src/optimization.ll (ZN6alglib24optguardnonc1test1reportC2Ev)

; 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.alglib::optguardnonc1test1report" = type { %"class.alglib::_optguardnonc1test1report_owner.base", ptr, ptr, ptr, %"class.alglib::real_1d_array", %"class.alglib::real_1d_array", ptr, %"class.alglib::real_1d_array", %"class.alglib::real_1d_array", ptr, ptr, ptr, ptr, ptr }
%"class.alglib::_optguardnonc1test1report_owner.base" = type <{ ptr, ptr, i8 }>
%"class.alglib::real_1d_array" = type { %"class.alglib::ae_vector_wrapper.base", [7 x i8] }
%"class.alglib::ae_vector_wrapper.base" = type <{ ptr, ptr, %"struct.alglib_impl::ae_vector", i8 }>
%"struct.alglib_impl::ae_vector" = type { i64, i64, i8, %"struct.alglib_impl::ae_dyn_block", %union.anon.0 }
%"struct.alglib_impl::ae_dyn_block" = type { ptr, ptr, ptr, ptr }
%union.anon.0 = type { ptr }
%"class.alglib::_optguardnonc1test1report_owner" = type <{ ptr, ptr, i8, [7 x i8] }>
%"struct.alglib_impl::optguardnonc1test1report" = type { i8, i64, i64, %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", i64, %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", i64, i64, i64, i64, i64 }

@_ZTVN6alglib24optguardnonc1test1reportE = external dso_local unnamed_addr constant { [4 x ptr] }, align 8

declare i32 @__gxx_personality_v0(...)

declare void @_ZN6alglib13real_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81), ptr noundef) unnamed_addr #0

; Function Attrs: nounwind
declare void @_ZN6alglib13real_1d_arrayD1Ev(ptr noundef nonnull align 8 dereferenceable(81)) unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6alglib31_optguardnonc1test1report_ownerC2Ev(ptr noundef nonnull align 8 dereferenceable(17)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6alglib24optguardnonc1test1reportC2Ev(ptr noundef nonnull align 8 dereferenceable(448) %0) unnamed_addr #2 align 2 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
  call void @_ZN6alglib31_optguardnonc1test1report_ownerC2Ev(ptr noundef nonnull align 8 dereferenceable(17) %5)
  store ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr] }, ptr @_ZTVN6alglib24optguardnonc1test1reportE, i32 0, i32 0, i32 2), ptr %5, align 8, !tbaa !9
  %6 = getelementptr inbounds %"class.alglib::optguardnonc1test1report", ptr %5, i32 0, i32 1
  %7 = getelementptr inbounds %"class.alglib::_optguardnonc1test1report_owner", ptr %5, i32 0, i32 1
  %8 = load ptr, ptr %7, align 8, !tbaa !11
  %9 = getelementptr inbounds %"struct.alglib_impl::optguardnonc1test1report", ptr %8, i32 0, i32 0
  store ptr %9, ptr %6, align 8, !tbaa !5
  %10 = getelementptr inbounds %"class.alglib::optguardnonc1test1report", ptr %5, i32 0, i32 2
  %11 = getelementptr inbounds %"class.alglib::_optguardnonc1test1report_owner", ptr %5, i32 0, i32 1
  %12 = load ptr, ptr %11, align 8, !tbaa !11
  %13 = getelementptr inbounds %"struct.alglib_impl::optguardnonc1test1report", ptr %12, i32 0, i32 1
  store ptr %13, ptr %10, align 8, !tbaa !5
  %14 = getelementptr inbounds %"class.alglib::optguardnonc1test1report", ptr %5, i32 0, i32 3
  %15 = getelementptr inbounds %"class.alglib::_optguardnonc1test1report_owner", ptr %5, i32 0, i32 1
  %16 = load ptr, ptr %15, align 8, !tbaa !11
  %17 = getelementptr inbounds %"struct.alglib_impl::optguardnonc1test1report", ptr %16, i32 0, i32 2
  store ptr %17, ptr %14, align 8, !tbaa !5
  %18 = getelementptr inbounds %"class.alglib::optguardnonc1test1report", ptr %5, i32 0, i32 4
  %19 = getelementptr inbounds %"class.alglib::_optguardnonc1test1report_owner", ptr %5, i32 0, i32 1
  %20 = load ptr, ptr %19, align 8, !tbaa !11
  %21 = getelementptr inbounds %"struct.alglib_impl::optguardnonc1test1report", ptr %20, i32 0, i32 3
  invoke void @_ZN6alglib13real_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81) %18, ptr noundef %21)
          to label %22 unwind label %62

22:                                               ; preds = %1
  %23 = getelementptr inbounds %"class.alglib::optguardnonc1test1report", ptr %5, i32 0, i32 5
  %24 = getelementptr inbounds %"class.alglib::_optguardnonc1test1report_owner", ptr %5, i32 0, i32 1
  %25 = load ptr, ptr %24, align 8, !tbaa !11
  %26 = getelementptr inbounds %"struct.alglib_impl::optguardnonc1test1report", ptr %25, i32 0, i32 4
  invoke void @_ZN6alglib13real_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81) %23, ptr noundef %26)
          to label %27 unwind label %66

27:                                               ; preds = %22
  %28 = getelementptr inbounds %"class.alglib::optguardnonc1test1report", ptr %5, i32 0, i32 6
  %29 = getelementptr inbounds %"class.alglib::_optguardnonc1test1report_owner", ptr %5, i32 0, i32 1
  %30 = load ptr, ptr %29, align 8, !tbaa !11
  %31 = getelementptr inbounds %"struct.alglib_impl::optguardnonc1test1report", ptr %30, i32 0, i32 5
  store ptr %31, ptr %28, align 8, !tbaa !5
  %32 = getelementptr inbounds %"class.alglib::optguardnonc1test1report", ptr %5, i32 0, i32 7
  %33 = getelementptr inbounds %"class.alglib::_optguardnonc1test1report_owner", ptr %5, i32 0, i32 1
  %34 = load ptr, ptr %33, align 8, !tbaa !11
  %35 = getelementptr inbounds %"struct.alglib_impl::optguardnonc1test1report", ptr %34, i32 0, i32 6
  invoke void @_ZN6alglib13real_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81) %32, ptr noundef %35)
          to label %36 unwind label %70

36:                                               ; preds = %27
  %37 = getelementptr inbounds %"class.alglib::optguardnonc1test1report", ptr %5, i32 0, i32 8
  %38 = getelementptr inbounds %"class.alglib::_optguardnonc1test1report_owner", ptr %5, i32 0, i32 1
  %39 = load ptr, ptr %38, align 8, !tbaa !11
  %40 = getelementptr inbounds %"struct.alglib_impl::optguardnonc1test1report", ptr %39, i32 0, i32 7
  invoke void @_ZN6alglib13real_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81) %37, ptr noundef %40)
          to label %41 unwind label %74

41:                                               ; preds = %36
  %42 = getelementptr inbounds %"class.alglib::optguardnonc1test1report", ptr %5, i32 0, i32 9
  %43 = getelementptr inbounds %"class.alglib::_optguardnonc1test1report_owner", ptr %5, i32 0, i32 1
  %44 = load ptr, ptr %43, align 8, !tbaa !11
  %45 = getelementptr inbounds %"struct.alglib_impl::optguardnonc1test1report", ptr %44, i32 0, i32 8
  store ptr %45, ptr %42, align 8, !tbaa !5
  %46 = getelementptr inbounds %"class.alglib::optguardnonc1test1report", ptr %5, i32 0, i32 10
  %47 = getelementptr inbounds %"class.alglib::_optguardnonc1test1report_owner", ptr %5, i32 0, i32 1
  %48 = load ptr, ptr %47, align 8, !tbaa !11
  %49 = getelementptr inbounds %"struct.alglib_impl::optguardnonc1test1report", ptr %48, i32 0, i32 9
  store ptr %49, ptr %46, align 8, !tbaa !5
  %50 = getelementptr inbounds %"class.alglib::optguardnonc1test1report", ptr %5, i32 0, i32 11
  %51 = getelementptr inbounds %"class.alglib::_optguardnonc1test1report_owner", ptr %5, i32 0, i32 1
  %52 = load ptr, ptr %51, align 8, !tbaa !11
  %53 = getelementptr inbounds %"struct.alglib_impl::optguardnonc1test1report", ptr %52, i32 0, i32 10
  store ptr %53, ptr %50, align 8, !tbaa !5
  %54 = getelementptr inbounds %"class.alglib::optguardnonc1test1report", ptr %5, i32 0, i32 12
  %55 = getelementptr inbounds %"class.alglib::_optguardnonc1test1report_owner", ptr %5, i32 0, i32 1
  %56 = load ptr, ptr %55, align 8, !tbaa !11
  %57 = getelementptr inbounds %"struct.alglib_impl::optguardnonc1test1report", ptr %56, i32 0, i32 11
  store ptr %57, ptr %54, align 8, !tbaa !5
  %58 = getelementptr inbounds %"class.alglib::optguardnonc1test1report", ptr %5, i32 0, i32 13
  %59 = getelementptr inbounds %"class.alglib::_optguardnonc1test1report_owner", ptr %5, i32 0, i32 1
  %60 = load ptr, ptr %59, align 8, !tbaa !11
  %61 = getelementptr inbounds %"struct.alglib_impl::optguardnonc1test1report", ptr %60, i32 0, i32 12
  store ptr %61, ptr %58, align 8, !tbaa !5
  ret void

62:                                               ; preds = %1
  %63 = landingpad { ptr, i32 }
          cleanup
  %64 = extractvalue { ptr, i32 } %63, 0
  store ptr %64, ptr %3, align 8
  %65 = extractvalue { ptr, i32 } %63, 1
  store i32 %65, ptr %4, align 4
  br label %80

66:                                               ; preds = %22
  %67 = landingpad { ptr, i32 }
          cleanup
  %68 = extractvalue { ptr, i32 } %67, 0
  store ptr %68, ptr %3, align 8
  %69 = extractvalue { ptr, i32 } %67, 1
  store i32 %69, ptr %4, align 4
  br label %79

70:                                               ; preds = %27
  %71 = landingpad { ptr, i32 }
          cleanup
  %72 = extractvalue { ptr, i32 } %71, 0
  store ptr %72, ptr %3, align 8
  %73 = extractvalue { ptr, i32 } %71, 1
  store i32 %73, ptr %4, align 4
  br label %78

74:                                               ; preds = %36
  %75 = landingpad { ptr, i32 }
          cleanup
  %76 = extractvalue { ptr, i32 } %75, 0
  store ptr %76, ptr %3, align 8
  %77 = extractvalue { ptr, i32 } %75, 1
  store i32 %77, ptr %4, align 4
  call void @_ZN6alglib13real_1d_arrayD1Ev(ptr noundef nonnull align 8 dereferenceable(81) %32) #4
  br label %78

78:                                               ; preds = %74, %70
  call void @_ZN6alglib13real_1d_arrayD1Ev(ptr noundef nonnull align 8 dereferenceable(81) %23) #4
  br label %79

79:                                               ; preds = %78, %66
  call void @_ZN6alglib13real_1d_arrayD1Ev(ptr noundef nonnull align 8 dereferenceable(81) %18) #4
  br label %80

80:                                               ; preds = %79, %62
  call void @_ZN6alglib31_optguardnonc1test1report_ownerD2Ev(ptr noundef nonnull align 8 dereferenceable(17) %5) #4
  br label %81

81:                                               ; preds = %80
  %82 = load ptr, ptr %3, align 8
  %83 = load i32, ptr %4, align 4
  %84 = insertvalue { ptr, i32 } poison, ptr %82, 0
  %85 = insertvalue { ptr, i32 } %84, i32 %83, 1
  resume { ptr, i32 } %85
}

attributes #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 = { 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 #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 = { 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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !6, i64 8}
!12 = !{!"_ZTSN6alglib31_optguardnonc1test1report_ownerE", !6, i64 8, !13, i64 16}
!13 = !{!"bool", !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"

@_ZTVN6alglib24optguardnonc1test1reportE = external dso_local unnamed_addr constant { [4 x ptr] }, align 8

declare i32 @__gxx_personality_v0(...)

declare void @_ZN6alglib13real_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81), ptr noundef) unnamed_addr #0

; Function Attrs: nounwind
declare void @_ZN6alglib13real_1d_arrayD1Ev(ptr noundef nonnull align 8 dereferenceable(81)) unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6alglib31_optguardnonc1test1report_ownerC2Ev(ptr noundef nonnull align 8 dereferenceable(17)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6alglib24optguardnonc1test1reportC2Ev(ptr noundef nonnull align 8 dereferenceable(448) %0) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN6alglib31_optguardnonc1test1report_ownerC2Ev(ptr noundef nonnull align 8 dereferenceable(17) %0)
  store ptr getelementptr inbounds inrange(-16, 16) (i8, ptr @_ZTVN6alglib24optguardnonc1test1reportE, i64 16), ptr %0, align 8, !tbaa !5
  %2 = getelementptr inbounds i8, ptr %0, i64 24
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load ptr, ptr %3, align 8, !tbaa !8
  store ptr %4, ptr %2, align 8, !tbaa !13
  %5 = getelementptr inbounds i8, ptr %0, i64 32
  %6 = getelementptr inbounds i8, ptr %4, i64 8
  store ptr %6, ptr %5, align 8, !tbaa !13
  %7 = getelementptr inbounds i8, ptr %0, i64 40
  %8 = getelementptr inbounds i8, ptr %4, i64 16
  store ptr %8, ptr %7, align 8, !tbaa !13
  %9 = getelementptr inbounds i8, ptr %0, i64 48
  %10 = getelementptr inbounds i8, ptr %4, i64 24
  invoke void @_ZN6alglib13real_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81) %9, ptr noundef nonnull %10)
          to label %11 unwind label %33

11:                                               ; preds = %1
  %12 = getelementptr inbounds i8, ptr %0, i64 136
  %13 = load ptr, ptr %3, align 8, !tbaa !8
  %14 = getelementptr inbounds i8, ptr %13, i64 88
  invoke void @_ZN6alglib13real_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81) %12, ptr noundef nonnull %14)
          to label %15 unwind label %35

15:                                               ; preds = %11
  %16 = getelementptr inbounds i8, ptr %0, i64 224
  %17 = load ptr, ptr %3, align 8, !tbaa !8
  %18 = getelementptr inbounds i8, ptr %17, i64 152
  store ptr %18, ptr %16, align 8, !tbaa !13
  %19 = getelementptr inbounds i8, ptr %0, i64 232
  %20 = getelementptr inbounds i8, ptr %17, i64 160
  invoke void @_ZN6alglib13real_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81) %19, ptr noundef nonnull %20)
          to label %21 unwind label %37

21:                                               ; preds = %15
  %22 = getelementptr inbounds i8, ptr %0, i64 320
  %23 = load ptr, ptr %3, align 8, !tbaa !8
  %24 = getelementptr inbounds i8, ptr %23, i64 224
  invoke void @_ZN6alglib13real_1d_arrayC1EPN11alglib_impl9ae_vectorE(ptr noundef nonnull align 8 dereferenceable(81) %22, ptr noundef nonnull %24)
          to label %25 unwind label %39

25:                                               ; preds = %21
  %26 = getelementptr inbounds i8, ptr %0, i64 408
  %27 = load ptr, ptr %3, align 8, !tbaa !8
  %28 = insertelement <4 x ptr> poison, ptr %27, i64 0
  %29 = shufflevector <4 x ptr> %28, <4 x ptr> poison, <4 x i32> zeroinitializer
  %30 = getelementptr i8, <4 x ptr> %29, <4 x i64> <i64 288, i64 296, i64 304, i64 312>
  store <4 x ptr> %30, ptr %26, align 8, !tbaa !13
  %31 = getelementptr inbounds i8, ptr %0, i64 440
  %32 = getelementptr inbounds i8, ptr %27, i64 320
  store ptr %32, ptr %31, align 8, !tbaa !13
  ret void

33:                                               ; preds = %1
  %34 = landingpad { ptr, i32 }
          cleanup
  br label %43

35:                                               ; preds = %11
  %36 = landingpad { ptr, i32 }
          cleanup
  br label %42

37:                                               ; preds = %15
  %38 = landingpad { ptr, i32 }
          cleanup
  br label %41

39:                                               ; preds = %21
  %40 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN6alglib13real_1d_arrayD1Ev(ptr noundef nonnull align 8 dereferenceable(81) %19) #4
  br label %41

41:                                               ; preds = %39, %37
  %.pn = phi { ptr, i32 } [ %40, %39 ], [ %38, %37 ]
  tail call void @_ZN6alglib13real_1d_arrayD1Ev(ptr noundef nonnull align 8 dereferenceable(81) %12) #4
  br label %42

42:                                               ; preds = %41, %35
  %.pn.pn = phi { ptr, i32 } [ %.pn, %41 ], [ %36, %35 ]
  tail call void @_ZN6alglib13real_1d_arrayD1Ev(ptr noundef nonnull align 8 dereferenceable(81) %9) #4
  br label %43

43:                                               ; preds = %42, %33
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %42 ], [ %34, %33 ]
  tail call void @_ZN6alglib31_optguardnonc1test1report_ownerD2Ev(ptr noundef nonnull align 8 dereferenceable(17) %0) #4
  resume { ptr, i32 } %.pn.pn.pn
}

attributes #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 = { 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 #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 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !10, i64 8}
!9 = !{!"_ZTSN6alglib31_optguardnonc1test1report_ownerE", !10, i64 8, !12, i64 16}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"bool", !11, i64 0}
!13 = !{!10, !10, i64 0}


; Effective O3 passes: EarlyCSEPass,InstCombinePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass